On Mon, 2013-04-29 at 09:35 -0700, Roland McGrath wrote:
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
@@ -25,7 +25,7 @@ set -e
# Each test runs in its own directory to make sure they can run in parallel.
mkdir -p "$test_dir"
-pushd "$test_dir" > /dev/null
@@ -35,7 +35,7 @@ remove_files=
# Tests that trap EXIT (0) themselves should call this explicitly.
- rm -f $remove_files; popd > /dev/null; rmdir $test_dir
+ rm -f $remove_files; cd ..; rmdir $test_dir
trap exit_cleanup 0