]> arthur.barton.de Git - bup.git/blobdiff - t/test-meta.sh
sampledata: include random binary paths
[bup.git] / t / test-meta.sh
index 1170d71b3900fcd1f981847a667431329b93afa6..eb1f97b4896dae028cc003934fea42a56cbc7142 100755 (executable)
@@ -45,8 +45,8 @@ genstat()
     (
         export PATH="$TOP:$PATH" # pick up bup
         # Skip atime (test elsewhere) to avoid the observer effect.
-        WVPASS find . | WVPASS sort \
-            | WVPASS xargs bup xstat \
+        WVPASS find . -print0 | WVPASS sort -z \
+            | WVPASS xargs -0 bup xstat \
             --mtime-resolution "$mtime_resolution"ns \
             --exclude-fields ctime,atime,size
     )
@@ -171,8 +171,11 @@ WVSTART 'metadata save/restore (general)'
     # Check that the only difference is the top dir.
     WVFAIL $TOP/t/compare-trees -c src/var/ src-restore/ > tmp-compare-trees
     WVPASSEQ $(cat tmp-compare-trees | wc -l) 1
-    # Note: OS X rsync itemize output is currently only 9 chars, not 11.
-    expected_diff_rx='^\.d\.\.t.\.\.\.\.?\.? \./$'
+    # The number of rsync status characters varies, so accept any
+    # number of trailing dots.  For example OS X native rsync produces
+    # 9, but Homebrew's produces 12, while on other platforms, 11 is
+    # common.
+    expected_diff_rx='^\.d\.\.t\.\.\.(\.)+ \./$'
     if ! grep -qE "$expected_diff_rx" tmp-compare-trees; then
         echo -n 'tmp-compare-trees: ' 1>&2
         cat tmp-compare-trees 1>&2
@@ -435,10 +438,11 @@ src/foo/3"
 
     tmpdir="$(WVPASS wvmktempdir)" || exit $?    
 
+    # FIXME: binary groups
     first_group="$(WVPASS bup-python -c 'import os,grp; \
-      print grp.getgrgid(os.getgroups()[0])[0]')" || exit $?
+      print(grp.getgrgid(os.getgroups()[0])[0])')" || exit $?
     last_group="$(bup-python -c 'import os,grp; \
-      print grp.getgrgid(os.getgroups()[-1])[0]')" || exit $?
+      print(grp.getgrgid(os.getgroups()[-1])[0])')" || exit $?
     last_group_erx="$(escape-erx "$last_group")"
 
     WVSTART 'metadata (restoration of ownership)'
@@ -674,11 +678,10 @@ if [ "$root_status" = root ]; then
         (
             WVPASS mkdir "$testfs"/src/foo
             WVPASS touch "$testfs"/src/bar
-            PYTHONPATH="$TOP/lib" \
-                WVPASS bup-python -c "from bup import xstat; \
+            WVPASS bup-python -c "from bup import xstat; \
                 x = xstat.timespec_to_nsecs((42, 0));\
-                   xstat.utime('$testfs/src/foo', (x, x));\
-                   xstat.utime('$testfs/src/bar', (x, x));"
+                xstat.utime(b'$testfs/src/foo', (x, x));\
+                xstat.utime(b'$testfs/src/bar', (x, x));"
             WVPASS cd "$testfs"
             WVPASS bup meta -v --create --recurse --file src.meta src
             WVPASS bup meta -tvf src.meta
@@ -704,7 +707,7 @@ if [ "$root_status" = root ]; then
         (
             WVPASS touch "$testfs"/src/foo
             WVPASS mkdir "$testfs"/src/bar
-            WVPASS chattr +acdeijstuADST "$testfs"/src/foo
+            WVPASS chattr +acdeijstuADS "$testfs"/src/foo
             WVPASS chattr +acdeijstuADST "$testfs"/src/bar
             (WVPASS cd "$testfs"; WVPASS test-src-create-extract) || exit $?
             # Test restoration to a limited filesystem (vfat).
@@ -739,7 +742,7 @@ if [ "$root_status" = root ]; then
             WVPASS cd "$testfs_limited"/src-restore
             WVFAIL bup meta --extract --file "$testfs"/src.meta
             WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \
-                | WVPASS grep -e "^xattr\.set '" \
+                | WVPASS grep -e "^xattr\.set u\?'" \
                 | WVPASS bup-python -c \
                 'import sys; exit(not len(sys.stdin.readlines()) == 2)'
         ) || exit $?