From: Ben Pfaff Date: Thu, 4 Jan 2007 15:13:49 +0000 (+0000) Subject: Separate persistence tests from the extended filesys tests. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f513af8c06c2acb26e28cc67ad0bf000095a129;p=pintos-anon Separate persistence tests from the extended filesys tests. Suggested by Godmar Back. --- diff --git a/src/tests/Make.tests b/src/tests/Make.tests index 6595b46..94367f6 100644 --- a/src/tests/Make.tests +++ b/src/tests/Make.tests @@ -4,10 +4,11 @@ include $(patsubst %,$(SRCDIR)/%/Make.tests,$(TEST_SUBDIRS)) PROGS = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_PROGS)) TESTS = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_TESTS)) +EXTRA_GRADES = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_EXTRA_GRADES)) -OUTPUTS = $(addsuffix .output,$(TESTS)) -ERRORS = $(addsuffix .errors,$(TESTS)) -RESULTS = $(addsuffix .result,$(TESTS)) +OUTPUTS = $(addsuffix .output,$(TESTS) $(EXTRA_GRADES)) +ERRORS = $(addsuffix .errors,$(TESTS) $(EXTRA_GRADES)) +RESULTS = $(addsuffix .result,$(TESTS) $(EXTRA_GRADES)) ifdef PROGS include ../../Makefile.userprog @@ -33,7 +34,7 @@ check:: results fi results: $(RESULTS) - @for d in $(TESTS); do \ + @for d in $(TESTS) $(EXTRA_GRADES); do \ if echo PASS | cmp -s $$d.result -; then \ echo "pass $$d"; \ else \ diff --git a/src/tests/filesys/Grading.no-vm b/src/tests/filesys/Grading.no-vm index c116fbd..d7c3944 100644 --- a/src/tests/filesys/Grading.no-vm +++ b/src/tests/filesys/Grading.no-vm @@ -5,9 +5,12 @@ # all the previous functionality should work too. It's not too easy # to screw it up, thus the emphasis. -# 75% for file system. -33.3% tests/filesys/extended/Rubric.functionality +# 50% for extended file system features. +16.7% tests/filesys/extended/Rubric.functionality 16.7% tests/filesys/extended/Rubric.robustness +16.6% tests/filesys/extended/Rubric.persistence + +# 25% to not break the provided file system features. 25% tests/filesys/base/Rubric # 25% for the rest. diff --git a/src/tests/filesys/Grading.with-vm b/src/tests/filesys/Grading.with-vm index 8a440e6..c930699 100644 --- a/src/tests/filesys/Grading.with-vm +++ b/src/tests/filesys/Grading.with-vm @@ -5,9 +5,12 @@ # all the previous functionality should work too. It's not too easy # to screw it up, thus the emphasis. -# 75% for file system. -33.3% tests/filesys/extended/Rubric.functionality +# 50% for extended file system features. +16.7% tests/filesys/extended/Rubric.functionality 16.7% tests/filesys/extended/Rubric.robustness +16.6% tests/filesys/extended/Rubric.persistence + +# 25% to not break the provided file system features. 25% tests/filesys/base/Rubric # 25% for the rest. diff --git a/src/tests/filesys/extended/Make.tests b/src/tests/filesys/extended/Make.tests index 72539a5..389965a 100644 --- a/src/tests/filesys/extended/Make.tests +++ b/src/tests/filesys/extended/Make.tests @@ -1,13 +1,15 @@ # -*- makefile -*- -tests/filesys/extended_TESTS = $(addprefix \ -tests/filesys/extended/,dir-empty-name dir-mk-tree dir-mkdir dir-open \ +raw_tests = dir-empty-name dir-mk-tree dir-mkdir dir-open \ dir-over-file dir-rm-cwd dir-rm-parent dir-rm-root dir-rm-tree \ dir-rmdir dir-under-file dir-vine grow-create grow-dir-lg \ grow-file-size grow-root-lg grow-root-sm grow-seq-lg grow-seq-sm \ -grow-sparse grow-tell grow-two-files syn-rw) +grow-sparse grow-tell grow-two-files syn-rw -tests/filesys/extended_PROGS = $(tests/filesys/extended_TESTS) \ +tests/filesys/extended_TESTS = $(patsubst %,tests/filesys/extended/%,$(raw_tests)) +tests/filesys/extended_EXTRA_GRADES = $(patsubst %,tests/filesys/extended/%-persistence,$(raw_tests)) + +tests/filesys/extended_PROGS = $(tests/filesys/extended_TESTS) \ tests/filesys/extended/child-syn-rw tests/filesys/extended/tar $(foreach prog,$(tests/filesys/extended_PROGS), \ @@ -25,7 +27,6 @@ tests/filesys/extended/dir-rm-tree_SRC += tests/filesys/extended/mk-tree.c tests/filesys/extended/syn-rw_PUTFILES += tests/filesys/extended/child-syn-rw - GETTIMEOUT = 60 GETCMD = pintos -v -k -T $(GETTIMEOUT) @@ -40,7 +41,7 @@ GETCMD += -- -q GETCMD += $(KERNELFLAGS) GETCMD += run 'tar fs.tar /' GETCMD += < /dev/null -GETCMD += 2> $(TEST).get-errors $(if $(VERBOSE),|tee,>) $(TEST).get-output +GETCMD += 2> $(TEST)-persistence.errors $(if $(VERBOSE),|tee,>) $(TEST)-persistence.output tests/filesys/extended/%.output: os.dsk rm -f tmp.dsk @@ -48,10 +49,11 @@ tests/filesys/extended/%.output: os.dsk $(TESTCMD) $(GETCMD) rm -f tmp.dsk +$(foreach raw_test,$(raw_tests),$(eval tests/filesys/extended/$(raw_test)-persistence.output: tests/filesys/extended/$(raw_test).output; )) +$(foreach raw_test,$(raw_tests),$(eval tests/filesys/extended/$(raw_test)-persistence.result: tests/filesys/extended/$(raw_test).result)) TARS = $(addsuffix .tar,$(tests/filesys/extended_TESTS)) -GET_OUTPUTS = $(addsuffix .get-output,$(tests/filesys/extended_TESTS)) -GET_ERRORS = $(addsuffix .get-errors,$(tests/filesys/extended_TESTS)) clean:: - rm -f $(TARS) $(GET_OUTPUTS) $(GET_ERRORS) + rm -f $(TARS) + rm -f tests/filesys/extended/can-rmdir-cwd diff --git a/src/tests/filesys/extended/Rubric.persistence b/src/tests/filesys/extended/Rubric.persistence new file mode 100644 index 0000000..405620a --- /dev/null +++ b/src/tests/filesys/extended/Rubric.persistence @@ -0,0 +1,24 @@ +Persistence of file system: +1 dir-empty-name-persistence +1 dir-mk-tree-persistence +1 dir-mkdir-persistence +1 dir-open-persistence +1 dir-over-file-persistence +1 dir-rm-cwd-persistence +1 dir-rm-parent-persistence +1 dir-rm-root-persistence +1 dir-rm-tree-persistence +1 dir-rmdir-persistence +1 dir-under-file-persistence +1 dir-vine-persistence +1 grow-create-persistence +1 grow-dir-lg-persistence +1 grow-file-size-persistence +1 grow-root-lg-persistence +1 grow-root-sm-persistence +1 grow-seq-lg-persistence +1 grow-seq-sm-persistence +1 grow-sparse-persistence +1 grow-tell-persistence +1 grow-two-files-persistence +1 syn-rw-persistence diff --git a/src/tests/filesys/extended/dir-empty-name-persistence.ck b/src/tests/filesys/extended/dir-empty-name-persistence.ck new file mode 100644 index 0000000..562c451 --- /dev/null +++ b/src/tests/filesys/extended/dir-empty-name-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({}); +pass; diff --git a/src/tests/filesys/extended/dir-empty-name.ck b/src/tests/filesys/extended/dir-empty-name.ck index 5e4c56e..d6c5621 100644 --- a/src/tests/filesys/extended/dir-empty-name.ck +++ b/src/tests/filesys/extended/dir-empty-name.ck @@ -7,5 +7,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-empty-name) mkdir "" (must return false) (dir-empty-name) end EOF -check_archive ({}); pass; diff --git a/src/tests/filesys/extended/dir-mk-tree-persistence.ck b/src/tests/filesys/extended/dir-mk-tree-persistence.ck new file mode 100644 index 0000000..fb16afd --- /dev/null +++ b/src/tests/filesys/extended/dir-mk-tree-persistence.ck @@ -0,0 +1,16 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +my ($tree); +for my $a (0...3) { + for my $b (0...2) { + for my $c (0...2) { + for my $d (0...3) { + $tree->{$a}{$b}{$c}{$d} = ['']; + } + } + } +} +check_archive ($tree); +pass; diff --git a/src/tests/filesys/extended/dir-mk-tree.ck b/src/tests/filesys/extended/dir-mk-tree.ck index 046e509..a8507e2 100644 --- a/src/tests/filesys/extended/dir-mk-tree.ck +++ b/src/tests/filesys/extended/dir-mk-tree.ck @@ -9,15 +9,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-mk-tree) close "/0/2/0/3" (dir-mk-tree) end EOF -my ($tree); -for my $a (0...3) { - for my $b (0...2) { - for my $c (0...2) { - for my $d (0...3) { - $tree->{$a}{$b}{$c}{$d} = ['']; - } - } - } -} -check_archive ($tree); pass; diff --git a/src/tests/filesys/extended/dir-mkdir-persistence.ck b/src/tests/filesys/extended/dir-mkdir-persistence.ck new file mode 100644 index 0000000..7682900 --- /dev/null +++ b/src/tests/filesys/extended/dir-mkdir-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({'a' => {'b' => ["\0" x 512]}}); +pass; diff --git a/src/tests/filesys/extended/dir-mkdir.ck b/src/tests/filesys/extended/dir-mkdir.ck index 7cde055..4644f80 100644 --- a/src/tests/filesys/extended/dir-mkdir.ck +++ b/src/tests/filesys/extended/dir-mkdir.ck @@ -10,5 +10,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-mkdir) open "b" (dir-mkdir) end EOF -check_archive ({'a' => {'b' => ["\0" x 512]}}); pass; diff --git a/src/tests/filesys/extended/dir-open-persistence.ck b/src/tests/filesys/extended/dir-open-persistence.ck new file mode 100644 index 0000000..26ff2f1 --- /dev/null +++ b/src/tests/filesys/extended/dir-open-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({"xyzzy" => {}}); +pass; diff --git a/src/tests/filesys/extended/dir-open.ck b/src/tests/filesys/extended/dir-open.ck index 01eccba..fccc563 100644 --- a/src/tests/filesys/extended/dir-open.ck +++ b/src/tests/filesys/extended/dir-open.ck @@ -17,5 +17,4 @@ EOF (dir-open) write "xyzzy" dir-open: exit(-1) EOF -check_archive ({"xyzzy" => {}}); pass; diff --git a/src/tests/filesys/extended/dir-over-file-persistence.ck b/src/tests/filesys/extended/dir-over-file-persistence.ck new file mode 100644 index 0000000..56b4ed2 --- /dev/null +++ b/src/tests/filesys/extended/dir-over-file-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({"abc" => {}}); +pass; diff --git a/src/tests/filesys/extended/dir-over-file.ck b/src/tests/filesys/extended/dir-over-file.ck index 5208429..aae1c1e 100644 --- a/src/tests/filesys/extended/dir-over-file.ck +++ b/src/tests/filesys/extended/dir-over-file.ck @@ -8,5 +8,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-over-file) create "abc" (must return false) (dir-over-file) end EOF -check_archive ({"abc" => {}}); pass; diff --git a/src/tests/filesys/extended/dir-rm-cwd-persistence.ck b/src/tests/filesys/extended/dir-rm-cwd-persistence.ck new file mode 100644 index 0000000..7533570 --- /dev/null +++ b/src/tests/filesys/extended/dir-rm-cwd-persistence.ck @@ -0,0 +1,8 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +my ($cwd_removable) = read_text_file ("tests/filesys/extended/can-rmdir-cwd"); +$cwd_removable eq 'YES' || $cwd_removable eq 'NO' or die; +check_archive ($cwd_removable eq 'YES' ? {} : {"a" => {}}); +pass; diff --git a/src/tests/filesys/extended/dir-rm-cwd.ck b/src/tests/filesys/extended/dir-rm-cwd.ck index 8821f0d..6fa4739 100644 --- a/src/tests/filesys/extended/dir-rm-cwd.ck +++ b/src/tests/filesys/extended/dir-rm-cwd.ck @@ -44,6 +44,8 @@ EOF (dir-rm-cwd) verify "/a" is empty (dir-rm-cwd) end EOF - -check_archive ($cwd_removable eq 'YES' ? {} : {"a" => {}}); +open (CAN_RMDIR_CWD, ">tests/filesys/extended/can-rmdir-cwd") + or die "tests/filesys/extended/can-rmdir-cwd: create: $!\n"; +print CAN_RMDIR_CWD "$cwd_removable"; +close (CAN_RMDIR_CWD); pass; diff --git a/src/tests/filesys/extended/dir-rm-parent-persistence.ck b/src/tests/filesys/extended/dir-rm-parent-persistence.ck new file mode 100644 index 0000000..f30b04a --- /dev/null +++ b/src/tests/filesys/extended/dir-rm-parent-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({"a" => {"b" => {}}}); +pass; diff --git a/src/tests/filesys/extended/dir-rm-parent.ck b/src/tests/filesys/extended/dir-rm-parent.ck index acbacc1..9fea8f2 100644 --- a/src/tests/filesys/extended/dir-rm-parent.ck +++ b/src/tests/filesys/extended/dir-rm-parent.ck @@ -11,5 +11,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-rm-parent) remove "/a" (must fail) (dir-rm-parent) end EOF -check_archive ({"a" => {"b" => {}}}); pass; diff --git a/src/tests/filesys/extended/dir-rm-root-persistence.ck b/src/tests/filesys/extended/dir-rm-root-persistence.ck new file mode 100644 index 0000000..6315107 --- /dev/null +++ b/src/tests/filesys/extended/dir-rm-root-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({"a" => ["\0" x 243]}); +pass; diff --git a/src/tests/filesys/extended/dir-rm-root.ck b/src/tests/filesys/extended/dir-rm-root.ck index b203cc6..8a69ff3 100644 --- a/src/tests/filesys/extended/dir-rm-root.ck +++ b/src/tests/filesys/extended/dir-rm-root.ck @@ -8,5 +8,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-rm-root) create "/a" (dir-rm-root) end EOF -check_archive ({"a" => ["\0" x 243]}); pass; diff --git a/src/tests/filesys/extended/dir-rm-tree-persistence.ck b/src/tests/filesys/extended/dir-rm-tree-persistence.ck new file mode 100644 index 0000000..562c451 --- /dev/null +++ b/src/tests/filesys/extended/dir-rm-tree-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({}); +pass; diff --git a/src/tests/filesys/extended/dir-rm-tree.ck b/src/tests/filesys/extended/dir-rm-tree.ck index 7e3ae6e..587b493 100644 --- a/src/tests/filesys/extended/dir-rm-tree.ck +++ b/src/tests/filesys/extended/dir-rm-tree.ck @@ -11,5 +11,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-rm-tree) open "/3/0/2/0" (must return -1) (dir-rm-tree) end EOF -check_archive ({}); pass; diff --git a/src/tests/filesys/extended/dir-rmdir-persistence.ck b/src/tests/filesys/extended/dir-rmdir-persistence.ck new file mode 100644 index 0000000..562c451 --- /dev/null +++ b/src/tests/filesys/extended/dir-rmdir-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({}); +pass; diff --git a/src/tests/filesys/extended/dir-rmdir.ck b/src/tests/filesys/extended/dir-rmdir.ck index e1c8916..e0d8922 100644 --- a/src/tests/filesys/extended/dir-rmdir.ck +++ b/src/tests/filesys/extended/dir-rmdir.ck @@ -9,5 +9,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-rmdir) chdir "a" (must return false) (dir-rmdir) end EOF -check_archive ({}); pass; diff --git a/src/tests/filesys/extended/dir-under-file-persistence.ck b/src/tests/filesys/extended/dir-under-file-persistence.ck new file mode 100644 index 0000000..67ca528 --- /dev/null +++ b/src/tests/filesys/extended/dir-under-file-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({"abc" => ['']}); +pass; diff --git a/src/tests/filesys/extended/dir-under-file.ck b/src/tests/filesys/extended/dir-under-file.ck index 8123d19..cce23b4 100644 --- a/src/tests/filesys/extended/dir-under-file.ck +++ b/src/tests/filesys/extended/dir-under-file.ck @@ -8,5 +8,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-under-file) mkdir "abc" (must return false) (dir-under-file) end EOF -check_archive ({"abc" => ['']}); pass; diff --git a/src/tests/filesys/extended/dir-vine-persistence.ck b/src/tests/filesys/extended/dir-vine-persistence.ck new file mode 100644 index 0000000..698ef01 --- /dev/null +++ b/src/tests/filesys/extended/dir-vine-persistence.ck @@ -0,0 +1,37 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +# The archive should look like this: +# +# 40642 dir-vine +# 42479 tar +# 0 start +# 11 start/file0 +# 0 start/dir0 +# 11 start/dir0/file1 +# 0 start/dir0/dir1 +# 11 start/dir0/dir1/file2 +# 0 start/dir0/dir1/dir2 +# 11 start/dir0/dir1/dir2/file3 +# 0 start/dir0/dir1/dir2/dir3 +# 11 start/dir0/dir1/dir2/dir3/file4 +# 0 start/dir0/dir1/dir2/dir3/dir4 +# 11 start/dir0/dir1/dir2/dir3/dir4/file5 +# 0 start/dir0/dir1/dir2/dir3/dir4/dir5 +# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/file6 +# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6 +# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/file7 +# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7 +# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file8 +# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8 +# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file9 +# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9 +my ($dir) = {}; +my ($root) = {"start" => $dir}; +for (my ($i) = 0; $i < 10; $i++) { + $dir->{"file$i"} = ["contents $i\n"]; + $dir = $dir->{"dir$i"} = {}; +} +check_archive ($root); +pass; diff --git a/src/tests/filesys/extended/dir-vine.ck b/src/tests/filesys/extended/dir-vine.ck index 42754f9..db452b0 100644 --- a/src/tests/filesys/extended/dir-vine.ck +++ b/src/tests/filesys/extended/dir-vine.ck @@ -8,37 +8,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (dir-vine) removing all but top 10 levels of files and directories... (dir-vine) end EOF - -# The archive should look like this: -# -# 40642 dir-vine -# 42479 tar -# 0 start -# 11 start/file0 -# 0 start/dir0 -# 11 start/dir0/file1 -# 0 start/dir0/dir1 -# 11 start/dir0/dir1/file2 -# 0 start/dir0/dir1/dir2 -# 11 start/dir0/dir1/dir2/file3 -# 0 start/dir0/dir1/dir2/dir3 -# 11 start/dir0/dir1/dir2/dir3/file4 -# 0 start/dir0/dir1/dir2/dir3/dir4 -# 11 start/dir0/dir1/dir2/dir3/dir4/file5 -# 0 start/dir0/dir1/dir2/dir3/dir4/dir5 -# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/file6 -# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6 -# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/file7 -# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7 -# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file8 -# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8 -# 11 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file9 -# 0 start/dir0/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9 -my ($dir) = {}; -my ($root) = {"start" => $dir}; -for (my ($i) = 0; $i < 10; $i++) { - $dir->{"file$i"} = ["contents $i\n"]; - $dir = $dir->{"dir$i"} = {}; -} -check_archive ($root); pass; diff --git a/src/tests/filesys/extended/grow-create-persistence.ck b/src/tests/filesys/extended/grow-create-persistence.ck new file mode 100644 index 0000000..bbcb24f --- /dev/null +++ b/src/tests/filesys/extended/grow-create-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({"blargle" => ['']}); +pass; diff --git a/src/tests/filesys/extended/grow-create.ck b/src/tests/filesys/extended/grow-create.ck index c20ca4c..b2e69d1 100644 --- a/src/tests/filesys/extended/grow-create.ck +++ b/src/tests/filesys/extended/grow-create.ck @@ -10,5 +10,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-create) close "blargle" (grow-create) end EOF -check_archive ({"blargle" => ['']}); pass; diff --git a/src/tests/filesys/extended/grow-dir-lg-persistence.ck b/src/tests/filesys/extended/grow-dir-lg-persistence.ck new file mode 100644 index 0000000..989a322 --- /dev/null +++ b/src/tests/filesys/extended/grow-dir-lg-persistence.ck @@ -0,0 +1,9 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +my ($fs); +$fs->{'x'}{"file$_"} = [random_bytes (512)] foreach 0...49; +check_archive ($fs); +pass; diff --git a/src/tests/filesys/extended/grow-dir-lg.ck b/src/tests/filesys/extended/grow-dir-lg.ck index 635e1be..ec58bd3 100644 --- a/src/tests/filesys/extended/grow-dir-lg.ck +++ b/src/tests/filesys/extended/grow-dir-lg.ck @@ -58,7 +58,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-dir-lg) creating and checking "/x/file49" (grow-dir-lg) end EOF -my ($fs); -$fs->{'x'}{"file$_"} = [random_bytes (512)] foreach 0...49; -check_archive ($fs); pass; diff --git a/src/tests/filesys/extended/grow-file-size-persistence.ck b/src/tests/filesys/extended/grow-file-size-persistence.ck new file mode 100644 index 0000000..150f383 --- /dev/null +++ b/src/tests/filesys/extended/grow-file-size-persistence.ck @@ -0,0 +1,7 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +check_archive ({"testfile" => [random_bytes (2134)]}); +pass; diff --git a/src/tests/filesys/extended/grow-file-size.ck b/src/tests/filesys/extended/grow-file-size.ck index 057bb2e..d81feff 100644 --- a/src/tests/filesys/extended/grow-file-size.ck +++ b/src/tests/filesys/extended/grow-file-size.ck @@ -14,6 +14,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-file-size) close "testfile" (grow-file-size) end EOF -my ($string); -check_archive ({"testfile" => [random_bytes (2134)]}); pass; diff --git a/src/tests/filesys/extended/grow-root-lg-persistence.ck b/src/tests/filesys/extended/grow-root-lg-persistence.ck new file mode 100644 index 0000000..1692f46 --- /dev/null +++ b/src/tests/filesys/extended/grow-root-lg-persistence.ck @@ -0,0 +1,9 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +my ($fs); +$fs->{"file$_"} = [random_bytes (512)] foreach 0...49; +check_archive ($fs); +pass; diff --git a/src/tests/filesys/extended/grow-root-lg.ck b/src/tests/filesys/extended/grow-root-lg.ck index 2affddd..b174bc9 100644 --- a/src/tests/filesys/extended/grow-root-lg.ck +++ b/src/tests/filesys/extended/grow-root-lg.ck @@ -57,7 +57,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-root-lg) creating and checking "file49" (grow-root-lg) end EOF -my ($fs); -$fs->{"file$_"} = [random_bytes (512)] foreach 0...49; -check_archive ($fs); pass; diff --git a/src/tests/filesys/extended/grow-root-sm-persistence.ck b/src/tests/filesys/extended/grow-root-sm-persistence.ck new file mode 100644 index 0000000..2b0b8ab --- /dev/null +++ b/src/tests/filesys/extended/grow-root-sm-persistence.ck @@ -0,0 +1,9 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +my ($fs); +$fs->{"file$_"} = [random_bytes (512)] foreach 0...19; +check_archive ($fs); +pass; diff --git a/src/tests/filesys/extended/grow-root-sm.ck b/src/tests/filesys/extended/grow-root-sm.ck index 8eb59e4..1aac7e9 100644 --- a/src/tests/filesys/extended/grow-root-sm.ck +++ b/src/tests/filesys/extended/grow-root-sm.ck @@ -27,7 +27,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-root-sm) creating and checking "file19" (grow-root-sm) end EOF -my ($fs); -$fs->{"file$_"} = [random_bytes (512)] foreach 0...19; -check_archive ($fs); pass; diff --git a/src/tests/filesys/extended/grow-seq-lg-persistence.ck b/src/tests/filesys/extended/grow-seq-lg-persistence.ck new file mode 100644 index 0000000..41aaae0 --- /dev/null +++ b/src/tests/filesys/extended/grow-seq-lg-persistence.ck @@ -0,0 +1,7 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +check_archive ({"testme" => [random_bytes (72943)]}); +pass; diff --git a/src/tests/filesys/extended/grow-seq-lg.ck b/src/tests/filesys/extended/grow-seq-lg.ck index 6276c79..90fcd8c 100644 --- a/src/tests/filesys/extended/grow-seq-lg.ck +++ b/src/tests/filesys/extended/grow-seq-lg.ck @@ -14,5 +14,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-seq-lg) close "testme" (grow-seq-lg) end EOF -check_archive ({"testme" => [random_bytes (72943)]}); pass; diff --git a/src/tests/filesys/extended/grow-seq-sm-persistence.ck b/src/tests/filesys/extended/grow-seq-sm-persistence.ck new file mode 100644 index 0000000..6cb0bd8 --- /dev/null +++ b/src/tests/filesys/extended/grow-seq-sm-persistence.ck @@ -0,0 +1,7 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +check_archive ({"testme" => [random_bytes (5678)]}); +pass; diff --git a/src/tests/filesys/extended/grow-seq-sm.ck b/src/tests/filesys/extended/grow-seq-sm.ck index 8dd2c26..5cf4518 100644 --- a/src/tests/filesys/extended/grow-seq-sm.ck +++ b/src/tests/filesys/extended/grow-seq-sm.ck @@ -14,5 +14,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-seq-sm) close "testme" (grow-seq-sm) end EOF -check_archive ({"testme" => [random_bytes (5678)]}); pass; diff --git a/src/tests/filesys/extended/grow-sparse-persistence.ck b/src/tests/filesys/extended/grow-sparse-persistence.ck new file mode 100644 index 0000000..3f06a5b --- /dev/null +++ b/src/tests/filesys/extended/grow-sparse-persistence.ck @@ -0,0 +1,6 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +check_archive ({"testfile" => ["\0" x 76543]}); +pass; diff --git a/src/tests/filesys/extended/grow-sparse.ck b/src/tests/filesys/extended/grow-sparse.ck index 9c6315f..379ba2c 100644 --- a/src/tests/filesys/extended/grow-sparse.ck +++ b/src/tests/filesys/extended/grow-sparse.ck @@ -14,5 +14,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-sparse) close "testfile" (grow-sparse) end EOF -check_archive ({"testfile" => ["\0" x 76543]}); pass; diff --git a/src/tests/filesys/extended/grow-tell-persistence.ck b/src/tests/filesys/extended/grow-tell-persistence.ck new file mode 100644 index 0000000..d93a422 --- /dev/null +++ b/src/tests/filesys/extended/grow-tell-persistence.ck @@ -0,0 +1,7 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +check_archive ({"foobar" => [random_bytes (2134)]}); +pass; diff --git a/src/tests/filesys/extended/grow-tell.ck b/src/tests/filesys/extended/grow-tell.ck index cd03efb..fe94707 100644 --- a/src/tests/filesys/extended/grow-tell.ck +++ b/src/tests/filesys/extended/grow-tell.ck @@ -14,5 +14,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-tell) close "foobar" (grow-tell) end EOF -check_archive ({"foobar" => [random_bytes (2134)]}); pass; diff --git a/src/tests/filesys/extended/grow-two-files-persistence.ck b/src/tests/filesys/extended/grow-two-files-persistence.ck new file mode 100644 index 0000000..1c4ced1 --- /dev/null +++ b/src/tests/filesys/extended/grow-two-files-persistence.ck @@ -0,0 +1,9 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +my ($a) = random_bytes (8143); +my ($b) = random_bytes (8143); +check_archive ({"a" => [$a], "b" => [$b]}); +pass; diff --git a/src/tests/filesys/extended/grow-two-files.ck b/src/tests/filesys/extended/grow-two-files.ck index b238d80..b5e754a 100644 --- a/src/tests/filesys/extended/grow-two-files.ck +++ b/src/tests/filesys/extended/grow-two-files.ck @@ -20,7 +20,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (grow-two-files) close "b" (grow-two-files) end EOF -my ($a) = random_bytes (8143); -my ($b) = random_bytes (8143); -check_archive ({"a" => [$a], "b" => [$b]}); pass; diff --git a/src/tests/filesys/extended/syn-rw-persistence.ck b/src/tests/filesys/extended/syn-rw-persistence.ck new file mode 100644 index 0000000..62d57ee --- /dev/null +++ b/src/tests/filesys/extended/syn-rw-persistence.ck @@ -0,0 +1,8 @@ +# -*- perl -*- +use strict; +use warnings; +use tests::tests; +use tests::random; +check_archive ({"child-syn-rw" => "tests/filesys/extended/child-syn-rw", + "logfile" => [random_bytes (8 * 512)]}); +pass; diff --git a/src/tests/filesys/extended/syn-rw.ck b/src/tests/filesys/extended/syn-rw.ck index 7a70299..ac82aa8 100644 --- a/src/tests/filesys/extended/syn-rw.ck +++ b/src/tests/filesys/extended/syn-rw.ck @@ -17,6 +17,4 @@ check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); (syn-rw) wait for child 4 of 4 returned 3 (expected 3) (syn-rw) end EOF -check_archive ({"child-syn-rw" => "tests/filesys/extended/child-syn-rw", - "logfile" => [random_bytes (8 * 512)]}); pass; diff --git a/src/tests/tests.pm b/src/tests/tests.pm index b120666..0cc6c7a 100644 --- a/src/tests/tests.pm +++ b/src/tests/tests.pm @@ -10,6 +10,15 @@ sub pass; die if @ARGV != 2; our ($test, $src_dir) = @ARGV; +our (@prereq_tests) = (); +if ($test =~ /^(.*)-persistence$/) { + push (@prereq_tests, $1); +} +for my $prereq_test (@prereq_tests) { + my (@result) = read_text_file ("$prereq_test.result"); + fail "Prerequisite test $prereq_test failed.\n" if $result[0] ne 'PASS'; +} + my ($msg_file) = tempfile (); select ($msg_file); @@ -235,7 +244,8 @@ sub compare_output { # recursively. sub check_archive { my ($expected_hier) = @_; - my (@output) = read_text_file ("$test.get-output"); + + my (@output) = read_text_file ("$test.output"); common_checks ("file system extraction run", @output); @output = get_core_output ("file system extraction run", @output); @@ -244,11 +254,12 @@ sub check_archive { my ($test_base_name) = $test; $test_base_name =~ s%.*/%%; - $expected_hier->{$test_base_name} = $test; + $test_base_name =~ s%-persistence$%%; + $expected_hier->{$test_base_name} = $prereq_tests[0]; $expected_hier->{'tar'} = 'tests/filesys/extended/tar'; my (%expected) = normalize_fs (flatten_hierarchy ($expected_hier, "")); - my (%actual) = read_tar ("$test.tar"); + my (%actual) = read_tar ("$prereq_tests[0].tar"); my ($errors) = 0; foreach my $name (sort keys %expected) { @@ -273,7 +284,7 @@ sub check_archive { my ($esc_name) = $name; $esc_name =~ s/[^[:print:]]/./g; print <