public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Move empty dir testing to dwz-tests.exp
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

Currently, we test in each test-case which files are present after running
dwz, to make sure dwz doesn't leave temporary files.

Instead, test in dwz-tests.exp that each test-case leaves the test directory
empty.

Thanks,
- Tom

Move empty dir testing to dwz-tests.exp

2019-03-13  Tom de Vries  <tdevries@suse.de>

	* testsuite/dwz.tests/dwz-tests.exp: Fail test if test directory not
	empty after test run.
	* testsuite/dwz.tests/eu-strip-unstrip-multifile.sh: Remove ls test.
	* testsuite/dwz.tests/hardlink.sh: Same.
	* testsuite/dwz.tests/low-mem.sh: Same.
	* testsuite/dwz.tests/multifile-name.sh: Same.
	* testsuite/dwz.tests/multifile-relative.sh: Same.
	* testsuite/dwz.tests/multifile.sh: Same.
	* testsuite/dwz.tests/pr24174.sh: Same.
	* testsuite/dwz.tests/regular-o.sh: Same.
	* testsuite/dwz.tests/regular.sh: Same.
	* testsuite/dwz.tests/too-many-dies.sh: Same.
	* testsuite/dwz.tests/eu-strip-unstrip.sh: Same.  Fix filename typo in
	rm command.

---
 testsuite/dwz.tests/dwz-tests.exp                 | 10 ++++++++--
 testsuite/dwz.tests/eu-strip-unstrip-multifile.sh |  4 ----
 testsuite/dwz.tests/eu-strip-unstrip.sh           |  6 +-----
 testsuite/dwz.tests/hardlink.sh                   |  4 ----
 testsuite/dwz.tests/low-mem.sh                    |  2 --
 testsuite/dwz.tests/multifile-name.sh             |  4 ----
 testsuite/dwz.tests/multifile-relative.sh         |  4 ----
 testsuite/dwz.tests/multifile.sh                  |  4 ----
 testsuite/dwz.tests/pr24174.sh                    |  5 +----
 testsuite/dwz.tests/regular-o.sh                  |  4 ----
 testsuite/dwz.tests/regular.sh                    |  2 --
 testsuite/dwz.tests/too-many-dies.sh              |  2 --
 12 files changed, 10 insertions(+), 41 deletions(-)

diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp
index bea18fb..f8114d0 100644
--- a/testsuite/dwz.tests/dwz-tests.exp
+++ b/testsuite/dwz.tests/dwz-tests.exp
@@ -15,8 +15,14 @@ foreach test $tests {
 	puts "$msg"
 	fail "$test"
     } else {
-	pass "$test"
-	exec rm -Rf $dir
+	set file_list [glob -nocomplain "$dir/*"]
+	if {[llength $file_list] != 0} {
+	    puts "$dir is not empty"
+	    fail "$test"
+	} else {
+	    pass "$test"
+	    exec rm -Rf $dir
+	}
     }
     cd $pwd
 }
diff --git a/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh b/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
index ea76dcb..e489be6 100755
--- a/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
+++ b/testsuite/dwz.tests/eu-strip-unstrip-multifile.sh
@@ -19,8 +19,4 @@ smaller-than.sh 2.unstripped 2
 [ "$(gnu-debugaltlink-name.sh 1.unstripped)" = "3" ]
 [ "$(gnu-debugaltlink-name.sh 2.unstripped)" = "3" ]
 
-ls=$(ls)
-ls=$(echo $ls)
-[ "$ls" = "1 1.debug 1.stripped 1.unstripped 2 2.debug 2.stripped 2.unstripped 3" ]
-
 rm -f 1 1.debug 1.stripped 1.unstripped 2 2.debug 2.stripped 2.unstripped 3
diff --git a/testsuite/dwz.tests/eu-strip-unstrip.sh b/testsuite/dwz.tests/eu-strip-unstrip.sh
index 9ecb3fe..db85b79 100755
--- a/testsuite/dwz.tests/eu-strip-unstrip.sh
+++ b/testsuite/dwz.tests/eu-strip-unstrip.sh
@@ -12,8 +12,4 @@ eu-unstrip 1.stripped 1.debug -o 1.unstripped
 
 smaller-than.sh 1.unstripped 1
 
-ls=$(ls)
-ls=$(echo $ls)
-[ "$ls" = "1 1.debug 1.stripped 1.unstripped" ]
-
-rm -f 1 1.debugged 1.stripped 1.unstripped
+rm -f 1 1.debug 1.stripped 1.unstripped
diff --git a/testsuite/dwz.tests/hardlink.sh b/testsuite/dwz.tests/hardlink.sh
index e3213a3..6ade00c 100755
--- a/testsuite/dwz.tests/hardlink.sh
+++ b/testsuite/dwz.tests/hardlink.sh
@@ -14,8 +14,4 @@ hl="$(find -samefile 1 | sort)"
 hl="$(echo $hl)"
 [ "$hl" = "./1 ./2" ]
 
