From 675d243e0ddeb627c0881b03e7cd5be746a5a7d3 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 1 Nov 2016 17:25:14 +0300 Subject: Add support for cleanup types to testscript runner --- tests/test/script/runner/cleanup.test | 97 ++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 41 deletions(-) (limited to 'tests') 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 <>>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 -- cgit v1.1