regressions: Enable both tests for bug 576879 (not fixed).
[libguestfs.git] / fuse / test-fuse.sh
index fffd851..6d2f0fe 100755 (executable)
@@ -69,8 +69,8 @@ function cleanup ()
     # you from unmounting it!  Hence the need for this loop.
     count=10
     while ! fusermount -u "$mp" && [ $count -gt 0 ]; do
-       sleep 1
-       ((count--))
+        sleep 1
+        ((count--))
     done
 
     rm -f "$image"
@@ -86,20 +86,24 @@ function stage ()
     ((s++))
 }
 
-stage Create filesystem with some inital content
+stage Create filesystem with some initial content
 $guestfish <<EOF
   sparse "$image" 10M
   run
   part-disk /dev/sda mbr
   mkfs ext2 /dev/sda1
   mount /dev/sda1 /
-  write-file /hello.txt hello 0
-  write-file /world.txt "hello world" 0
+  write /hello.txt hello
+  write /world.txt "hello world"
   touch /empty
 EOF
 
 stage Mounting the filesystem
-$guestmount -a "$image" -m /dev/sda1 "$mp"
+$guestmount \
+    -a "$image" -m /dev/sda1 \
+    -o uid="$(id -u)" -o gid="$(id -g)" "$mp"
+# To debug guestmount, add this to the end of the preceding command:
+# -v -x & sleep 60
 
 stage Changing into mounted directory
 cd "$mp"
@@ -195,17 +199,29 @@ truncate -c -s 0 truncated
 [ "$(stat -c %s truncated)" -eq 0 ]
 rm -f truncated
 
-stage Checking utimens and timestamps
-for ts in 12345 1234567 987654321; do
-    # NB: It's not possible to set the ctime with touch.
-    touch -a -d @$ts timestamp
-    [ "$(stat -c %X timestamp)" -eq $ts ]
-    touch -m -d @$ts timestamp
-    [ "$(stat -c %Y timestamp)" -eq $ts ]
-    touch    -d @$ts timestamp
-    [ "$(stat -c %X timestamp)" -eq $ts ]
-    [ "$(stat -c %Y timestamp)" -eq $ts ]
-done
+# Disabled because of RHBZ#660687 on Debian.
+# stage Checking utimens and timestamps
+# for ts in 12345 1234567 987654321; do
+#     # NB: It's not possible to set the ctime with touch.
+#     touch -a -d @$ts timestamp
+#     [ "$(stat -c %X timestamp)" -eq $ts ]
+#     touch -m -d @$ts timestamp
+#     [ "$(stat -c %Y timestamp)" -eq $ts ]
+#     touch    -d @$ts timestamp
+#     [ "$(stat -c %X timestamp)" -eq $ts ]
+#     [ "$(stat -c %Y timestamp)" -eq $ts ]
+# done
+
+stage Checking writes
+cp hello.txt copy.txt
+echo >> copy.txt
+echo world >> copy.txt
+echo bigger >> copy.txt
+echo biggest >> copy.txt
+[ "$(cat copy.txt)" = "hello
+world
+bigger
+biggest" ]
 
 # These ones are not yet tested by the current script:
 #stage XXX statfs/statvfs