From 88f7fbebef60f0d8e5ebae8579cd249be6331ea3 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 27 May 2020 19:58:38 +0200 Subject: [PATCH] tests: move all tests to test/ Instead of having some testing code interleaved with bup's real code in lib/bup/test/ and lib/bup/t/ move everything related to testing into test/, which is also renamed from just t/. This aligns with pytest for future changes, and, almost more importantly, cleans up the lib/ directory to only have the operational code. The latter is necessary to properly 'libify' bup in order to be able to use tox properly to test with different versions of python in venv later. Signed-off-by: Johannes Berg Reviewed-by: Rob Browning [rlb@defaultvalue.org: also move utilities like compare-trees to dev/; make test/lib a test-specific module tree and have wvtest.py include it; use test/ext/ and test/int/ (external and internal) as the test dir names.] Signed-off-by: Rob Browning Tested-by: Rob Browning --- .gitignore | 4 +- Documentation/bup-gc.md | 2 +- Documentation/bup-get.md | 2 +- Documentation/bup-prune-older.md | 2 +- HACKING | 12 +- Makefile | 169 +++++++++--------- README.md | 8 +- {t => dev}/cleanup-mounts-under | 0 {t => dev}/compare-trees | 0 {t => dev}/configure-sampledata | 10 +- {t => dev}/data-size | 0 {t => dev}/echo-argv-bytes | 2 +- {t => dev}/force-delete | 0 {t => dev}/git-cat-tree | 0 {t => dev}/hardlink-sets | 4 +- {t => dev}/id-other-than | 0 {t => dev}/lib.sh | 13 +- {t => dev}/make-random-paths | 5 +- {t => dev}/mksock | 0 {t => dev}/ns-timestamp-resolutions | 2 +- {t => dev}/perf-glance | 4 +- {t => dev}/root-status | 0 {t => dev}/sparse-test-data | 4 +- {t => dev}/subtree-hash | 4 +- {t => dev}/sync-tree | 0 {t => dev}/unknown-owner | 0 t/bin/sort-z | 1 - t/test-ls-remote | 3 - {lib/bup/test => test}/__init__.py | 0 test/ext/bin/sort-z | 1 + {t => test/ext}/test-argv | 6 +- {t => test/ext}/test-cat-file.sh | 2 +- .../ext}/test-command-without-init-fails.sh | 0 {t => test/ext}/test-compression.sh | 2 +- {t => test/ext}/test-drecurse.sh | 2 +- {t => test/ext}/test-fsck.sh | 2 +- {t => test/ext}/test-ftp | 7 +- {t => test/ext}/test-fuse.sh | 4 +- {t => test/ext}/test-gc.sh | 4 +- {t => test/ext}/test-get | 12 +- {t => test/ext}/test-help | 0 {t => test/ext}/test-import-duplicity.sh | 6 +- {t => test/ext}/test-import-rdiff-backup.sh | 0 {t => test/ext}/test-index-check-device.sh | 4 +- {t => test/ext}/test-index-clear.sh | 0 {t => test/ext}/test-index.sh | 2 +- {t => test/ext}/test-list-idx.sh | 2 +- {t => test/ext}/test-ls | 4 +- test/ext/test-ls-remote | 3 + {t => test/ext}/test-main.sh | 2 +- {t => test/ext}/test-meta.sh | 36 ++-- {t => test/ext}/test-on.sh | 4 +- {t => test/ext}/test-packsizelimit | 2 +- {t => test/ext}/test-prune-older | 7 +- {t => test/ext}/test-redundant-saves.sh | 8 +- {t => test/ext}/test-release-archive.sh | 2 +- {t => test/ext}/test-restore-map-owner.sh | 8 +- {t => test/ext}/test-restore-single-file.sh | 2 +- .../ext}/test-rm-between-index-and-save.sh | 0 {t => test/ext}/test-rm.sh | 20 +-- .../ext}/test-save-creates-no-unrefs.sh | 0 {t => test/ext}/test-save-errors | 2 +- {t => test/ext}/test-save-restore | 10 +- {t => test/ext}/test-save-restore-excludes.sh | 2 +- {t => test/ext}/test-save-smaller | 2 +- {t => test/ext}/test-save-strip-graft.sh | 4 +- .../ext}/test-save-with-valid-parent.sh | 8 +- {t => test/ext}/test-sparse-files.sh | 26 +-- {t => test/ext}/test-split-join.sh | 30 ++-- {t => test/ext}/test-tz.sh | 0 {t => test/ext}/test-web.sh | 2 +- {t => test/ext}/test-xdev.sh | 4 +- {t => test/ext}/test.sh | 4 +- {lib/bup/t => test/int}/__init__.py | 0 {lib/bup/t => test/int}/tbloom.py | 0 {lib/bup/t => test/int}/tclient.py | 0 {lib/bup/t => test/int}/tcompat.py | 0 {lib/bup/t => test/int}/tgit.py | 0 {lib/bup/t => test/int}/thashsplit.py | 0 {lib/bup/t => test/int}/thelpers.py | 7 +- {lib/bup/t => test/int}/tindex.py | 2 +- {lib/bup/t => test/int}/tmetadata.py | 3 +- {lib/bup/t => test/int}/toptions.py | 0 {lib/bup/t => test/int}/tresolve.py | 2 +- {lib/bup/t => test/int}/tshquote.py | 0 {lib/bup/t => test/int}/tvfs.py | 5 +- {lib/bup/t => test/int}/tvint.py | 0 {lib/bup/t => test/int}/txstat.py | 0 buptest.py => test/lib/buptest/__init__.py | 2 +- {lib/bup/test => test/lib/buptest}/vfs.py | 0 {t => test}/sampledata/b2/foozy | 0 {t => test}/sampledata/b2/foozy2 | 0 {t => test}/sampledata/x | 0 {t => test}/sampledata/y-2000 | 0 {t => test}/sampledata/y/testfile1 | 0 {t => test}/sampledata/y/text | 0 {t => test}/testfile1 | 0 {t => test}/testfile2 | 0 wvtest-bup.sh | 8 +- wvtest.py | 2 + 100 files changed, 263 insertions(+), 267 deletions(-) rename {t => dev}/cleanup-mounts-under (100%) rename {t => dev}/compare-trees (100%) rename {t => dev}/configure-sampledata (84%) rename {t => dev}/data-size (100%) rename {t => dev}/echo-argv-bytes (91%) rename {t => dev}/force-delete (100%) rename {t => dev}/git-cat-tree (100%) rename {t => dev}/hardlink-sets (92%) rename {t => dev}/id-other-than (100%) rename {t => dev}/lib.sh (70%) rename {t => dev}/make-random-paths (86%) rename {t => dev}/mksock (100%) rename {t => dev}/ns-timestamp-resolutions (95%) rename {t => dev}/perf-glance (92%) rename {t => dev}/root-status (100%) rename {t => dev}/sparse-test-data (95%) rename {t => dev}/subtree-hash (90%) rename {t => dev}/sync-tree (100%) rename {t => dev}/unknown-owner (100%) delete mode 120000 t/bin/sort-z delete mode 100755 t/test-ls-remote rename {lib/bup/test => test}/__init__.py (100%) create mode 120000 test/ext/bin/sort-z rename {t => test/ext}/test-argv (74%) rename {t => test/ext}/test-cat-file.sh (95%) rename {t => test/ext}/test-command-without-init-fails.sh (100%) rename {t => test/ext}/test-compression.sh (98%) rename {t => test/ext}/test-drecurse.sh (98%) rename {t => test/ext}/test-fsck.sh (95%) rename {t => test/ext}/test-ftp (96%) rename {t => test/ext}/test-fuse.sh (97%) rename {t => test/ext}/test-gc.sh (98%) rename {t => test/ext}/test-get (99%) rename {t => test/ext}/test-help (100%) rename {t => test/ext}/test-import-duplicity.sh (87%) rename {t => test/ext}/test-import-rdiff-backup.sh (100%) rename {t => test/ext}/test-index-check-device.sh (97%) rename {t => test/ext}/test-index-clear.sh (100%) rename {t => test/ext}/test-index.sh (99%) rename {t => test/ext}/test-list-idx.sh (96%) rename {t => test/ext}/test-ls (99%) create mode 100755 test/ext/test-ls-remote rename {t => test/ext}/test-main.sh (91%) rename {t => test/ext}/test-meta.sh (96%) rename {t => test/ext}/test-on.sh (95%) rename {t => test/ext}/test-packsizelimit (96%) rename {t => test/ext}/test-prune-older (97%) rename {t => test/ext}/test-redundant-saves.sh (82%) rename {t => test/ext}/test-release-archive.sh (97%) rename {t => test/ext}/test-restore-map-owner.sh (94%) rename {t => test/ext}/test-restore-single-file.sh (89%) rename {t => test/ext}/test-rm-between-index-and-save.sh (100%) rename {t => test/ext}/test-rm.sh (94%) rename {t => test/ext}/test-save-creates-no-unrefs.sh (100%) rename {t => test/ext}/test-save-errors (99%) rename {t => test/ext}/test-save-restore (93%) rename {t => test/ext}/test-save-restore-excludes.sh (99%) rename {t => test/ext}/test-save-smaller (99%) rename {t => test/ext}/test-save-strip-graft.sh (98%) rename {t => test/ext}/test-save-with-valid-parent.sh (80%) rename {t => test/ext}/test-sparse-files.sh (88%) rename {t => test/ext}/test-split-join.sh (75%) rename {t => test/ext}/test-tz.sh (100%) rename {t => test/ext}/test-web.sh (98%) rename {t => test/ext}/test-xdev.sh (97%) rename {t => test/ext}/test.sh (97%) rename {lib/bup/t => test/int}/__init__.py (100%) rename {lib/bup/t => test/int}/tbloom.py (100%) rename {lib/bup/t => test/int}/tclient.py (100%) rename {lib/bup/t => test/int}/tcompat.py (100%) rename {lib/bup/t => test/int}/tgit.py (100%) rename {lib/bup/t => test/int}/thashsplit.py (100%) rename {lib/bup/t => test/int}/thelpers.py (98%) rename {lib/bup/t => test/int}/tindex.py (99%) rename {lib/bup/t => test/int}/tmetadata.py (99%) rename {lib/bup/t => test/int}/toptions.py (100%) rename {lib/bup/t => test/int}/tresolve.py (99%) rename {lib/bup/t => test/int}/tshquote.py (100%) rename {lib/bup/t => test/int}/tvfs.py (99%) rename {lib/bup/t => test/int}/tvint.py (100%) rename {lib/bup/t => test/int}/txstat.py (100%) rename buptest.py => test/lib/buptest/__init__.py (98%) rename {lib/bup/test => test/lib/buptest}/vfs.py (100%) rename {t => test}/sampledata/b2/foozy (100%) rename {t => test}/sampledata/b2/foozy2 (100%) rename {t => test}/sampledata/x (100%) rename {t => test}/sampledata/y-2000 (100%) rename {t => test}/sampledata/y/testfile1 (100%) rename {t => test}/sampledata/y/text (100%) rename {t => test}/testfile1 (100%) rename {t => test}/testfile2 (100%) diff --git a/.gitignore b/.gitignore index b632252..bda8de8 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,5 @@ memtest *.swp nbproject /lib/cmd/bup-* -/t/sampledata/var/ -/t/tmp/ +/test/sampledata/var/ +/test/tmp/ diff --git a/Documentation/bup-gc.md b/Documentation/bup-gc.md index fd21705..64120e8 100644 --- a/Documentation/bup-gc.md +++ b/Documentation/bup-gc.md @@ -30,7 +30,7 @@ WARNING: This is one of the few bup commands that modifies your archive in intentionally destructive ways. Though if an attempt to `join` or `restore` the data you still care about after a `gc` succeeds, that's a fairly encouraging sign that the commands worked -correctly. (The `t/compare-trees` command in the source tree can be +correctly. (The `dev/compare-trees` command in the source tree can be used to help test before/after results.) # OPTIONS diff --git a/Documentation/bup-get.md b/Documentation/bup-get.md index 94cb4f3..dcc2bd9 100644 --- a/Documentation/bup-get.md +++ b/Documentation/bup-get.md @@ -60,7 +60,7 @@ WARNING: This is one of the few bup commands that can modify your archives in intentionally destructive ways. Though if an attempt to join or restore the data you still care about succeeds after you've run this command, then that's a fairly encouraging sign that it worked -correctly. (The t/compare-trees command in the source tree can be +correctly. (The dev/compare-trees command in the source tree can be used to help test before/after results.) # METHODS diff --git a/Documentation/bup-prune-older.md b/Documentation/bup-prune-older.md index efb57a2..24e2eea 100644 --- a/Documentation/bup-prune-older.md +++ b/Documentation/bup-prune-older.md @@ -21,7 +21,7 @@ WARNING: This is one of the few bup commands that modifies your archive in intentionally destructive ways. Though if an attempt to `join` or `restore` the data you still care about after a `prune-older` succeeds, that's a fairly encouraging sign that the -commands worked correctly. (The `t/compare-trees` command in the +commands worked correctly. (The `dev/compare-trees` command in the source tree can be used to help test before/after results.) # KEEP PERIODS diff --git a/HACKING b/HACKING index 6aafd76..773f187 100644 --- a/HACKING +++ b/HACKING @@ -66,13 +66,17 @@ output (interleaved parallel test output), and inaccurate intermediate success/failure counts, but the final counts displayed should be correct. -Individual non-Python tests can be run via "./wvtest run t/TEST" and +Individual non-Python tests can be run via "./wvtest run test/TEST" and if you'd like to see all of the test output, you can omit the wvtest -run wrapper: "t/TEST" +run wrapper: "test/TEST" Individual Python tests can be run via "./wvtest run ./wvtest.py -lib/bup/t/TEST", and as above, you can see all the output by omitting -the wvtest run wrapper like this: "./wvtest.py lib/bup/t/TEST" +test/int/TEST", and as above, you can see all the output by omitting +the wvtest run wrapper like this: "./wvtest.py test/TEST" + +Internal tests that test bup's code directly are located in test/int, +and external tests that test bup from the outside, typically by +running the executable, are located in test/ext. Submitting patches diff --git a/Makefile b/Makefile index 51afd1a..3c6d522 100644 --- a/Makefile +++ b/Makefile @@ -19,11 +19,11 @@ define shout $(if $(subst ok,,$(lastword $(1))),$(error $(2)),$(shell x="$(1)"; echo $${x%???})) endef -sampledata_rev := $(shell t/configure-sampledata --revision $(isok)) +sampledata_rev := $(shell dev/configure-sampledata --revision $(isok)) sampledata_rev := \ $(call shout,$(sampledata_rev),Could not parse sampledata revision) -current_sampledata := t/sampledata/var/rev/v$(sampledata_rev) +current_sampledata := test/sampledata/var/rev/v$(sampledata_rev) os := $(shell ($(pf); uname | sed 's/[-_].*//') $(isok)) os := $(call shout,$(os),Unable to determine OS) @@ -40,7 +40,7 @@ endif ifdef TMPDIR test_tmp := $(TMPDIR) else - test_tmp := $(CURDIR)/t/tmp + test_tmp := $(CURDIR)/test/tmp endif initial_setup := $(shell dev/update-checkout-info lib/bup/checkout_info.py $(isok)) @@ -82,7 +82,7 @@ bup_deps := lib/bup/_helpers$(SOEXT) $(bup_cmds) all: $(bup_deps) Documentation/all $(current_sampledata) $(current_sampledata): - t/configure-sampledata --setup + dev/configure-sampledata --setup PANDOC ?= $(shell type -p pandoc) @@ -156,81 +156,82 @@ lib/bup/_helpers$(SOEXT): \ "import glob; assert(len(glob.glob('lib/bup/build/*/_helpers*$(SOEXT)')) == 1)" cp lib/bup/build/*/_helpers*$(SOEXT) "$@" -t/tmp: - mkdir t/tmp +test/tmp: + mkdir test/tmp runtests: runtests-python runtests-cmdline python_tests := \ - lib/bup/t/tbloom.py \ - lib/bup/t/tclient.py \ - lib/bup/t/tcompat.py \ - lib/bup/t/tgit.py \ - lib/bup/t/thashsplit.py \ - lib/bup/t/thelpers.py \ - lib/bup/t/tindex.py \ - lib/bup/t/tmetadata.py \ - lib/bup/t/toptions.py \ - lib/bup/t/tresolve.py \ - lib/bup/t/tshquote.py \ - lib/bup/t/tvfs.py \ - lib/bup/t/tvint.py \ - lib/bup/t/txstat.py + test/int/tbloom.py \ + test/int/tclient.py \ + test/int/tcompat.py \ + test/int/tgit.py \ + test/int/thashsplit.py \ + test/int/thelpers.py \ + test/int/tindex.py \ + test/int/tmetadata.py \ + test/int/toptions.py \ + test/int/tresolve.py \ + test/int/tshquote.py \ + test/int/tvfs.py \ + test/int/tvint.py \ + test/int/txstat.py + # The "pwd -P" here may not be appropriate in the long run, but we # need it until we settle the relevant drecurse/exclusion questions: # https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0 -runtests-python: all t/tmp - mkdir -p t/tmp/test-log +runtests-python: all test/tmp + mkdir -p test/tmp/test-log $(pf); cd $$(pwd -P); TMPDIR="$(test_tmp)" \ ./wvtest.py $(python_tests) 2>&1 \ - | tee -a t/tmp/test-log/$$$$.log + | tee -a test/tmp/test-log/$$$$.log cmdline_tests := \ - t/test-help \ - t/test.sh \ - t/test-argv \ - t/test-cat-file.sh \ - t/test-command-without-init-fails.sh \ - t/test-compression.sh \ - t/test-drecurse.sh \ - t/test-fsck.sh \ - t/test-fuse.sh \ - t/test-ftp \ - t/test-web.sh \ - t/test-gc.sh \ - t/test-import-duplicity.sh \ - t/test-import-rdiff-backup.sh \ - t/test-index.sh \ - t/test-index-check-device.sh \ - t/test-index-clear.sh \ - t/test-list-idx.sh \ - t/test-ls \ - t/test-ls-remote \ - t/test-main.sh \ - t/test-meta.sh \ - t/test-on.sh \ - t/test-packsizelimit \ - t/test-prune-older \ - t/test-redundant-saves.sh \ - t/test-restore-map-owner.sh \ - t/test-restore-single-file.sh \ - t/test-rm.sh \ - t/test-rm-between-index-and-save.sh \ - t/test-save-creates-no-unrefs.sh \ - t/test-save-restore \ - t/test-save-errors \ - t/test-save-restore-excludes.sh \ - t/test-save-strip-graft.sh \ - t/test-save-with-valid-parent.sh \ - t/test-sparse-files.sh \ - t/test-split-join.sh \ - t/test-tz.sh \ - t/test-xdev.sh - -tmp-target-run-test-get-%: all t/tmp + test/ext/test.sh \ + test/ext/test-argv \ + test/ext/test-cat-file.sh \ + test/ext/test-command-without-init-fails.sh \ + test/ext/test-compression.sh \ + test/ext/test-drecurse.sh \ + test/ext/test-fsck.sh \ + test/ext/test-fuse.sh \ + test/ext/test-ftp \ + test/ext/test-help \ + test/ext/test-web.sh \ + test/ext/test-gc.sh \ + test/ext/test-import-duplicity.sh \ + test/ext/test-import-rdiff-backup.sh \ + test/ext/test-index.sh \ + test/ext/test-index-check-device.sh \ + test/ext/test-index-clear.sh \ + test/ext/test-list-idx.sh \ + test/ext/test-ls \ + test/ext/test-ls-remote \ + test/ext/test-main.sh \ + test/ext/test-meta.sh \ + test/ext/test-on.sh \ + test/ext/test-packsizelimit \ + test/ext/test-prune-older \ + test/ext/test-redundant-saves.sh \ + test/ext/test-restore-map-owner.sh \ + test/ext/test-restore-single-file.sh \ + test/ext/test-rm.sh \ + test/ext/test-rm-between-index-and-save.sh \ + test/ext/test-save-creates-no-unrefs.sh \ + test/ext/test-save-restore \ + test/ext/test-save-errors \ + test/ext/test-save-restore-excludes.sh \ + test/ext/test-save-strip-graft.sh \ + test/ext/test-save-with-valid-parent.sh \ + test/ext/test-sparse-files.sh \ + test/ext/test-split-join.sh \ + test/ext/test-tz.sh \ + test/ext/test-xdev.sh + +tmp-target-run-test-get-%: all test/tmp $(pf); cd $$(pwd -P); TMPDIR="$(test_tmp)" \ - t/test-get $* 2>&1 | tee -a t/tmp/test-log/$$$$.log + test/ext/test-get $* 2>&1 | tee -a test/tmp/test-log/$$$$.log test_get_targets += \ tmp-target-run-test-get-replace \ @@ -245,26 +246,26 @@ test_get_targets += \ # The "pwd -P" here may not be appropriate in the long run, but we # need it until we settle the relevant drecurse/exclusion questions: # https://groups.google.com/forum/#!topic/bup-list/9ke-Mbp10Q0 -tmp-target-run-test%: all t/tmp +tmp-target-run-test%: all test/tmp $(pf); cd $$(pwd -P); TMPDIR="$(test_tmp)" \ - t/test$* 2>&1 | tee -a t/tmp/test-log/$$$$.log + test/ext/test$* 2>&1 | tee -a test/tmp/test-log/$$$$.log -runtests-cmdline: $(test_get_targets) $(subst t/test,tmp-target-run-test,$(cmdline_tests)) +runtests-cmdline: $(test_get_targets) $(subst test/ext/test,tmp-target-run-test,$(cmdline_tests)) stupid: PATH=/bin:/usr/bin $(MAKE) test test: all - if test -e t/tmp/test-log; then rm -r t/tmp/test-log; fi - mkdir -p t/tmp/test-log + if test -e test/tmp/test-log; then rm -r test/tmp/test-log; fi + mkdir -p test/tmp/test-log ./wvtest watch --no-counts \ - $(MAKE) runtests 2>t/tmp/test-log/$$$$.log - ./wvtest report t/tmp/test-log/*.log + $(MAKE) runtests 2>test/tmp/test-log/$$$$.log + ./wvtest report test/tmp/test-log/*.log check: test distcheck: all - ./wvtest run t/test-release-archive.sh + ./wvtest run test/ext/test-release-archive.sh long-test: export BUP_TEST_LEVEL=11 long-test: test @@ -330,18 +331,18 @@ clean: Documentation/clean config/bin/python *.pyc */*.pyc lib/*/*.pyc lib/*/*/*.pyc \ lib/bup/checkout_info.py \ randomgen memtest \ - testfs.img lib/bup/t/testfs.img + testfs.img test/int/testfs.img for x in $$(ls cmd/*-cmd.py cmd/*-cmd.sh | grep -vF python-cmd.sh | cut -b 5-); do \ echo "cmd/bup-$${x%-cmd.*}"; \ done | xargs -t rm -f - if test -e t/mnt; then t/cleanup-mounts-under t/mnt; fi - if test -e t/mnt; then rm -r t/mnt; fi - if test -e t/tmp; then t/cleanup-mounts-under t/tmp; fi - # FIXME: migrate these to t/mnt/ - if test -e lib/bup/t/testfs; \ - then umount lib/bup/t/testfs || true; fi - rm -rf *.tmp *.tmp.meta t/*.tmp lib/*/*/*.tmp build lib/bup/build lib/bup/t/testfs - if test -e t/tmp; then t/force-delete t/tmp; fi - t/configure-sampledata --clean + if test -e test/mnt; then dev/cleanup-mounts-under test/mnt; fi + if test -e test/mnt; then rm -r test/mnt; fi + if test -e test/tmp; then dev/cleanup-mounts-under test/tmp; fi + # FIXME: migrate these to test/mnt/ + if test -e test/int/testfs; \ + then umount test/int/testfs || true; fi + rm -rf *.tmp *.tmp.meta test/*.tmp lib/*/*/*.tmp build lib/bup/build test/int/testfs + if test -e test/tmp; then dev/force-delete test/tmp; fi + dev/configure-sampledata --clean # Remove last so that cleanup tools can depend on it rm -rf config/bin diff --git a/README.md b/README.md index 5c2f28e..07ad1ec 100644 --- a/README.md +++ b/README.md @@ -453,16 +453,16 @@ Notes on NetBSD/pkgsrc cycle and error out, so "ls -R" and "find" will not work. - There is no support for ACLs. If/when some enterprising person - fixes this, adjust t/compare-trees. + fixes this, adjust dev/compare-trees. Notes on Cygwin --------------- - There is no support for ACLs. If/when some enterprising person - fixes this, adjust t/compare-trees. + fixes this, adjust dev/compare-trees. - - In t/test.sh, two tests have been disabled. These tests check to + - In test/ext/test.sh, two tests have been disabled. These tests check to see that repeated saves produce identical trees and that an intervening index doesn't change the SHA1. Apparently Cygwin has some unusual behaviors with respect to access times (that probably @@ -474,7 +474,7 @@ Notes on OS X ------------- - There is no support for ACLs. If/when some enterprising person - fixes this, adjust t/compare-trees. + fixes this, adjust dev/compare-trees. How it works diff --git a/t/cleanup-mounts-under b/dev/cleanup-mounts-under similarity index 100% rename from t/cleanup-mounts-under rename to dev/cleanup-mounts-under diff --git a/t/compare-trees b/dev/compare-trees similarity index 100% rename from t/compare-trees rename to dev/compare-trees diff --git a/t/configure-sampledata b/dev/configure-sampledata similarity index 84% rename from t/configure-sampledata rename to dev/configure-sampledata index 111c7c3..c24a79c 100755 --- a/t/configure-sampledata +++ b/dev/configure-sampledata @@ -11,7 +11,7 @@ top="$(pwd)" || exit $? usage() { - echo 'Usage: t/configure-sampledata [--setup | --clean | --revision]' + echo 'Usage: dev/configure-sampledata [--setup | --clean | --revision]' } if test "$#" -ne 1; then @@ -28,7 +28,7 @@ rm_symlinks() clean() ( - cd t/sampledata || exit $? + cd test/sampledata || exit $? if test -e var; then rm -r var || exit $?; fi # Remove legacy content (before everything moved to var/). rm_symlinks abs-symlink b c etc @@ -38,8 +38,8 @@ case "$1" in --setup) ( clean - mkdir -p t/sampledata/var/rev || exit $? - cd t/sampledata/var || exit $? + mkdir -p test/sampledata/var/rev || exit $? + cd test/sampledata/var || exit $? ln -sf a b || exit $? ln -sf b c || exit $? ln -sf "$(pwd)/abs-symlink-target" abs-symlink || exit $? @@ -50,7 +50,7 @@ case "$1" in cp -pP "$top"/lib/bup/*.py lib/bup || exit $? mkdir path-zoo || exit $? if test "$BUP_TEST_RANDOMIZED_SAMPLEDATA_PATHS"; then - "$top"/t/make-random-paths 3000 path-zoo || exit $? + "$top"/dev/make-random-paths 3000 path-zoo || exit $? fi # The "v" ensures that if "configure-sampledata # --revision" and/or the setup above fails somehow, diff --git a/t/data-size b/dev/data-size similarity index 100% rename from t/data-size rename to dev/data-size diff --git a/t/echo-argv-bytes b/dev/echo-argv-bytes similarity index 91% rename from t/echo-argv-bytes rename to dev/echo-argv-bytes index 5347b5a..1be7288 100755 --- a/t/echo-argv-bytes +++ b/dev/echo-argv-bytes @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/../config/bin/python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/t/force-delete b/dev/force-delete similarity index 100% rename from t/force-delete rename to dev/force-delete diff --git a/t/git-cat-tree b/dev/git-cat-tree similarity index 100% rename from t/git-cat-tree rename to dev/git-cat-tree diff --git a/t/hardlink-sets b/dev/hardlink-sets similarity index 92% rename from t/hardlink-sets rename to dev/hardlink-sets index 2d17e37..a0329f8 100755 --- a/t/hardlink-sets +++ b/dev/hardlink-sets @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble @@ -16,8 +16,6 @@ exec "$bup_python" "$0" from __future__ import absolute_import, print_function import os, stat, sys -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../lib'] - from bup import compat from bup.io import byte_stream diff --git a/t/id-other-than b/dev/id-other-than similarity index 100% rename from t/id-other-than rename to dev/id-other-than diff --git a/t/lib.sh b/dev/lib.sh similarity index 70% rename from t/lib.sh rename to dev/lib.sh index 3ea7226..20780e2 100644 --- a/t/lib.sh +++ b/dev/lib.sh @@ -1,21 +1,22 @@ # Assumes shell is Bash, and pipefail is set. -bup_t_lib_script_home=$(cd "$(dirname $0)" && pwd) || exit $? +# Assumes this is always loaded while pwd is still the source tree root +bup_dev_lib_top=$(pwd) || exit $? -bup-cfg-py() { "$bup_t_lib_script_home/../config/bin/python" "$@"; } -bup-python() { "$bup_t_lib_script_home/../dev/bup-python" "$@"; } +bup-cfg-py() { "$bup_dev_lib_top/config/bin/python" "$@"; } +bup-python() { "$bup_dev_lib_top/dev/bup-python" "$@"; } force-delete() { - "$bup_t_lib_script_home/force-delete" "$@" + "$bup_dev_lib_top/dev/force-delete" "$@" } resolve-parent() { test "$#" -eq 1 || return $? echo "$1" | \ - PYTHONPATH="$bup_t_lib_script_home/../lib" bup-python -c \ - "import sys, bup.helpers; print(bup.helpers.resolve_parent(sys.stdin.readline()))" \ + bup-python \ + -c "import sys, bup.helpers; print(bup.helpers.resolve_parent(sys.stdin.readline()))" \ || return $? } diff --git a/t/make-random-paths b/dev/make-random-paths similarity index 86% rename from t/make-random-paths rename to dev/make-random-paths index af80643..05d24f4 100755 --- a/t/make-random-paths +++ b/dev/make-random-paths @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")//bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble @@ -12,9 +12,6 @@ from random import randint from sys import argv, exit, stderr, stdout import errno, re, sys -script_home = abspath(dirname(sys.argv[0] or '.')) -sys.path[:0] = [abspath(script_home + '/../lib'), abspath(script_home + '/..')] - from bup.compat import fsencode, range diff --git a/t/mksock b/dev/mksock similarity index 100% rename from t/mksock rename to dev/mksock diff --git a/t/ns-timestamp-resolutions b/dev/ns-timestamp-resolutions similarity index 95% rename from t/ns-timestamp-resolutions rename to dev/ns-timestamp-resolutions index d138749..1938e78 100755 --- a/t/ns-timestamp-resolutions +++ b/dev/ns-timestamp-resolutions @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble diff --git a/t/perf-glance b/dev/perf-glance similarity index 92% rename from t/perf-glance rename to dev/perf-glance index 55ae966..8151f6b 100755 --- a/t/perf-glance +++ b/dev/perf-glance @@ -12,8 +12,8 @@ src_data=("$@") top="$(pwd)" script_name="$(basename $0)" -mkdir -p "$top/t/tmp" -tmpdir="$(mktemp -d "$top/t/tmp/$script_name-XXXXXXX")" +mkdir -p "$top/test/tmp" +tmpdir="$(mktemp -d "$top/test/tmp/$script_name-XXXXXXX")" export BUP_DIR="$tmpdir/bup" diff --git a/t/root-status b/dev/root-status similarity index 100% rename from t/root-status rename to dev/root-status diff --git a/t/sparse-test-data b/dev/sparse-test-data similarity index 95% rename from t/sparse-test-data rename to dev/sparse-test-data index 096d042..002e525 100755 --- a/t/sparse-test-data +++ b/dev/sparse-test-data @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ @@ -9,8 +9,6 @@ from random import randint from sys import stderr, stdout import os, sys -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../lib'] - from bup.io import byte_stream def smaller_region(max_offset): diff --git a/t/subtree-hash b/dev/subtree-hash similarity index 90% rename from t/subtree-hash rename to dev/subtree-hash index 1077393..84f1682 100755 --- a/t/subtree-hash +++ b/dev/subtree-hash @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble @@ -8,8 +8,6 @@ exec "$bup_python" "$0" ${1+"$@"} from __future__ import absolute_import, print_function import os.path, sys -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../lib'] - from bup.compat import argv_bytes from bup.helpers import handle_ctrl_c, readpipe from bup.io import byte_stream diff --git a/t/sync-tree b/dev/sync-tree similarity index 100% rename from t/sync-tree rename to dev/sync-tree diff --git a/t/unknown-owner b/dev/unknown-owner similarity index 100% rename from t/unknown-owner rename to dev/unknown-owner diff --git a/t/bin/sort-z b/t/bin/sort-z deleted file mode 120000 index 36ca24a..0000000 --- a/t/bin/sort-z +++ /dev/null @@ -1 +0,0 @@ -../../dev/sort-z \ No newline at end of file diff --git a/t/test-ls-remote b/t/test-ls-remote deleted file mode 100755 index 8b34caf..0000000 --- a/t/test-ls-remote +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -BUP_TEST_REMOTE_REPO=t t/test-ls diff --git a/lib/bup/test/__init__.py b/test/__init__.py similarity index 100% rename from lib/bup/test/__init__.py rename to test/__init__.py diff --git a/test/ext/bin/sort-z b/test/ext/bin/sort-z new file mode 120000 index 0000000..adde19f --- /dev/null +++ b/test/ext/bin/sort-z @@ -0,0 +1 @@ +../../../dev/sort-z \ No newline at end of file diff --git a/t/test-argv b/test/ext/test-argv similarity index 74% rename from t/test-argv rename to test/ext/test-argv index 818619f..6fc3249 100755 --- a/t/test-argv +++ b/test/ext/test-argv @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../config/bin/python" || exit $? +bup_python="$(dirname "$0")/../../config/bin/python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble @@ -14,7 +14,7 @@ from sys import stderr, stdout import sys script_home = abspath(dirname(__file__)) -sys.path[:0] = [abspath(script_home + '/../lib'), abspath(script_home + '/..')] +sys.path[:0] = [abspath(script_home + '/../../lib'), abspath(script_home + '/../..')] from wvtest import wvcheck, wvfail, wvmsg, wvpass, wvpasseq, wvpassne, wvstart @@ -24,6 +24,6 @@ def rand_bytes(n): return bytes([randint(1, 255) for x in range(n)]) for trial in range(100): - cmd = [b't/echo-argv-bytes', rand_bytes(randint(1, 32))] + cmd = [b'dev/echo-argv-bytes', rand_bytes(randint(1, 32))] out = check_output(cmd) wvpasseq(b'\0\n'.join(cmd) + b'\0\n', out) diff --git a/t/test-cat-file.sh b/test/ext/test-cat-file.sh similarity index 95% rename from t/test-cat-file.sh rename to test/ext/test-cat-file.sh index ec8610c..055ade0 100755 --- a/t/test-cat-file.sh +++ b/test/ext/test-cat-file.sh @@ -36,7 +36,7 @@ src_hash=$(WVPASS bup ls -s "src/latest/$(pwd)" | cut -d' ' -f 1) || exit $? bupm_hash=$(WVPASS git ls-tree "$src_hash" | grep -F .bupm | cut -d' ' -f 3) \ || exit $? bupm_hash=$(WVPASS echo "$bupm_hash" | cut -d' ' -f 1) || exit $? -WVPASS "$top/t/git-cat-tree" "$bupm_hash" > git-cat-bupm +WVPASS "$top/dev/git-cat-tree" "$bupm_hash" > git-cat-bupm if ! cmp git-cat-bupm bup-cat-bupm; then cmp -l git-cat-bupm bup-cat-bupm diff -uN <(bup meta -tvvf git-cat-bupm) <(bup meta -tvvf bup-cat-bupm) diff --git a/t/test-command-without-init-fails.sh b/test/ext/test-command-without-init-fails.sh similarity index 100% rename from t/test-command-without-init-fails.sh rename to test/ext/test-command-without-init-fails.sh diff --git a/t/test-compression.sh b/test/ext/test-compression.sh similarity index 98% rename from t/test-compression.sh rename to test/ext/test-compression.sh index b887f06..7ca49b4 100755 --- a/t/test-compression.sh +++ b/test/ext/test-compression.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-drecurse.sh b/test/ext/test-drecurse.sh similarity index 98% rename from t/test-drecurse.sh rename to test/ext/test-drecurse.sh index f3e2542..1611384 100755 --- a/t/test-drecurse.sh +++ b/test/ext/test-drecurse.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-fsck.sh b/test/ext/test-fsck.sh similarity index 95% rename from t/test-fsck.sh rename to test/ext/test-fsck.sh index 8f5b865..0531814 100755 --- a/t/test-fsck.sh +++ b/test/ext/test-fsck.sh @@ -8,7 +8,7 @@ tmpdir="$(WVPASS wvmktempdir)" || exit $? bup() { "$top/bup" "$@"; } -WVPASS "$top/t/sync-tree" "$top/t/sampledata/" "$tmpdir/src/" +WVPASS "$top/dev/sync-tree" "$top/test/sampledata/" "$tmpdir/src/" export BUP_DIR="$tmpdir/bup" export GIT_DIR="$tmpdir/bup" diff --git a/t/test-ftp b/test/ext/test-ftp similarity index 96% rename from t/test-ftp rename to test/ext/test-ftp index a438241..2ffa301 100755 --- a/t/test-ftp +++ b/test/ext/test-ftp @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/../../dev/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble @@ -13,8 +13,9 @@ from time import localtime, strftime import os, sys # For buptest, wvtest, ... -sys.path[:0] = (abspath(os.path.dirname(__file__) + '/..'),) -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../lib'] +sys.path[:0] = (abspath(os.path.dirname(__file__) + '/../..'),) +sys.path[:0] = (abspath(os.path.dirname(__file__) + '/../../test/lib'),) +sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../../lib'] from buptest import ex, exo, logcmd, test_tempdir from wvtest import wvfail, wvpass, wvpasseq, wvpassne, wvstart diff --git a/t/test-fuse.sh b/test/ext/test-fuse.sh similarity index 97% rename from t/test-fuse.sh rename to test/ext/test-fuse.sh index d219d55..08d7e2e 100755 --- a/t/test-fuse.sh +++ b/test/ext/test-fuse.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE -root_status="$(t/root-status)" || exit $? +root_status="$(dev/root-status)" || exit $? if ! bup-python -c 'import fuse' 2> /dev/null; then WVSTART 'unable to import fuse; skipping test' diff --git a/t/test-gc.sh b/test/ext/test-gc.sh similarity index 98% rename from t/test-gc.sh rename to test/ext/test-gc.sh index 2739ae7..e29370d 100755 --- a/t/test-gc.sh +++ b/test/ext/test-gc.sh @@ -12,8 +12,8 @@ export GIT_DIR="$tmpdir/bup" GC_OPTS=--unsafe bup() { "$top/bup" "$@"; } -compare-trees() { "$top/t/compare-trees" "$@"; } -data-size() { "$top/t/data-size" "$@"; } +compare-trees() { "$top/dev/compare-trees" "$@"; } +data-size() { "$top/dev/data-size" "$@"; } WVPASS cd "$tmpdir" WVPASS bup init diff --git a/t/test-get b/test/ext/test-get similarity index 99% rename from t/test-get rename to test/ext/test-get index 0c849ab..1dad1d4 100755 --- a/t/test-get +++ b/test/ext/test-get @@ -8,7 +8,7 @@ for arg in "$@"; do shift arg_i=$((arg_i + 1)) done -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/../../dev/bup-python" || exit $? exec "$bup_python" "$0" """ # end of bup preamble @@ -22,9 +22,9 @@ from subprocess import PIPE import os, re, sys # For buptest, wvtest, ... -sys.path[:0] = (abspath(os.path.dirname(__file__) + '/..'),) -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../lib'] - +sys.path[:0] = (abspath(os.path.dirname(__file__) + '/../..'),) +sys.path[:0] = (abspath(os.path.dirname(__file__) + '/../../test/lib'),) +sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../../lib'] from bup import compat, path from bup.compat import environ, getcwd, items @@ -62,7 +62,7 @@ def rmrf(path): def verify_trees_match(path1, path2): global top - exr = exo((top + b'/t/compare-trees', b'-c', path1, path2), check=False) + exr = exo((top + b'/dev/compare-trees', b'-c', path1, path2), check=False) stdout.write(exr.out) sys.stdout.flush() wvcheck(exr.rc == 0, 'process exit %d == 0' % exr.rc) @@ -92,7 +92,7 @@ def validate_blob(src_id, dest_id): global top rmrf(b'restore-src') rmrf(b'restore-dest') - cat_tree = top + b'/t/git-cat-tree' + cat_tree = top + b'/dev/git-cat-tree' src_blob = verify_rcz((cat_tree, b'--git-dir', b'get-src', src_id)).out dest_blob = verify_rcz((cat_tree, b'--git-dir', b'get-src', src_id)).out wvpasseq(src_blob, dest_blob) diff --git a/t/test-help b/test/ext/test-help similarity index 100% rename from t/test-help rename to test/ext/test-help diff --git a/t/test-import-duplicity.sh b/test/ext/test-import-duplicity.sh similarity index 87% rename from t/test-import-duplicity.sh rename to test/ext/test-import-duplicity.sh index 593e565..9374f9a 100755 --- a/t/test-import-duplicity.sh +++ b/test/ext/test-import-duplicity.sh @@ -16,7 +16,7 @@ bup() { "$top/bup" "$@"; } dup() { duplicity --archive-dir "$tmpdir/dup-cache" "$@"; } WVSTART "import-duplicity" -WVPASS "$top/t/sync-tree" "$top/t/sampledata/" "$tmpdir/src/" +WVPASS "$top/dev/sync-tree" "$top/test/sampledata/" "$tmpdir/src/" export BUP_DIR="$tmpdir/bup" export GIT_DIR="$tmpdir/bup" @@ -33,13 +33,13 @@ WVPASS bup import-duplicity "file://duplicity" import-duplicity WVPASSEQ $(bup ls import-duplicity/ | wc -l) 3 WVPASSEQ "$(bup ls import-duplicity/latest/ | sort)" "$(ls src | sort)" WVPASS bup restore -C restore/ import-duplicity/latest/ -WVFAIL "$top/t/compare-trees" src/ restore/ > tmp-compare-trees +WVFAIL "$top/dev/compare-trees" src/ restore/ > tmp-compare-trees WVPASSEQ $(cat tmp-compare-trees | wc -l) 4 # Note: OS X rsync itemize output is currently only 9 chars, not 11. # FreeBSD may output 12 chars instead - accept 9-12 # Expect something like this (without the leading spaces): # .d..t...... ./ -# .L..t...... abs-symlink -> /home/foo/bup/t/sampledata/var/abs-symlink-target +# .L..t...... abs-symlink -> /home/foo/bup/test/sampledata/var/abs-symlink-target # .L..t...... b -> a # .L..t...... c -> b expected_diff_rx='^\.d\.\.t\.{4,7} \./$|^\.L\.\.t\.{4,7} ' diff --git a/t/test-import-rdiff-backup.sh b/test/ext/test-import-rdiff-backup.sh similarity index 100% rename from t/test-import-rdiff-backup.sh rename to test/ext/test-import-rdiff-backup.sh diff --git a/t/test-index-check-device.sh b/test/ext/test-index-check-device.sh similarity index 97% rename from t/test-index-check-device.sh rename to test/ext/test-index-check-device.sh index 88a966a..1326df1 100755 --- a/t/test-index-check-device.sh +++ b/test/ext/test-index-check-device.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. ./t/lib.sh || exit $? +. ./dev/lib.sh || exit $? set -o pipefail -root_status="$(t/root-status)" || exit $? +root_status="$(dev/root-status)" || exit $? if [ "$root_status" != root ]; then echo 'Not root: skipping --check-device tests.' diff --git a/t/test-index-clear.sh b/test/ext/test-index-clear.sh similarity index 100% rename from t/test-index-clear.sh rename to test/ext/test-index-clear.sh diff --git a/t/test-index.sh b/test/ext/test-index.sh similarity index 99% rename from t/test-index.sh rename to test/ext/test-index.sh index f714f73..6504f9c 100755 --- a/t/test-index.sh +++ b/test/ext/test-index.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash . wvtest.sh . wvtest-bup.sh -. t/lib.sh +. dev/lib.sh set -o pipefail diff --git a/t/test-list-idx.sh b/test/ext/test-list-idx.sh similarity index 96% rename from t/test-list-idx.sh rename to test/ext/test-list-idx.sh index 276416f..ad72ab4 100755 --- a/t/test-list-idx.sh +++ b/test/ext/test-list-idx.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-ls b/test/ext/test-ls similarity index 99% rename from t/test-ls rename to test/ext/test-ls index 23e15d7..8a93c39 100755 --- a/t/test-ls +++ b/test/ext/test-ls @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail @@ -35,7 +35,7 @@ WVPASS cd "$tmpdir" WVPASS mkdir src WVPASS touch src/.dotfile src/executable WVPASS mkfifo src/fifo -WVPASS "$top"/t/mksock src/socket +WVPASS "$top"/dev/mksock src/socket WVPASS bup random 1k > src/file WVPASS chmod u+x src/executable WVPASS chmod -R u=rwX,g-rwx,o-rwx . diff --git a/test/ext/test-ls-remote b/test/ext/test-ls-remote new file mode 100755 index 0000000..1c59c53 --- /dev/null +++ b/test/ext/test-ls-remote @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +BUP_TEST_REMOTE_REPO=t test/ext/test-ls diff --git a/t/test-main.sh b/test/ext/test-main.sh similarity index 91% rename from t/test-main.sh rename to test/ext/test-main.sh index 81c536b..60700ec 100755 --- a/t/test-main.sh +++ b/test/ext/test-main.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-meta.sh b/test/ext/test-meta.sh similarity index 96% rename from t/test-meta.sh rename to test/ext/test-meta.sh index d705c64..b5b8568 100755 --- a/t/test-meta.sh +++ b/test/ext/test-meta.sh @@ -1,18 +1,18 @@ #!/usr/bin/env bash . wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail -root_status="$(t/root-status)" || exit $? +root_status="$(dev/root-status)" || exit $? TOP="$(WVPASS pwd)" || exit $? -export PATH="$TOP/t/bin:$PATH" +export PATH="$TOP/test/ext/bin:$PATH" tmpdir="$(WVPASS wvmktempdir)" || exit $? export BUP_DIR="$tmpdir/bup" # Assume that mvmktempdir will always use the same dir. -timestamp_resolutions="$(t/ns-timestamp-resolutions "$tmpdir/canary")" \ +timestamp_resolutions="$(dev/ns-timestamp-resolutions "$tmpdir/canary")" \ || exit $? atime_resolution="$(echo $timestamp_resolutions | WVPASS cut -d' ' -f 1)" \ || exit $? @@ -27,12 +27,12 @@ bup() hardlink-sets() { - "$TOP/t/hardlink-sets" "$@" + "$TOP/dev/hardlink-sets" "$@" } id-other-than() { - "$TOP/t/id-other-than" "$@" + "$TOP/dev/id-other-than" "$@" } # Very simple metadata tests -- create a test tree then check that bup @@ -95,14 +95,14 @@ test-src-save-restore() WVPASS mkdir src-restore WVPASS bup restore -C src-restore "/src/latest$(pwd)/" WVPASS test -d src-restore/src - WVPASS "$TOP/t/compare-trees" -c src/ src-restore/src/ + WVPASS "$TOP/dev/compare-trees" -c src/ src-restore/src/ WVPASS rm -rf src.bup ) } setup-test-tree() { - WVPASS "$TOP/t/sync-tree" "$TOP/t/sampledata/" "$tmpdir/src/" + WVPASS "$TOP/dev/sync-tree" "$TOP/test/sampledata/" "$tmpdir/src/" # Add some hard links for the general tests. ( @@ -127,7 +127,7 @@ setup-test-tree() WVPASS touch -t 201111111111 "$tmpdir"/src/foo WVPASS touch -t 201112121111 "$tmpdir"/src/foo-bar - t/mksock "$tmpdir"/src/test-socket || true + dev/mksock "$tmpdir"/src/test-socket || true } # Use the test tree to check bup meta. @@ -171,7 +171,7 @@ WVSTART 'metadata save/restore (general)' 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/var/ src-restore/ > tmp-compare-trees + WVFAIL $TOP/dev/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 @@ -216,7 +216,7 @@ WVSTART 'metadata save/restore (using index metadata)' WVPASS mkdir src-restore-1 WVPASS bup restore -C src-restore-1 "/src/latest$(pwd)/" WVPASS test -d src-restore-1/src - WVPASS "$TOP/t/compare-trees" -c src/ src-restore-1/src/ + WVPASS "$TOP/dev/compare-trees" -c src/ src-restore-1/src/ WVPASS echo "blarg" > src/volatile/1 WVPASS cp -pP src/volatile/1 src-restore-1/src/volatile/ @@ -231,7 +231,7 @@ WVSTART 'metadata save/restore (using index metadata)' WVPASS mkdir src-restore-2 WVPASS bup restore -C src-restore-2 "/src/latest$(pwd)/" WVPASS test -d src-restore-2/src - WVPASS "$TOP/t/compare-trees" -c src-restore-1/src/ src-restore-2/src/ + WVPASS "$TOP/dev/compare-trees" -c src-restore-1/src/ src-restore-2/src/ WVPASS rm -r "$tmpdir" @@ -271,7 +271,7 @@ WVSTART 'metadata save/restore (hardlinks)' WVPASS bup index src WVPASS bup save -t -n src src WVPASS hardlink-test-run-restore - WVPASS "$TOP/t/compare-trees" -c src/ src-restore/src/ + WVPASS "$TOP/dev/compare-trees" -c src/ src-restore/src/ # Test the case where the hardlink hasn't changed, but the tree # needs to be saved again. i.e. the save-cmd.py "if hashvalid:" @@ -283,7 +283,7 @@ WVSTART 'metadata save/restore (hardlinks)' WVPASS bup index src WVPASS bup save -t -n src src WVPASS hardlink-test-run-restore - WVPASS "$TOP/t/compare-trees" -c src/ src-restore/src/ + WVPASS "$TOP/dev/compare-trees" -c src/ src-restore/src/ # Test hardlink changes between index runs. # @@ -489,7 +489,7 @@ src/foo/3" WVPASSEQ "$current_gidx" "$new_gidx" # Test that restoring an unknown user works. - unknown_user=$("$TOP"/t/unknown-owner --user) || exit $? + unknown_user=$("$TOP"/dev/unknown-owner --user) || exit $? WVPASS rm -rf src current_uidx=$(bup meta -tvvf ../src.meta | grep -ae '^uid:') || exit $? WVPASS bup meta --edit --set-user "$unknown_user" ../src.meta \ @@ -498,7 +498,7 @@ src/foo/3" WVPASSEQ "$current_uidx" "$new_uidx" # Test that restoring an unknown group works. - unknown_group=$("$TOP"/t/unknown-owner --group) || exit $? + unknown_group=$("$TOP"/dev/unknown-owner --group) || exit $? WVPASS rm -rf src current_gidx=$(bup meta -tvvf ../src.meta | grep -ae '^gid:') || exit $? WVPASS bup meta --edit --set-group "$unknown_group" ../src.meta \ @@ -590,7 +590,7 @@ src/foo/3" WVPASSEQ "$new_gidx" "gid: $other_gid" # Test that restoring an unknown user works. - unknown_user=$("$TOP"/t/unknown-owner --user) || exit $? + unknown_user=$("$TOP"/dev/unknown-owner --user) || exit $? WVPASS rm -rf src WVPASS bup meta --edit \ --set-uid "$other_uid" --set-user "$unknown_user" ../src.meta \ @@ -599,7 +599,7 @@ src/foo/3" WVPASSEQ "$new_uidx" "uid: $other_uid" # Test that restoring an unknown group works. - unknown_group=$("$TOP"/t/unknown-owner --group) || exit $? + unknown_group=$("$TOP"/dev/unknown-owner --group) || exit $? WVPASS rm -rf src WVPASS bup meta --edit \ --set-gid "$other_gid" --set-group "$unknown_group" ../src.meta \ diff --git a/t/test-on.sh b/test/ext/test-on.sh similarity index 95% rename from t/test-on.sh rename to test/ext/test-on.sh index 871bf2e..a4384c3 100755 --- a/t/test-on.sh +++ b/test/ext/test-on.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. ./t/lib.sh || exit $? +. ./dev/lib.sh || exit $? set -o pipefail @@ -11,7 +11,7 @@ export BUP_DIR="$tmpdir/bup" export GIT_DIR="$tmpdir/bup" bup() { "$top/bup" "$@"; } -compare-trees() { "$top/t/compare-trees" "$@"; } +compare-trees() { "$top/dev/compare-trees" "$@"; } WVPASS bup init WVPASS cd "$tmpdir" diff --git a/t/test-packsizelimit b/test/ext/test-packsizelimit similarity index 96% rename from t/test-packsizelimit rename to test/ext/test-packsizelimit index 6bd6a00..f76e045 100755 --- a/t/test-packsizelimit +++ b/test/ext/test-packsizelimit @@ -1,6 +1,6 @@ #!/usr/bin/env bash . wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-prune-older b/test/ext/test-prune-older similarity index 97% rename from t/test-prune-older rename to test/ext/test-prune-older index 068ba6f..d42c3fc 100755 --- a/t/test-prune-older +++ b/test/ext/test-prune-older @@ -1,6 +1,6 @@ #!/bin/sh """": # -*-python-*- -bup_python="$(dirname "$0")/../dev/bup-python" || exit $? +bup_python="$(dirname "$0")/../../dev/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble @@ -19,8 +19,9 @@ from time import localtime, strftime, time import os, random, sys # For buptest, wvtest, ... -sys.path[:0] = (abspath(os.path.dirname(__file__) + '/..'),) -sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../lib'] +sys.path[:0] = (abspath(os.path.dirname(__file__) + '/../..'),) +sys.path[:0] = (abspath(os.path.dirname(__file__) + '/../../test/lib'),) +sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/../../lib'] from buptest import ex, exo, test_tempdir from wvtest import wvfail, wvpass, wvpasseq, wvpassne, wvstart diff --git a/t/test-redundant-saves.sh b/test/ext/test-redundant-saves.sh similarity index 82% rename from t/test-redundant-saves.sh rename to test/ext/test-redundant-saves.sh index bdb56ae..e89fbdb 100755 --- a/t/test-redundant-saves.sh +++ b/test/ext/test-redundant-saves.sh @@ -7,7 +7,7 @@ # -t" because that currently pulls the metadata for unindexed parent # directories directly from the filesystem, and the relevant atimes # may change between runs. So instead we extract the roots of the -# indexed trees for comparison via t/subtree-hash. +# indexed trees for comparison via dev/subtree-hash. . ./wvtest-bup.sh || exit $? @@ -39,14 +39,14 @@ indexed_top=(${indexed_top%%/}) unset IFS tree1=$(WVPASS bup save -t "$tmpdir/src") || exit $? -indexed_tree1="$(WVPASS t/subtree-hash "$tree1" "${indexed_top[@]}" src)" \ +indexed_tree1="$(WVPASS dev/subtree-hash "$tree1" "${indexed_top[@]}" src)" \ || exit $? result="$(WVPASS cd "$tmpdir/src"; WVPASS bup index -m)" || exit $? WVPASSEQ "$result" "" tree2=$(WVPASS bup save -t "$tmpdir/src") || exit $? -indexed_tree2="$(WVPASS t/subtree-hash "$tree2" "${indexed_top[@]}" src)" \ +indexed_tree2="$(WVPASS dev/subtree-hash "$tree2" "${indexed_top[@]}" src)" \ || exit $? WVPASSEQ "$indexed_tree1" "$indexed_tree2" @@ -55,7 +55,7 @@ result="$(WVPASS bup index -s / | WVFAIL grep ^D)" || exit $? WVPASSEQ "$result" "" tree3=$(WVPASS bup save -t /) || exit $? -indexed_tree3="$(WVPASS t/subtree-hash "$tree3" "${indexed_top[@]}" src)" || exit $? +indexed_tree3="$(WVPASS dev/subtree-hash "$tree3" "${indexed_top[@]}" src)" || exit $? WVPASSEQ "$indexed_tree1" "$indexed_tree3" WVPASS rm -rf "$tmpdir" diff --git a/t/test-release-archive.sh b/test/ext/test-release-archive.sh similarity index 97% rename from t/test-release-archive.sh rename to test/ext/test-release-archive.sh index 74ce474..4c8c378 100755 --- a/t/test-release-archive.sh +++ b/test/ext/test-release-archive.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-restore-map-owner.sh b/test/ext/test-restore-map-owner.sh similarity index 94% rename from t/test-restore-map-owner.sh rename to test/ext/test-restore-map-owner.sh index 4e67610..348ce3c 100755 --- a/t/test-restore-map-owner.sh +++ b/test/ext/test-restore-map-owner.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? -root_status="$(t/root-status)" || exit $? +root_status="$(dev/root-status)" || exit $? if [ "$root_status" != root ]; then echo 'Not root: skipping restore --map-* tests.' @@ -20,11 +20,11 @@ user=$(WVPASS id -un) || exit $? gid=$(WVPASS id -g) || exit $? group=$(WVPASS id -gn) || exit $? -other_uinfo=$(WVPASS t/id-other-than --user "$user") || exit $? +other_uinfo=$(WVPASS dev/id-other-than --user "$user") || exit $? other_user="${other_uinfo%%:*}" other_uid="${other_uinfo##*:}" -other_ginfo=$(WVPASS t/id-other-than --group "$group" 0) || exit $? +other_ginfo=$(WVPASS dev/id-other-than --group "$group" 0) || exit $? other_group="${other_ginfo%%:*}" other_gid="${other_ginfo##*:}" diff --git a/t/test-restore-single-file.sh b/test/ext/test-restore-single-file.sh similarity index 89% rename from t/test-restore-single-file.sh rename to test/ext/test-restore-single-file.sh index f211ebc..c151327 100755 --- a/t/test-restore-single-file.sh +++ b/test/ext/test-restore-single-file.sh @@ -20,7 +20,7 @@ WVPASS bup save -n foo "$tmpdir/foo" # Make sure the timestamps will differ if metadata isn't being restored. WVPASS bup tick WVPASS bup restore -C "$tmpdir/restore" "foo/latest/$tmpdir/foo/baz" -WVPASS "$top/t/compare-trees" "$tmpdir/foo/baz" "$tmpdir/restore/baz" +WVPASS "$top/dev/compare-trees" "$tmpdir/foo/baz" "$tmpdir/restore/baz" WVPASS rm -rf "$tmpdir" diff --git a/t/test-rm-between-index-and-save.sh b/test/ext/test-rm-between-index-and-save.sh similarity index 100% rename from t/test-rm-between-index-and-save.sh rename to test/ext/test-rm-between-index-and-save.sh diff --git a/t/test-rm.sh b/test/ext/test-rm.sh similarity index 94% rename from t/test-rm.sh rename to test/ext/test-rm.sh index 00a5a85..3aca68d 100755 --- a/t/test-rm.sh +++ b/test/ext/test-rm.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. ./t/lib.sh || exit $? +. ./dev/lib.sh || exit $? top="$(WVPASS pwd)" || exit $? tmpdir="$(WVPASS wvmktempdir)" || exit $? @@ -10,7 +10,7 @@ export GIT_DIR="$tmpdir/bup" bup() { "$top/bup" "$@"; } -compare-trees() { "$top/t/compare-trees" "$@"; } +compare-trees() { "$top/dev/compare-trees" "$@"; } wv_matches_rx() { @@ -44,7 +44,7 @@ WVPASS mkdir src src/foo WVPASS echo twisty-maze > src/1 WVPASS bup index src WVPASS bup save -n src src -WVPASS "$top"/t/sync-tree bup/ bup-baseline/ +WVPASS "$top"/dev/sync-tree bup/ bup-baseline/ # FIXME: test -n WVPASS bup tick # Make sure we always get the timestamp changes below WVPASS bup rm --unsafe /src @@ -67,7 +67,7 @@ WVPASS bup save -n src-2 src WVPASS echo twisty-maze > src/3 WVPASS bup index src WVPASS bup save -n src-3 src -WVPASS "$top"/t/sync-tree bup/ bup-baseline/ +WVPASS "$top"/dev/sync-tree bup/ bup-baseline/ WVPASS bup tick # Make sure we always get the timestamp changes below WVPASS bup rm --unsafe /src observed="$(compare-trees bup/ bup-baseline/ | LC_ALL=C sort)" || exit $? @@ -89,7 +89,7 @@ WVPASS bup save -n src-4 src WVPASS echo twisty-maze > src/5 WVPASS bup index src WVPASS bup save -n src-5 src -WVPASS "$top"/t/sync-tree bup/ bup-baseline/ +WVPASS "$top"/dev/sync-tree bup/ bup-baseline/ WVPASS bup tick # Make sure we always get the timestamp changes below WVPASS bup rm --unsafe /src-2 /src-4 observed="$(compare-trees bup/ bup-baseline/ | LC_ALL=C sort)" || exit $? @@ -107,7 +107,7 @@ wv_matches_rx "$observed" \ WVSTART "rm /foo /bar (all)" WVPASS rm -rf bup WVPASS mv bup-baseline bup -WVPASS "$top"/t/sync-tree bup/ bup-baseline/ +WVPASS "$top"/dev/sync-tree bup/ bup-baseline/ WVPASS bup tick # Make sure we always get the timestamp changes below WVPASS bup rm --unsafe /src /src-2 /src-3 /src-4 /src-5 observed="$(compare-trees bup/ bup-baseline/ | LC_ALL=C sort)" || exit $? @@ -137,7 +137,7 @@ WVPASS bup index src WVPASS bup save -n src src WVPASS bup ls src > tmp-ls save1="$(WVPASS head -n 1 tmp-ls)" || exit $? -WVPASS "$top"/t/sync-tree bup/ bup-baseline/ +WVPASS "$top"/dev/sync-tree bup/ bup-baseline/ WVPASS bup tick # Make sure we always get the timestamp changes below WVFAIL bup rm --unsafe /src/latest WVPASS bup rm --unsafe /src/"$save1" @@ -214,7 +214,7 @@ WVPASS bup tick # Make sure we always get the timestamp changes below WVSTART "rm /foo/BAR (first of many)" -WVPASS "$top"/t/sync-tree bup-baseline/ bup/ +WVPASS "$top"/dev/sync-tree bup-baseline/ bup/ WVPASS bup ls src > tmp-ls victim="$(WVPASS head -n 1 tmp-ls)" || exit $? WVPASS bup rm --unsafe /src/"$victim" @@ -226,7 +226,7 @@ WVPASSEQ "$(rm-safe-cinfo 2 bup src)" "$(rm-safe-cinfo 3 bup-baseline src)" WVSTART "rm /foo/BAR (one of many)" -WVPASS "$top"/t/sync-tree bup-baseline/ bup/ +WVPASS "$top"/dev/sync-tree bup-baseline/ bup/ victim="$(WVPASS bup ls src | tail -n +2 | head -n 1)" || exit $? WVPASS bup rm --unsafe /src/"$victim" verify-changes-caused-by-rewriting-save bup-baseline bup @@ -237,7 +237,7 @@ WVPASSEQ "$(rm-safe-cinfo 2 bup src)" "$(rm-safe-cinfo 3 bup-baseline src)" WVSTART "rm /foo/BAR (last of many)" -WVPASS "$top"/t/sync-tree bup-baseline/ bup/ +WVPASS "$top"/dev/sync-tree bup-baseline/ bup/ victim="$(WVPASS bup ls src | tail -n 2 | head -n 1)" || exit $? WVPASS bup rm --unsafe -vv /src/"$victim" observed="$(compare-trees bup/ bup-baseline/ | LC_ALL=C sort)" || exit $? diff --git a/t/test-save-creates-no-unrefs.sh b/test/ext/test-save-creates-no-unrefs.sh similarity index 100% rename from t/test-save-creates-no-unrefs.sh rename to test/ext/test-save-creates-no-unrefs.sh diff --git a/t/test-save-errors b/test/ext/test-save-errors similarity index 99% rename from t/test-save-errors rename to test/ext/test-save-errors index 14fd47f..7b65f16 100755 --- a/t/test-save-errors +++ b/test/ext/test-save-errors @@ -1,7 +1,7 @@ #!/usr/bin/env bash . wvtest.sh . wvtest-bup.sh -. t/lib.sh +. dev/lib.sh set -o pipefail diff --git a/t/test-save-restore b/test/ext/test-save-restore similarity index 93% rename from t/test-save-restore rename to test/ext/test-save-restore index e022243..48c9e0d 100755 --- a/t/test-save-restore +++ b/test/ext/test-save-restore @@ -1,7 +1,7 @@ #!/usr/bin/env bash . wvtest.sh . wvtest-bup.sh -. t/lib.sh +. dev/lib.sh set -o pipefail @@ -16,10 +16,10 @@ validate-local-and-remote-restore() local src="$1" dest="$2" cmp_src="$3" cmp_dest="$4" force-delete "$dest" WVPASS bup restore -C "$dest" "$src" - WVPASS "$top/t/compare-trees" "$cmp_src" "$cmp_dest" + WVPASS "$top/dev/compare-trees" "$cmp_src" "$cmp_dest" force-delete "$dest" WVPASS bup restore -r ":$BUP_DIR" -C "$dest" "$src" - WVPASS "$top/t/compare-trees" "$cmp_src" "$cmp_dest" + WVPASS "$top/dev/compare-trees" "$cmp_src" "$cmp_dest" } @@ -91,12 +91,12 @@ WVPASSEQ "$(cat buprestore.tmp/data)" "" WVPASS force-delete "$tmp/restore" WVPASS bup restore -C "$tmp"/restore /foo/latest/x/ for x in "$tmp"/src/x/*; do - WVPASS "$top/t/compare-trees" "$x/" "$tmp/restore/$(basename $x)" + WVPASS "$top/dev/compare-trees" "$x/" "$tmp/restore/$(basename $x)" done WVPASS force-delete "$tmp/restore" WVPASS bup restore -r ":$BUP_DIR" -C "$tmp"/restore /foo/latest/x/ for x in "$tmp"/src/x/*; do - WVPASS "$top/t/compare-trees" "$x/" "$tmp/restore/$(basename $x)" + WVPASS "$top/dev/compare-trees" "$x/" "$tmp/restore/$(basename $x)" done WVSTART "restore /foo/latest/x/." diff --git a/t/test-save-restore-excludes.sh b/test/ext/test-save-restore-excludes.sh similarity index 99% rename from t/test-save-restore-excludes.sh rename to test/ext/test-save-restore-excludes.sh index 0896877..39ce969 100755 --- a/t/test-save-restore-excludes.sh +++ b/test/ext/test-save-restore-excludes.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-save-smaller b/test/ext/test-save-smaller similarity index 99% rename from t/test-save-smaller rename to test/ext/test-save-smaller index 7018c84..1f497b7 100755 --- a/t/test-save-smaller +++ b/test/ext/test-save-smaller @@ -1,7 +1,7 @@ #!/usr/bin/env bash . wvtest.sh . wvtest-bup.sh -. t/lib.sh +. dev/lib.sh set -o pipefail diff --git a/t/test-save-strip-graft.sh b/test/ext/test-save-strip-graft.sh similarity index 98% rename from t/test-save-strip-graft.sh rename to test/ext/test-save-strip-graft.sh index 95883dd..78b79fe 100755 --- a/t/test-save-strip-graft.sh +++ b/test/ext/test-save-strip-graft.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail @@ -11,7 +11,7 @@ export BUP_DIR="$tmpdir/bup" export GIT_DIR="$tmpdir/bup" bup() { "$top/bup" "$@"; } -compare-trees() { "$top/t/compare-trees" "$@"; } +compare-trees() { "$top/dev/compare-trees" "$@"; } WVPASS cd "$tmpdir" diff --git a/t/test-save-with-valid-parent.sh b/test/ext/test-save-with-valid-parent.sh similarity index 80% rename from t/test-save-with-valid-parent.sh rename to test/ext/test-save-with-valid-parent.sh index f817165..53c7e1b 100755 --- a/t/test-save-with-valid-parent.sh +++ b/test/ext/test-save-with-valid-parent.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail @@ -11,7 +11,7 @@ export BUP_DIR="$tmpdir/bup" export GIT_DIR="$tmpdir/bup" bup() { "$top/bup" "$@"; } -compare-trees() { "$top/t/compare-trees" "$@"; } +compare-trees() { "$top/dev/compare-trees" "$@"; } WVPASS cd "$tmpdir" @@ -29,12 +29,12 @@ WVPASS bup save -n src src WVPASS bup save -n src src/b WVPASS bup restore -C restore "src/latest/$(pwd)/" WVPASS test ! -e restore/src/a -WVPASS "$top/t/compare-trees" -c src/b/ restore/src/b/ +WVPASS "$top/dev/compare-trees" -c src/b/ restore/src/b/ WVPASS bup save -n src src/a/1 WVPASS rm -r restore WVPASS bup restore -C restore "src/latest/$(pwd)/" WVPASS test ! -e restore/src/b -WVPASS "$top/t/compare-trees" -c src/a/ restore/src/a/ +WVPASS "$top/dev/compare-trees" -c src/a/ restore/src/a/ WVPASS rm -rf "$tmpdir" diff --git a/t/test-sparse-files.sh b/test/ext/test-sparse-files.sh similarity index 88% rename from t/test-sparse-files.sh rename to test/ext/test-sparse-files.sh index 1a207e9..c000784 100755 --- a/t/test-sparse-files.sh +++ b/test/ext/test-sparse-files.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . ./wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail @@ -44,21 +44,21 @@ WVSTART "sparse file restore (all sparse)" WVPASS bup restore -C restore "src/latest/$(pwd)/" restore_size=$(WVPASS du -k -s restore/src/foo | WVPASS cut -f1) || exit $? WVPASS [ "$restore_size" -ge "$((data_size / 1024))" ] -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --no-sparse (all sparse)" WVPASS rm -r restore WVPASS bup restore --no-sparse -C restore "src/latest/$(pwd)/" restore_size=$(WVPASS du -k -s restore/src/foo | WVPASS cut -f1) || exit $? WVPASS [ "$restore_size" -ge "$((data_size / 1024))" ] -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (all sparse)" WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" restore_size=$(WVPASS du -k -s restore/src/foo | WVPASS cut -f1) || exit $? WVPASS [ "$restore_size" -le "$((3 * (block_size / 1024)))" ] -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (sparse end)" WVPASS echo "start" > src/foo @@ -69,7 +69,7 @@ WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" restore_size=$(WVPASS du -k -s restore/src/foo | WVPASS cut -f1) || exit $? WVPASS [ "$restore_size" -le "$((3 * (block_size / 1024)))" ] -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (sparse middle)" WVPASS echo "end" >> src/foo @@ -79,7 +79,7 @@ WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" restore_size=$(WVPASS du -k -s restore/src/foo | WVPASS cut -f1) || exit $? WVPASS [ "$restore_size" -le "$((5 * (block_size / 1024)))" ] -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (bracketed zero run in buf)" WVPASS echo 'x' > src/foo @@ -89,7 +89,7 @@ WVPASS bup index src WVPASS bup save -n src src WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (sparse start)" WVPASS dd if=/dev/zero of=src/foo seek="$data_size" bs=1 count=1 @@ -100,7 +100,7 @@ WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" restore_size=$(WVPASS du -k -s restore/src/foo | WVPASS cut -f1) || exit $? WVPASS [ "$restore_size" -le "$((5 * (block_size / 1024)))" ] -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (sparse start and end)" WVPASS dd if=/dev/zero of=src/foo seek="$data_size" bs=1 count=1 @@ -112,7 +112,7 @@ WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" restore_size=$(WVPASS du -k -s restore/src/foo | WVPASS cut -f1) || exit $? WVPASS [ "$restore_size" -le "$((5 * (block_size / 1024)))" ] -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ if test "$block_size" -gt $mb; then random_size="$block_size" @@ -125,7 +125,7 @@ WVPASS bup index src WVPASS bup save -n src src WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (random sparse regions)" WVPASS rm -rf "$BUP_DIR" src @@ -133,13 +133,13 @@ WVPASS bup init WVPASS mkdir src for sparse_dataset in 0 1 2 3 4 5 6 7 8 9 do - WVPASS "$top/t/sparse-test-data" "src/foo-$sparse_dataset" + WVPASS "$top/dev/sparse-test-data" "src/foo-$sparse_dataset" done WVPASS bup index src WVPASS bup save -n src src WVPASS rm -r restore WVPASS bup restore --sparse -C restore "src/latest/$(pwd)/" -WVPASS "$top/t/compare-trees" -c src/ restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ restore/src/ WVSTART "sparse file restore --sparse (short zero runs around boundary)" WVPASS bup-cfg-py > src/foo <noop.tmp +WVPASS bup split --noop <"$top/test/testfile1" >noop.tmp WVPASSEQ '' "$(tags1n.tmp -WVPASS bup split --noop -t <"$top/t/testfile2" >tags2tn.tmp +WVPASS bup split --noop -b <"$top/test/testfile1" >tags1n.tmp +WVPASS bup split --noop -t <"$top/test/testfile2" >tags2tn.tmp WVPASSEQ $(find "$BUP_DIR/objects/pack" -name '*.pack' | wc -l) 0 WVSTART "split" @@ -38,8 +38,8 @@ WVPASSEQ "$(cat tag[ab].tmp | bup split -b --keep-boundaries --git-ids)" \ "$(cat tag[ab].tmp)" WVPASSEQ "$(cat tag[ab].tmp | bup split -b --git-ids)" \ "$(cat tagab.tmp)" -WVPASS bup split --bench -b <"$top/t/testfile1" >tags1.tmp -WVPASS bup split -vvvv -b "$top/t/testfile2" >tags2.tmp +WVPASS bup split --bench -b <"$top/test/testfile1" >tags1.tmp +WVPASS bup split -vvvv -b "$top/test/testfile2" >tags2.tmp WVPASS echo -n "" | WVPASS bup split -n split_empty_string.tmp WVPASS bup margin WVPASS bup midx -f @@ -59,10 +59,10 @@ WVPASS bup midx -a WVPASSEQ "$(echo "$BUP_DIR"/objects/pack/*.midx)" \ ""$BUP_DIR"/objects/pack/yyy.midx" WVPASS bup margin -WVPASS bup split -t "$top/t/testfile2" >tags2t.tmp -WVPASS bup split -t "$top/t/testfile2" --fanout 3 >tags2tf.tmp -WVPASS bup split -r "$BUP_DIR" -c "$top/t/testfile2" >tags2c.tmp -WVPASS bup split -r ":$BUP_DIR" -c "$top/t/testfile2" >tags2c.tmp +WVPASS bup split -t "$top/test/testfile2" >tags2t.tmp +WVPASS bup split -t "$top/test/testfile2" --fanout 3 >tags2tf.tmp +WVPASS bup split -r "$BUP_DIR" -c "$top/test/testfile2" >tags2c.tmp +WVPASS bup split -r ":$BUP_DIR" -c "$top/test/testfile2" >tags2c.tmp WVPASS ls -lR \ | WVPASS bup split -r ":$BUP_DIR" -c --fanout 3 --max-pack-objects 3 -n lslr \ || exit $? @@ -78,7 +78,7 @@ WVPASS diff -u tags2t.tmp tags2tn.tmp # fanout must be different from non-fanout WVFAIL diff tags2t.tmp tags2tf.tmp -WVPASS wc -c "$top/t/testfile1" "$top/t/testfile2" +WVPASS wc -c "$top/test/testfile1" "$top/test/testfile2" WVPASS wc -l tags1.tmp tags2.tmp WVSTART "join" @@ -87,10 +87,10 @@ WVPASS bup join out2.tmp WVPASS bup join out2c.tmp WVPASS bup join -r ":$BUP_DIR" out2c.tmp -WVPASS diff -u "$top/t/testfile1" out1.tmp -WVPASS diff -u "$top/t/testfile2" out2.tmp -WVPASS diff -u "$top/t/testfile2" out2t.tmp -WVPASS diff -u "$top/t/testfile2" out2c.tmp +WVPASS diff -u "$top/test/testfile1" out1.tmp +WVPASS diff -u "$top/test/testfile2" out2.tmp +WVPASS diff -u "$top/test/testfile2" out2t.tmp +WVPASS diff -u "$top/test/testfile2" out2c.tmp WVPASSEQ "$(bup join split_empty_string.tmp)" "" WVPASS rm -rf "$tmpdir" diff --git a/t/test-tz.sh b/test/ext/test-tz.sh similarity index 100% rename from t/test-tz.sh rename to test/ext/test-tz.sh diff --git a/t/test-web.sh b/test/ext/test-web.sh similarity index 98% rename from t/test-web.sh rename to test/ext/test-web.sh index 24a68a4..eab092c 100755 --- a/t/test-web.sh +++ b/test/ext/test-web.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash . wvtest-bup.sh || exit $? -. t/lib.sh || exit $? +. dev/lib.sh || exit $? set -o pipefail diff --git a/t/test-xdev.sh b/test/ext/test-xdev.sh similarity index 97% rename from t/test-xdev.sh rename to test/ext/test-xdev.sh index e981706..78861a9 100755 --- a/t/test-xdev.sh +++ b/test/ext/test-xdev.sh @@ -3,7 +3,7 @@ set -o pipefail -root_status="$(t/root-status)" || exit $? +root_status="$(dev/root-status)" || exit $? if [ "$root_status" != root ]; then WVSTART 'not root: skipping tests' @@ -78,7 +78,7 @@ WVPASS bup save -n src src WVPASS mkdir src-restore WVPASS bup restore -C src-restore "/src/latest$(pwd)/" WVPASS test -d src-restore/src -WVPASS "$top/t/compare-trees" -c src/ src-restore/src/ +WVPASS "$top/dev/compare-trees" -c src/ src-restore/src/ # Test -x when none of the mount points are explicitly indexed WVPASS rm -r "$BUP_DIR" src-restore diff --git a/t/test.sh b/test/ext/test.sh similarity index 97% rename from t/test.sh rename to test/ext/test.sh index fb20023..5fb96be 100755 --- a/t/test.sh +++ b/test/ext/test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash . wvtest.sh . wvtest-bup.sh -. t/lib.sh +. dev/lib.sh set -o pipefail @@ -50,7 +50,7 @@ WVSTART "save/git-fsck" #git repack -Ad #git prune WVPASS bup random 4k | WVPASS bup split -b - (WVPASS cd "$top/t/sampledata" && WVPASS bup save -vvn master /) || exit $? + (WVPASS cd "$top/test/sampledata" && WVPASS bup save -vvn master /) || exit $? result="$(LC_ALL=C git fsck --full --strict 2>&1)" || exit $? n=$(echo "$result" | WVFAIL egrep -v 'dangling (commit|tree|blob)' | diff --git a/lib/bup/t/__init__.py b/test/int/__init__.py similarity index 100% rename from lib/bup/t/__init__.py rename to test/int/__init__.py diff --git a/lib/bup/t/tbloom.py b/test/int/tbloom.py similarity index 100% rename from lib/bup/t/tbloom.py rename to test/int/tbloom.py diff --git a/lib/bup/t/tclient.py b/test/int/tclient.py similarity index 100% rename from lib/bup/t/tclient.py rename to test/int/tclient.py diff --git a/lib/bup/t/tcompat.py b/test/int/tcompat.py similarity index 100% rename from lib/bup/t/tcompat.py rename to test/int/tcompat.py diff --git a/lib/bup/t/tgit.py b/test/int/tgit.py similarity index 100% rename from lib/bup/t/tgit.py rename to test/int/tgit.py diff --git a/lib/bup/t/thashsplit.py b/test/int/thashsplit.py similarity index 100% rename from lib/bup/t/thashsplit.py rename to test/int/thashsplit.py diff --git a/lib/bup/t/thelpers.py b/test/int/thelpers.py similarity index 98% rename from lib/bup/t/thelpers.py rename to test/int/thelpers.py index e05c1f6..0a03ff3 100644 --- a/lib/bup/t/thelpers.py +++ b/test/int/thelpers.py @@ -1,7 +1,8 @@ from __future__ import absolute_import from time import tzset -import helpers, math, os, re, subprocess +import math, os, os.path, re, subprocess +from bup import helpers from wvtest import * @@ -15,10 +16,6 @@ from buptest import no_lingering_errors, test_tempdir import bup._helpers as _helpers -bup_tmp = os.path.realpath(b'../../../t/tmp') -mkdirp(bup_tmp) - - @wvtest def test_parse_num(): with no_lingering_errors(): diff --git a/lib/bup/t/tindex.py b/test/int/tindex.py similarity index 99% rename from lib/bup/t/tindex.py rename to test/int/tindex.py index dea7cd8..5f66f0f 100644 --- a/lib/bup/t/tindex.py +++ b/test/int/tindex.py @@ -17,7 +17,7 @@ lib_t_dir = os.path.dirname(fsencode(__file__)) @wvtest def index_basic(): with no_lingering_errors(): - cd = os.path.realpath(b'../../../t') + cd = os.path.realpath(b'../') WVPASS(cd) sd = os.path.realpath(cd + b'/sampledata') WVPASSEQ(resolve_parent(cd + b'/sampledata'), sd) diff --git a/lib/bup/t/tmetadata.py b/test/int/tmetadata.py similarity index 99% rename from lib/bup/t/tmetadata.py rename to test/int/tmetadata.py index be9c772..398e0ba 100644 --- a/lib/bup/t/tmetadata.py +++ b/test/int/tmetadata.py @@ -14,8 +14,7 @@ from buptest import no_lingering_errors, test_tempdir import bup.helpers as helpers -top_dir = b'../../..' -bup_tmp = os.path.realpath(b'../../../t/tmp') +top_dir = b'../..' bup_path = top_dir + b'/bup' start_dir = os.getcwd() diff --git a/lib/bup/t/toptions.py b/test/int/toptions.py similarity index 100% rename from lib/bup/t/toptions.py rename to test/int/toptions.py diff --git a/lib/bup/t/tresolve.py b/test/int/tresolve.py similarity index 99% rename from lib/bup/t/tresolve.py rename to test/int/tresolve.py index f2e29d4..3296dfa 100644 --- a/lib/bup/t/tresolve.py +++ b/test/int/tresolve.py @@ -14,8 +14,8 @@ from bup.compat import environ from bup.io import path_msg from bup.metadata import Metadata from bup.repo import LocalRepo, RemoteRepo -from bup.test.vfs import tree_dict from buptest import ex, exo, no_lingering_errors, test_tempdir +from buptest.vfs import tree_dict bup_path = path.exe() diff --git a/lib/bup/t/tshquote.py b/test/int/tshquote.py similarity index 100% rename from lib/bup/t/tshquote.py rename to test/int/tshquote.py diff --git a/lib/bup/t/tvfs.py b/test/int/tvfs.py similarity index 99% rename from lib/bup/t/tvfs.py rename to test/int/tvfs.py index 2563333..a7d3b21 100644 --- a/lib/bup/t/tvfs.py +++ b/test/int/tvfs.py @@ -19,11 +19,10 @@ from bup.git import BUP_CHUNKED from bup.helpers import exc, shstr from bup.metadata import Metadata from bup.repo import LocalRepo -from bup.test.vfs import tree_dict from buptest import ex, exo, no_lingering_errors, test_tempdir +from buptest.vfs import tree_dict -top_dir = b'../../..' -bup_tmp = os.path.realpath(b'../../../t/tmp') +top_dir = b'../..' bup_path = top_dir + b'/bup' start_dir = os.getcwd() diff --git a/lib/bup/t/tvint.py b/test/int/tvint.py similarity index 100% rename from lib/bup/t/tvint.py rename to test/int/tvint.py diff --git a/lib/bup/t/txstat.py b/test/int/txstat.py similarity index 100% rename from lib/bup/t/txstat.py rename to test/int/txstat.py diff --git a/buptest.py b/test/lib/buptest/__init__.py similarity index 98% rename from buptest.py rename to test/lib/buptest/__init__.py index 2089fcf..5b7bf13 100644 --- a/buptest.py +++ b/test/lib/buptest/__init__.py @@ -35,7 +35,7 @@ def no_lingering_errors(): # Assumes (of course) this file is at the top-level of the source tree -_bup_tmp = realpath(dirname(fsencode(__file__))) + b'/t/tmp' +_bup_tmp = realpath(dirname(fsencode(__file__))) + b'/test/tmp' try: os.makedirs(_bup_tmp) except OSError as e: diff --git a/lib/bup/test/vfs.py b/test/lib/buptest/vfs.py similarity index 100% rename from lib/bup/test/vfs.py rename to test/lib/buptest/vfs.py diff --git a/t/sampledata/b2/foozy b/test/sampledata/b2/foozy similarity index 100% rename from t/sampledata/b2/foozy rename to test/sampledata/b2/foozy diff --git a/t/sampledata/b2/foozy2 b/test/sampledata/b2/foozy2 similarity index 100% rename from t/sampledata/b2/foozy2 rename to test/sampledata/b2/foozy2 diff --git a/t/sampledata/x b/test/sampledata/x similarity index 100% rename from t/sampledata/x rename to test/sampledata/x diff --git a/t/sampledata/y-2000 b/test/sampledata/y-2000 similarity index 100% rename from t/sampledata/y-2000 rename to test/sampledata/y-2000 diff --git a/t/sampledata/y/testfile1 b/test/sampledata/y/testfile1 similarity index 100% rename from t/sampledata/y/testfile1 rename to test/sampledata/y/testfile1 diff --git a/t/sampledata/y/text b/test/sampledata/y/text similarity index 100% rename from t/sampledata/y/text rename to test/sampledata/y/text diff --git a/t/testfile1 b/test/testfile1 similarity index 100% rename from t/testfile1 rename to test/testfile1 diff --git a/t/testfile2 b/test/testfile2 similarity index 100% rename from t/testfile2 rename to test/testfile2 diff --git a/wvtest-bup.sh b/wvtest-bup.sh index d7f0b48..b024fe1 100644 --- a/wvtest-bup.sh +++ b/wvtest-bup.sh @@ -10,13 +10,13 @@ _wvtop="$(pwd)" wvmktempdir () { local script_name="$(basename $0)" - mkdir -p "$_wvtop/t/tmp" || exit $? - mktemp -d "$_wvtop/t/tmp/$script_name-XXXXXXX" || exit $? + mkdir -p "$_wvtop/test/tmp" || exit $? + mktemp -d "$_wvtop/test/tmp/$script_name-XXXXXXX" || exit $? } wvmkmountpt () { local script_name="$(basename $0)" - mkdir -p "$_wvtop/t/mnt" || exit $? - mktemp -d "$_wvtop/t/mnt/$script_name-XXXXXXX" || exit $? + mkdir -p "$_wvtop/test/mnt" || exit $? + mktemp -d "$_wvtop/test/mnt/$script_name-XXXXXXX" || exit $? } diff --git a/wvtest.py b/wvtest.py index 9d3ee49..8451b3e 100755 --- a/wvtest.py +++ b/wvtest.py @@ -22,6 +22,8 @@ import re import sys import traceback +sys.path[:0] = [os.path.realpath('test/lib')] + _start_dir = os.getcwd() # NOTE -- 2.39.2