-ls=$(ls)
-ls=$(echo $ls)
-[ "$ls" = "1 2" ]
-
 rm -f 1 2
diff --git a/testsuite/dwz.tests/low-mem.sh b/testsuite/dwz.tests/low-mem.sh
index d042f7b..dfb4118 100755
--- a/testsuite/dwz.tests/low-mem.sh
+++ b/testsuite/dwz.tests/low-mem.sh
@@ -8,6 +8,4 @@ dwz -l0 1
 
 smaller-than.sh 1 ../hello
 
-[ $(ls) = "1" ]
-
 rm -f 1
diff --git a/testsuite/dwz.tests/multifile-name.sh b/testsuite/dwz.tests/multifile-name.sh
index ea4dcec..8870ef9 100755
--- a/testsuite/dwz.tests/multifile-name.sh
+++ b/testsuite/dwz.tests/multifile-name.sh
@@ -10,10 +10,6 @@ dwz -m 3 -M /xxx/yyy/3 1 2
 smaller-than.sh 1 ../hello
 smaller-than.sh 2 ../hello
 
-ls=$(ls)
-ls=$(echo $ls)
-[ "$ls" = "1 2 3" ]
-
 [ "$(gnu-debugaltlink-name.sh 1)" = "/xxx/yyy/3" ]
 [ "$(gnu-debugaltlink-name.sh 2)" = "/xxx/yyy/3" ]
 
diff --git a/testsuite/dwz.tests/multifile-relative.sh b/testsuite/dwz.tests/multifile-relative.sh
index 2fea507..f7fae82 100755
--- a/testsuite/dwz.tests/multifile-relative.sh
+++ b/testsuite/dwz.tests/multifile-relative.sh
@@ -10,10 +10,6 @@ dwz -m $(pwd -P)/3 -r 1 2
 smaller-than.sh 1 ../hello
 smaller-than.sh 2 ../hello
 
-ls=$(ls)
-ls=$(echo $ls)
-[ "$ls" = "1 2 3" ]
-
 [ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
 [ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
 
diff --git a/testsuite/dwz.tests/multifile.sh b/testsuite/dwz.tests/multifile.sh
index dde2a94..9ec43cd 100755
--- a/testsuite/dwz.tests/multifile.sh
+++ b/testsuite/dwz.tests/multifile.sh
@@ -10,10 +10,6 @@ dwz -m 3 1 2
 smaller-than.sh 1 ../hello
 smaller-than.sh 2 ../hello
 
-ls=$(ls)
-ls=$(echo $ls)
-[ "$ls" = "1 2 3" ]
-
 [ "$(gnu-debugaltlink-name.sh 1)" = "3" ]
 [ "$(gnu-debugaltlink-name.sh 2)" = "3" ]
 
diff --git a/testsuite/dwz.tests/pr24174.sh b/testsuite/dwz.tests/pr24174.sh
index e522b06..3b1a0f8 100755
--- a/testsuite/dwz.tests/pr24174.sh
+++ b/testsuite/dwz.tests/pr24174.sh
@@ -9,10 +9,7 @@ if dwz 1 2>dwz.err; status=$?; then
 fi
 
 grep "DWARF version 0 unhandled" dwz.err || true
-rm -f dwz.err
 
 [ $status -eq 1 ]
 
-[ $(ls) = "1" ]
-
-rm -f 1
+rm -f 1 dwz.err
diff --git a/testsuite/dwz.tests/regular-o.sh b/testsuite/dwz.tests/regular-o.sh
index 0a44a52..5e5600d 100755
--- a/testsuite/dwz.tests/regular-o.sh
+++ b/testsuite/dwz.tests/regular-o.sh
@@ -10,8 +10,4 @@ cmp 1 ../hello
 
 smaller-than.sh 2 1
 
-ls=$(ls)
-ls=$(echo $ls)
-[ "$ls" = "1 2" ]
-
 rm -f 1 2
diff --git a/testsuite/dwz.tests/regular.sh b/testsuite/dwz.tests/regular.sh
index 58a2b63..447b66c 100755
--- a/testsuite/dwz.tests/regular.sh
+++ b/testsuite/dwz.tests/regular.sh
@@ -8,6 +8,4 @@ dwz 1
 
 smaller-than.sh 1 ../hello
 
-[ $(ls) = "1" ]
-
 rm -f 1
diff --git a/testsuite/dwz.tests/too-many-dies.sh b/testsuite/dwz.tests/too-many-dies.sh
index 2f9e4a2..c540e2b 100755
--- a/testsuite/dwz.tests/too-many-dies.sh
+++ b/testsuite/dwz.tests/too-many-dies.sh
@@ -8,6 +8,4 @@ if dwz -L0 1 2>/dev/null; then exit 1; fi
 
 cmp 1 ../hello
 
-[ "$(ls)" = "1" ]
-
 rm -f 1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-03-13 10:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Move empty dir testing to dwz-tests.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).