X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=t%2Ftest-meta.sh;h=f25106560acce071ac54456b23d9a856af297b64;hb=6b6559e405d264d4127211b935b21a3dda93ad93;hp=573ad8c4083ea1a1fcee4668e2803ead9346868d;hpb=c3d6142a1b79e74feb5668ed2099d765b55dea68;p=bup.git diff --git a/t/test-meta.sh b/t/test-meta.sh index 573ad8c..f251065 100755 --- a/t/test-meta.sh +++ b/t/test-meta.sh @@ -100,7 +100,7 @@ test-src-save-restore() setup-test-tree() { - WVPASS make PREFIX="$tmpdir"/src install + WVPASS "$TOP/t/sync-tree" "$TOP/t/sampledata/" "$tmpdir/src/" # Add some hard links for the general tests. ( @@ -158,21 +158,24 @@ WVSTART 'metadata save/restore (general)' # 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 -d src/bin - WVPASS test -f src/bin/bup + 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 + 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 @@ -214,7 +217,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. @@ -417,13 +420,13 @@ WVSTART 'meta --no-recurse' 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 $? @@ -435,10 +438,11 @@ src/foo/3" tmpdir="$(WVPASS wvmktempdir)" || exit $? - 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 $? + # FIXME: binary groups + first_group="$(WVPASS bup-python -c 'import os,grp; \ + print(grp.getgrgid(os.getgroups()[0])[0])')" || exit $? + last_group="$(bup-python -c 'import os,grp; \ + 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 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). @@ -716,7 +719,7 @@ if [ "$root_status" = root ]; then 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-python -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 3)' ) || exit $? ) || exit $? @@ -739,8 +742,8 @@ 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 python -c \ + | WVPASS grep -e "^xattr\.set u\?'" \ + | WVPASS bup-python -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 2)' ) || exit $? @@ -762,7 +765,7 @@ if [ "$root_status" = root ]; then 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-python -c \ 'import sys; exit(not len(sys.stdin.readlines()) == 2)' ) || exit $?