X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=t%2Ftest-meta.sh;h=73ce11672063c54c188508b7e7afb52ffb5fbb44;hb=dd6794a7cc9a21c942cecf8bcdd5a8f217e197fa;hp=b7e26533c80354b3f63d296419b550871f478f21;hpb=c04dc74d0a65aff4c127d3190e29d614cdfb3bd8;p=bup.git diff --git a/t/test-meta.sh b/t/test-meta.sh index b7e2653..73ce116 100755 --- a/t/test-meta.sh +++ b/t/test-meta.sh @@ -1,22 +1,24 @@ #!/usr/bin/env bash -. wvtest.sh -. t/lib.sh +. wvtest-bup.sh || exit $? +. t/lib.sh || exit $? set -o pipefail +root_status="$(t/root-status)" || exit $? + TOP="$(WVPASS pwd)" || exit $? -export BUP_DIR="$TOP/buptest.tmp" +export PATH="$TOP/t/bin:$PATH" +tmpdir="$(WVPASS wvmktempdir)" || exit $? +export BUP_DIR="$tmpdir/bup" -WVPASS force-delete "$TOP/bupmeta.tmp" -timestamp_resolutions="$(t/ns-timestamp-resolutions "$TOP/bupmeta.tmp")" \ +# Assume that mvmktempdir will always use the same dir. +timestamp_resolutions="$(t/ns-timestamp-resolutions "$tmpdir/canary")" \ || exit $? -WVPASS rm "$TOP/bupmeta.tmp" atime_resolution="$(echo $timestamp_resolutions | WVPASS cut -d' ' -f 1)" \ || exit $? mtime_resolution="$(echo $timestamp_resolutions | WVPASS cut -d' ' -f 2)" \ || exit $? - -root_status="$(t/root-status)" || exit $? +WVPASS rm "$tmpdir/canary" bup() { @@ -42,10 +44,11 @@ id-other-than() genstat() { ( - export PATH="$TOP:$PATH" # pick up bup + export PATH="$TOP/bin:$PATH" # pick up bup + bup version # 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 ) @@ -79,13 +82,11 @@ test-src-create-extract() test-src-save-restore() { # Test bup save/restore metadata for ./src -> ./src-restore. Also - # writes to ./src.bup. Note that for now this just tests the + # writes to BUP_DIR. Note that for now this just tests the # restore below src/, in order to avoid having to worry about # operations that require root (like chown /home). ( - WVPASS rm -rf src.bup - WVPASS mkdir src.bup - export BUP_DIR=$(pwd)/src.bup || exit $? + WVPASS rm -rf "$BUP_DIR" WVPASS bup init WVPASS bup index src WVPASS bup save -t -n src src @@ -99,26 +100,13 @@ test-src-save-restore() ) } -universal-cleanup() -{ - if [ "$root_status" != root ]; then return 0; fi - umount "$TOP/bupmeta.tmp/testfs" || true - umount "$TOP/bupmeta.tmp/testfs-limited" || true -} - -WVPASS universal-cleanup -trap universal-cleanup EXIT - setup-test-tree() { - WVPASS force-delete "$BUP_DIR" - WVPASS force-delete "$TOP/bupmeta.tmp" - WVPASS mkdir -p "$TOP/bupmeta.tmp/src" - WVPASS cp -pPR Documentation cmd config lib "$TOP/bupmeta.tmp"/src + WVPASS "$TOP/t/sync-tree" "$TOP/t/sampledata/" "$tmpdir/src/" # Add some hard links for the general tests. ( - WVPASS cd "$TOP/bupmeta.tmp"/src + WVPASS cd "$tmpdir"/src WVPASS touch hardlink-target WVPASS ln hardlink-target hardlink-1 WVPASS ln hardlink-target hardlink-2 @@ -127,7 +115,7 @@ setup-test-tree() # Add some trivial files for the index, modify, save tests. ( - WVPASS cd "$TOP/bupmeta.tmp"/src + WVPASS cd "$tmpdir"/src WVPASS mkdir volatile WVPASS touch volatile/{1,2,3} ) || exit $? @@ -135,18 +123,20 @@ setup-test-tree() # Regression test for metadata sort order. Previously, these two # entries would sort in the wrong order because the metadata # entries were being sorted by mangled name, but the index isn't. - WVPASS dd if=/dev/zero of="$TOP/bupmeta.tmp"/src/foo bs=1k count=33 - WVPASS touch -t 201111111111 "$TOP/bupmeta.tmp"/src/foo - WVPASS touch -t 201112121111 "$TOP/bupmeta.tmp"/src/foo-bar + WVPASS dd if=/dev/zero of="$tmpdir"/src/foo bs=1k count=33 + WVPASS touch -t 201111111111 "$tmpdir"/src/foo + WVPASS touch -t 201112121111 "$tmpdir"/src/foo-bar - t/mksock "$TOP/bupmeta.tmp/src/test-socket" || true + t/mksock "$tmpdir"/src/test-socket || true } # Use the test tree to check bup meta. WVSTART 'meta --create/--extract' ( + tmpdir="$(WVPASS wvmktempdir)" || exit $? + export BUP_DIR="$tmpdir/bup" WVPASS setup-test-tree - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" WVPASS test-src-create-extract # Test a top-level file (not dir). @@ -155,34 +145,45 @@ WVSTART 'meta --create/--extract' WVPASS mkdir dest WVPASS cd dest WVPASS bup meta -xf ../src-file.meta + WVPASS rm -r "$tmpdir" ) || exit $? # Use the test tree to check bup save/restore metadata. WVSTART 'metadata save/restore (general)' ( + tmpdir="$(WVPASS wvmktempdir)" || exit $? + export BUP_DIR="$tmpdir/bup" WVPASS setup-test-tree - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" WVPASS test-src-save-restore # Test a deeper subdir/ to make sure top-level non-dir metadata is # restored correctly. We need at least one dir and one non-dir at # the "top-level". - WVPASS test -f src/lib/__init__.py - WVPASS test -d src/lib/bup - WVPASS rm -rf src.bup - WVPASS mkdir src.bup - export BUP_DIR=$(pwd)/src.bup || exit $? + WVPASS test -d src/var/cmd + WVPASS test -f src/var/cmd/save-cmd.py + WVPASS rm -rf "$BUP_DIR" WVPASS bup init WVPASS touch -t 201111111111 src-restore # Make sure the top won't match. WVPASS bup index src WVPASS bup save -t -n src src WVPASS force-delete src-restore - WVPASS bup restore -C src-restore "/src/latest$(pwd)/src/lib/" + WVPASS bup restore -C src-restore "/src/latest$(pwd)/src/var/." WVPASS touch -t 201211111111 src-restore # Make sure the top won't match. # Check that the only difference is the top dir. - WVFAIL $TOP/t/compare-trees -c src/lib/ src-restore/ > tmp-compare-trees - WVPASSEQ $(cat tmp-compare-trees | wc -l) 2 - WVPASS tail -n +2 tmp-compare-trees | WVPASS grep -qE '^\.d[^ ]+ \./$' + WVFAIL $TOP/t/compare-trees -c src/var/ src-restore/ > tmp-compare-trees + WVPASSEQ $(cat tmp-compare-trees | wc -l) 1 + # 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 + fi + WVPASS grep -qE "$expected_diff_rx" tmp-compare-trees + WVPASS rm -r "$tmpdir" ) || exit $? # Test that we pull the index (not filesystem) metadata for any @@ -190,8 +191,10 @@ WVSTART 'metadata save/restore (general)' # directory. WVSTART 'metadata save/restore (using index metadata)' ( + tmpdir="$(WVPASS wvmktempdir)" || exit $? + export BUP_DIR="$tmpdir/bup" WVPASS setup-test-tree - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" # ...for now -- might be a problem with hardlink restores that was # causing noise wrt this test. @@ -204,9 +207,7 @@ WVSTART 'metadata save/restore (using index metadata)' # these metadata..." may fail. WVPASS sleep 1 - WVPASS rm -rf src.bup - WVPASS mkdir src.bup - export BUP_DIR=$(pwd)/src.bup || exit $? + WVPASS rm -rf "$BUP_DIR" WVPASS bup init WVPASS bup index src WVPASS bup save -t -n src src @@ -218,7 +219,7 @@ WVSTART 'metadata save/restore (using index metadata)' WVPASS "$TOP/t/compare-trees" -c src/ src-restore-1/src/ WVPASS echo "blarg" > src/volatile/1 - WVPASS cp -a src/volatile/1 src-restore-1/src/volatile/ + WVPASS cp -pP src/volatile/1 src-restore-1/src/volatile/ WVPASS bup index src # Bup should *not* pick up these metadata changes. @@ -232,14 +233,16 @@ WVSTART 'metadata save/restore (using index metadata)' WVPASS test -d src-restore-2/src WVPASS "$TOP/t/compare-trees" -c src-restore-1/src/ src-restore-2/src/ - WVPASS rm -rf src.bup + WVPASS rm -r "$tmpdir" + ) || exit $? + setup-hardlink-test() { - WVPASS rm -rf "$TOP/bupmeta.tmp"/src "$TOP/bupmeta.tmp"/src.bup - WVPASS mkdir "$TOP/bupmeta.tmp"/src "$TOP/bupmeta.tmp"/src.bup + WVPASS rm -rf "$tmpdir/src" "$BUP_DIR" WVPASS bup init + WVPASS mkdir "$tmpdir/src" } hardlink-test-run-restore() @@ -253,16 +256,15 @@ hardlink-test-run-restore() # Test hardlinks more carefully. WVSTART 'metadata save/restore (hardlinks)' ( - export BUP_DIR="$TOP/bupmeta.tmp/src.bup" - WVPASS force-delete "$TOP/bupmeta.tmp" - WVPASS mkdir -p "$TOP/bupmeta.tmp" + tmpdir="$(WVPASS wvmktempdir)" || exit $? + export BUP_DIR="$tmpdir/bup" - WVPASS cd "$TOP/bupmeta.tmp" - - # Test trivial case - single hardlink. WVPASS setup-hardlink-test + WVPASS cd "$tmpdir" + + # Test trivial case - single hardlink. ( - WVPASS cd "$TOP/bupmeta.tmp"/src + WVPASS cd src WVPASS touch hardlink-target WVPASS ln hardlink-target hardlink-1 ) || exit $? @@ -275,7 +277,7 @@ WVSTART 'metadata save/restore (hardlinks)' # needs to be saved again. i.e. the save-cmd.py "if hashvalid:" # case. ( - WVPASS cd "$TOP/bupmeta.tmp"/src + WVPASS cd src WVPASS echo whatever > something-new ) || exit $? WVPASS bup index src @@ -286,7 +288,7 @@ WVSTART 'metadata save/restore (hardlinks)' # Test hardlink changes between index runs. # WVPASS setup-hardlink-test - WVPASS cd "$TOP/bupmeta.tmp"/src + WVPASS cd src WVPASS touch hardlink-target-a WVPASS touch hardlink-target-b WVPASS ln hardlink-target-a hardlink-b-1 @@ -311,7 +313,7 @@ WVSTART 'metadata save/restore (hardlinks)' # b c d] changes to [a b] [c d]. At least right now bup should # notice and recreate the latter. WVPASS setup-hardlink-test - WVPASS cd "$TOP/bupmeta.tmp"/src + WVPASS cd "$tmpdir"/src WVPASS touch a WVPASS ln a b WVPASS ln a c @@ -334,7 +336,7 @@ WVSTART 'metadata save/restore (hardlinks)' # Test that we don't link outside restore tree. WVPASS setup-hardlink-test - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" WVPASS mkdir src/a src/b WVPASS touch src/a/1 WVPASS ln src/a/1 src/b/1 @@ -351,7 +353,7 @@ WVSTART 'metadata save/restore (hardlinks)' # Test that we do link within separate sub-trees. WVPASS setup-hardlink-test - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" WVPASS mkdir src/a src/b WVPASS touch src/a/1 WVPASS ln src/a/1 src/b/1 @@ -363,14 +365,17 @@ WVSTART 'metadata save/restore (hardlinks)' (WVPASS cd src-restore; WVPASS hardlink-sets .) > hardlink-sets.restored \ || exit $? WVPASS diff -u hardlink-sets.expected hardlink-sets.restored + + WVPASS rm -r "$tmpdir" + ) || exit $? WVSTART 'meta --edit' ( - WVPASS force-delete "$TOP/bupmeta.tmp" - WVPASS mkdir "$TOP/bupmeta.tmp" - WVPASS cd "$TOP/bupmeta.tmp" + tmpdir="$(WVPASS wvmktempdir)" || exit $? + WVPASS cd "$tmpdir" WVPASS mkdir src + WVPASS bup meta -cf src.meta src WVPASS bup meta --edit --set-uid 0 src.meta | WVPASS bup meta -tvvf - \ @@ -404,25 +409,27 @@ WVSTART 'meta --edit' | WVPASS bup meta -tvvf - | WVPASS grep -qE '^group:' WVPASS bup meta --edit --unset-group --set-group bar src.meta \ | WVPASS bup meta -tvvf - | grep -qE '^group: bar' + + WVPASS rm -r "$tmpdir" + ) || exit $? WVSTART 'meta --no-recurse' ( - set +e - WVPASS force-delete "$TOP/bupmeta.tmp" - WVPASS mkdir "$TOP/bupmeta.tmp" - WVPASS cd "$TOP/bupmeta.tmp" + tmpdir="$(WVPASS wvmktempdir)" || exit $? + WVPASS cd "$tmpdir" WVPASS mkdir src WVPASS mkdir src/foo WVPASS touch src/foo/{1,2,3} WVPASS bup meta -cf src.meta src - WVPASSEQ "$(LC_ALL=C; bup meta -tf src.meta | sort)" "src/ + WVPASSEQ "$(bup meta -tf src.meta | LC_ALL=C sort)" "src/ src/foo/ src/foo/1 src/foo/2 src/foo/3" WVPASS bup meta --no-recurse -cf src.meta src - WVPASSEQ "$(LC_ALL=C; bup meta -tf src.meta | sort)" "src/" + WVPASSEQ "$(bup meta -tf src.meta | LC_ALL=C sort)" "src/" + WVPASS rm -r "$tmpdir" ) || exit $? # Test ownership restoration (when not root or fakeroot). @@ -431,16 +438,17 @@ src/foo/3" exit 0 fi - first_group="$(WVPASS python -c 'import os,grp; \ - print grp.getgrgid(os.getgroups()[0])[0]')" || exit $? - last_group="$(python -c 'import os,grp; \ - print grp.getgrgid(os.getgroups()[-1])[0]')" || exit $? + tmpdir="$(WVPASS wvmktempdir)" || exit $? + + # FIXME: binary groups + first_group="$(WVPASS bup-cfg-py -c 'import os,grp; \ + print(grp.getgrgid(os.getgroups()[0])[0])')" || exit $? + last_group="$(bup-cfg-py -c 'import os,grp; \ + print(grp.getgrgid(os.getgroups()[-1])[0])')" || exit $? last_group_erx="$(escape-erx "$last_group")" WVSTART 'metadata (restoration of ownership)' - WVPASS force-delete "$TOP/bupmeta.tmp" - WVPASS mkdir "$TOP/bupmeta.tmp" - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" WVPASS touch src # Some systems always assign the parent dir group to new paths # (sgid). Make sure the group is one we're in. @@ -497,6 +505,9 @@ src/foo/3" | WVPASS bup meta -x new_gidx=$(bup xstat src | grep -e '^gid:') || exit $? WVPASSEQ "$current_gidx" "$new_gidx" + + WVPASS rm -r "$tmpdir" + ) || exit $? # Test ownership restoration (when root or fakeroot). @@ -505,13 +516,13 @@ src/foo/3" exit 0 fi + tmpdir="$(WVPASS wvmktempdir)" || exit $? + uid=$(WVPASS id -un) || exit $? gid=$(WVPASS id -gn) || exit $? WVSTART 'metadata (restoration of ownership as root)' - WVPASS force-delete "$TOP/bupmeta.tmp" - WVPASS mkdir "$TOP/bupmeta.tmp" - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" WVPASS touch src WVPASS chown "$uid:$gid" src # In case the parent dir is sgid, etc. WVPASS bup meta -cf src.meta src @@ -612,6 +623,9 @@ src/foo/3" WVPASS bup xstat src | WVPASS grep -qvE "^group: $other_group2_erx" WVPASS bup xstat src | WVPASS grep -qE "^gid: 0" fi + + WVPASS rm -r "$tmpdir" + ) || exit $? @@ -624,11 +638,21 @@ if [ "$root_status" = root ]; then # (patches welcome). [[ $(uname) =~ Linux ]] || exit 0 + if ! modprobe loop; then + echo 'Unable to load loopback module; skipping dependent tests.' 1>&2 + exit 0 + fi + + testfs="$(WVPASS wvmkmountpt)" || exit $? + testfs_limited="$(WVPASS wvmkmountpt)" || exit $? + tmpdir="$(WVPASS wvmktempdir)" || exit $? + export BUP_DIR="$tmpdir/bup" + WVSTART 'meta - general (as root)' WVPASS setup-test-tree - WVPASS cd "$TOP/bupmeta.tmp" + WVPASS cd "$tmpdir" - umount testfs + umount "$testfs" WVPASS dd if=/dev/zero of=testfs.img bs=1M count=32 # Make sure we have all the options the chattr test needs # (i.e. create a "normal" ext4 filesystem). @@ -636,34 +660,31 @@ if [ "$root_status" = root ]; then -I 256 \ -O has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize \ testfs.img - WVPASS mkdir testfs - WVPASS mount -o loop,acl,user_xattr testfs.img testfs + WVPASS mount -o loop,acl,user_xattr testfs.img "$testfs" # Hide, so that tests can't create risks. - WVPASS chown root:root testfs - WVPASS chmod 0700 testfs + WVPASS chown root:root "$testfs" + WVPASS chmod 0700 "$testfs" - umount testfs-limited + umount "$testfs_limited" WVPASS dd if=/dev/zero of=testfs-limited.img bs=1M count=32 WVPASS mkfs -t vfat testfs-limited.img - WVPASS mkdir testfs-limited WVPASS mount -o loop,uid=root,gid=root,umask=0077 \ - testfs-limited.img testfs-limited + testfs-limited.img "$testfs_limited" - WVPASS cp -pPR src testfs/src - (WVPASS cd testfs; WVPASS test-src-create-extract) || exit $? + WVPASS cp -pPR src "$testfs"/src + (WVPASS cd "$testfs"; WVPASS test-src-create-extract) || exit $? WVSTART 'meta - atime (as root)' - WVPASS force-delete testfs/src - WVPASS mkdir testfs/src + WVPASS force-delete "$testfs"/src + WVPASS mkdir "$testfs"/src ( - WVPASS mkdir testfs/src/foo - WVPASS touch testfs/src/bar - PYTHONPATH="$TOP/lib" \ - WVPASS python -c "from bup import xstat; \ + WVPASS mkdir "$testfs"/src/foo + WVPASS touch "$testfs"/src/bar + 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));" - WVPASS cd testfs + 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 # Test extract. @@ -683,71 +704,80 @@ if [ "$root_status" = root ]; then ) || exit $? WVSTART 'meta - Linux attr (as root)' - WVPASS force-delete testfs/src - WVPASS mkdir testfs/src + WVPASS force-delete "$testfs"/src + WVPASS mkdir "$testfs"/src ( - WVPASS touch testfs/src/foo - WVPASS mkdir testfs/src/bar - WVPASS chattr +acdeijstuADST testfs/src/foo - WVPASS chattr +acdeijstuADST testfs/src/bar - (WVPASS cd testfs; WVPASS test-src-create-extract) || exit $? + WVPASS touch "$testfs"/src/foo + WVPASS mkdir "$testfs"/src/bar + 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). ( - WVPASS bup meta --create --recurse --file testfs/src.meta \ - testfs/src - WVPASS force-delete testfs-limited/src-restore - WVPASS mkdir testfs-limited/src-restore - WVPASS cd testfs-limited/src-restore - WVFAIL bup meta --extract --file ../../testfs/src.meta 2>&1 \ + WVPASS bup meta --create --recurse --file "$testfs"/src.meta \ + "$testfs"/src + WVPASS force-delete "$testfs_limited"/src-restore + WVPASS mkdir "$testfs_limited"/src-restore + WVPASS cd "$testfs_limited"/src-restore + WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \ | WVPASS grep -e '^Linux chattr:' \ - | WVPASS python -c \ + | WVPASS bup-cfg-py -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 3)' ) || exit $? ) || exit $? WVSTART 'meta - Linux xattr (as root)' - WVPASS force-delete testfs/src - WVPASS mkdir testfs/src - WVPASS touch testfs/src/foo - WVPASS mkdir testfs/src/bar - WVPASS attr -s foo -V bar testfs/src/foo - WVPASS attr -s foo -V bar testfs/src/bar - (WVPASS cd testfs; WVPASS test-src-create-extract) || exit $? + WVPASS force-delete "$testfs"/src + WVPASS mkdir "$testfs"/src + WVPASS touch "$testfs"/src/foo + WVPASS mkdir "$testfs"/src/bar + WVPASS attr -s foo -V bar "$testfs"/src/foo + WVPASS attr -s foo -V bar "$testfs"/src/bar + (WVPASS cd "$testfs"; WVPASS test-src-create-extract) || exit $? # Test restoration to a limited filesystem (vfat). ( - WVPASS bup meta --create --recurse --file testfs/src.meta \ - testfs/src - WVPASS force-delete testfs-limited/src-restore - WVPASS mkdir testfs-limited/src-restore - 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 python -c \ + WVPASS bup meta --create --recurse --file "$testfs"/src.meta \ + "$testfs"/src + WVPASS force-delete "$testfs_limited"/src-restore + WVPASS mkdir "$testfs_limited"/src-restore + 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 u\?'" \ + | WVPASS bup-cfg-py -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 2)' ) || exit $? WVSTART 'meta - POSIX.1e ACLs (as root)' - WVPASS force-delete testfs/src - WVPASS mkdir testfs/src - WVPASS touch testfs/src/foo - WVPASS mkdir testfs/src/bar - WVPASS setfacl -m u:root:r testfs/src/foo - WVPASS setfacl -m u:root:r testfs/src/bar - (WVPASS cd testfs; WVPASS test-src-create-extract) || exit $? + WVPASS force-delete "$testfs"/src + WVPASS mkdir "$testfs"/src + WVPASS touch "$testfs"/src/foo + WVPASS mkdir "$testfs"/src/bar + WVPASS setfacl -m u:root:r "$testfs"/src/foo + WVPASS setfacl -m u:root:r "$testfs"/src/bar + (WVPASS cd "$testfs"; WVPASS test-src-create-extract) || exit $? # Test restoration to a limited filesystem (vfat). ( - WVPASS bup meta --create --recurse --file testfs/src.meta \ - testfs/src - WVPASS force-delete testfs-limited/src-restore - WVPASS mkdir testfs-limited/src-restore - WVPASS cd testfs-limited/src-restore - WVFAIL bup meta --extract --file ../../testfs/src.meta 2>&1 \ + WVPASS bup meta --create --recurse --file "$testfs"/src.meta \ + "$testfs"/src + WVPASS force-delete "$testfs_limited"/src-restore + WVPASS mkdir "$testfs_limited"/src-restore + WVPASS cd "$testfs_limited"/src-restore + WVFAIL bup meta --extract --file "$testfs"/src.meta 2>&1 \ | WVPASS grep -e '^POSIX1e ACL applyto:' \ - | WVPASS python -c \ + | WVPASS bup-cfg-py -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 2)' ) || exit $? + + WVPASS umount "$testfs" + WVPASS umount "$testfs_limited" + WVPASS rm -r "$testfs" "$testfs_limited" + + WVPASS rm -r "$tmpdir" + ) || exit $? fi + +WVPASS rm -r "$tmpdir"