aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/runner/cleanup.test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-11-01 17:25:14 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:37 +0200
commit675d243e0ddeb627c0881b03e7cd5be746a5a7d3 (patch)
tree05c72dbf5f6ef152f2954f624d836a85749cb3f7 /tests/test/script/runner/cleanup.test
parent4a4e5ad3c50619ad7653b01b562af9794c97aa80 (diff)
Add support for cleanup types to testscript runner
Diffstat (limited to 'tests/test/script/runner/cleanup.test')
-rw-r--r--tests/test/script/runner/cleanup.test97
1 files changed, 56 insertions, 41 deletions
diff --git a/tests/test/script/runner/cleanup.test b/tests/test/script/runner/cleanup.test
index 200beb9..599bb5c 100644
--- a/tests/test/script/runner/cleanup.test
+++ b/tests/test/script/runner/cleanup.test
@@ -11,56 +11,58 @@ using test
EOI
b = $build.driver -q --no-column --buildfile - <"./: test{testscript}" \
- &test/*** test
+ &?test/*** test
c = cat >>>testscript
# Valid cleanups.
#
# @@ TODO: $c <"$* -f a &a" && $b
#
-: file
+: file-always
:
$c <"$* -f a &a";
$b
-: dir1
+: file-maybe
:
-$c <"$* -d a &a/";
+$c <"$* &?a";
$b
-: dir2
+: file-never
:
-$c <"$* -d a/b &a/ &a/b/";
+$c <"$* &!a";
$b
-: file-dir
+: dir-always
:
-$c <"$* -d a/b -f a/b/c &a/ &a/b/ &a/b/c";
+$c <"$* -d a &a/";
$b
-: wildcard1
+: dir-maybe
:
-$c <"$* -d a/b -f a/b/c &a/***";
+$c <"$* &?a/";
$b
-: wildcard2
+: wildcard-always
:
-$c <"$* &a/***";
+$c <"$* -d a/b -f a/b/c &a/***";
$b
-: file-dup
+: wildcard-maybe
:
-$c <"$* -f a &a &a";
+$c <"$* &?a/***";
$b
-: dir-dup
+: order
+: Test that cleanup is performed in registration reversed order
:
-$c <"$* -d a/b &a/ &a/b/ &a/b/../b/";
+$c <"$* -d a/b &a/ &a/b/";
$b
# Invalid cleanups.
#
: file-not-exists
+: Test cleanup of non-existing file
:
$c <"$* &a";
$b 2>>EOE != 0
@@ -68,13 +70,23 @@ testscript:1: error: registered for cleanup file test/1/a does not exist
EOE
: file-out-wd
+: Test cleanup of file out of working directory
:
$c <"$* &../a";
$b 2>>EOE != 0
testscript:1: error: registered for cleanup file test/a is out of working directory test/1/
EOE
+: not-file
+: Test cleanup of directory as a file
+:
+$c <"$* -d a &a";
+$b 2>>EOE != 0
+error: unable to remove file test/1/a: Is a directory
+EOE
+
: dir-not-exists
+: Test cleanup of non-existing directory
:
$c <"$* &a/";
$b 2>>EOE != 0
@@ -82,57 +94,60 @@ testscript:1: error: registered for cleanup directory test/1/a/ does not exist
EOE
: dir-out-wd
+: Test cleanup of directory out of working directory
:
$c <"$* &../a/";
$b 2>>EOE != 0
testscript:1: error: registered for cleanup directory test/a/ is out of working directory test/1/
EOE
-: dir-not-empty1
-:
-$c <"$* -d a/b -f a/b/c";
-$b 2>>EOE != 0
-testscript:1: error: registered for cleanup directory test/1/ is not empty
-EOE
-
-: dir-not-empty2
+: dir-not-empty
+: Test cleanup of non-empty directory
:
-$c <"$* -d a/b &a/b/";
+$c <"$* -d a -f a/b &a/";
$b 2>>EOE != 0
-testscript:1: error: registered for cleanup directory test/1/ is not empty
+testscript:1: error: registered for cleanup directory test/1/a/ is not empty
EOE
-: dir-not-empty3
+: not-dir
+: Test cleanup of file as a directory
:
-$c <"$* -d a/b &a/b/ &a/";
+$c <"$* -f a &a/";
$b 2>>EOE != 0
-testscript:1: error: registered for cleanup directory test/1/a/ is not empty
+error: unable to remove directory test/1/a/: Not a directory
EOE
-: dir-not-empty4
+: wildcard-not-exists
+: Test cleanup of wildcard not matching any directory
:
-$c <"$* -f a &a/***";
+$c <"$* &a/***";
$b 2>>EOE != 0
-testscript:1: error: registered for cleanup directory test/1/ is not empty
+testscript:1: error: registered for cleanup wildcard test/1/a/*** doesn't match a directory
EOE
-: not-file
+: wildcard-out-wd
+: Test cleanup of wildcard out of working directory
:
-$c <"$* -d a &a";
+$c <"$* &../a/***";
$b 2>>EOE != 0
-error: unable to remove file test/1/a: Is a directory
+testscript:1: error: registered for cleanup wildcard test/a/*** is out of working directory test/1/
EOE
-: not-dir1
+: implicit-overwrite
+: Test implicit cleanup being overwritten with an explicit one
:
-$c <"$* -f a &a/";
+$c <"$* -o foo >>>a &!a";
$b 2>>EOE != 0
-error: unable to remove directory test/1/a/: Not a directory
+testscript:1: error: registered for cleanup directory test/1/ is not empty
EOE
-: wildcard-out-wd
+: explicit-overwrite
+: Test explicit cleanup not being overwritten with an implicit one
:
-$c <"$* &../a/***";
+$c <<EOO;
+$* &!a;
+$* -o foo >>>a
+EOO
$b 2>>EOE != 0
-testscript:1: error: registered for cleanup wildcard test/a/*** is out of working directory test/1/
+testscript:2: error: registered for cleanup directory test/1/ is not empty
EOE