This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] tests: Tests that override EXIT (0) trap need to cleanup themselves.


On Mon, 2013-04-29 at 09:35 -0700, Roland McGrath wrote:
> Looks fine.

Thanks, pushed.

>   But separately, what the hell is the popd about?
> Scripts should never use pushd/popd.

They shouldn't? It comes from commit 86be79 "Enable automake
parallel-tests for make check."

[...] To enable this all tests are ran in their own temporary directory
so they don't stomp on each others input or output files. [...]

I dunno why I thought pushd and popd would be a good idea. A simple cd
to change the working directory instead works fine if that is better:

diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index 3ef218c..b5ab105 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -25,7 +25,7 @@ set -e
 # Each test runs in its own directory to make sure they can run in parallel.
 test_dir="test-$$"
 mkdir -p "$test_dir"
-pushd "$test_dir" > /dev/null
+cd "$test_dir"
 
 #LC_ALL=C
 #export LC_ALL
@@ -35,7 +35,7 @@ remove_files=
 # Tests that trap EXIT (0) themselves should call this explicitly.
 exit_cleanup()
 {
-  rm -f $remove_files; popd > /dev/null; rmdir $test_dir
+  rm -f $remove_files; cd ..; rmdir $test_dir
 }
 trap exit_cleanup 0



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]