[PATCH nft 1/1] tests/shell: set valgrind's "--vgdb-prefix=" to orignal TMPDIR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


"test-wrapper.sh" sets TMPDIR="$NFT_TEST_TESTTMPDIR". That is useful, so
that temporary files of the tests are placed inside the test result

Sometimes tests miss to delete those files, which would result in piling
up /tmp/tmp.XXXXXXXXXX files. By setting $TMPDIR, those files are
clearly related to the test run that created them, and can be deleted

However, valgrind likes to create files like
"vgdb-pipe-from-vgdb-to-68-by-thom-on-???"  inside $TMPDIR. These are
pipes, so if you run `grep -R ^ /tmp/nft-test.latest` while
the test is still running (to inspect the results), then the process
hands reading from the pipe.

Instead, tell valgrind to put those files in the original TMPDIR. For
that purpose, export NFT_TEST_TMPDIR_ORIG from "run-tests.sh".

Signed-off-by: Thomas Haller <thaller@xxxxxxxxxx>
 tests/shell/helpers/nft-valgrind-wrapper.sh | 1 +
 tests/shell/run-tests.sh                    | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/tests/shell/helpers/nft-valgrind-wrapper.sh b/tests/shell/helpers/nft-valgrind-wrapper.sh
index ad8cc74bc781..6125dd0f3089 100755
--- a/tests/shell/helpers/nft-valgrind-wrapper.sh
+++ b/tests/shell/helpers/nft-valgrind-wrapper.sh
@@ -12,6 +12,7 @@ libtool \
 		--show-leak-kinds=all \
 		--num-callers=100 \
 		--error-exitcode=122 \
+		--vgdb-prefix="$NFT_TEST_TMPDIR_ORIG/vgdb-pipe-nft-test-$SUFFIX" \
 		"$NFT_REAL" \
 		"$@" \
diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index c622c1509500..5931b20e1645 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -257,6 +257,11 @@ START_TIME="$(cut -d ' ' -f1 /proc/uptime)"
+# Export the orignal TMPDIR for the tests. "test-wrapper.sh" sets TMPDIR to
+# NFT_TEST_TESTTMPDIR, so that temporary files are placed along side the
+# test data. In some cases, we may want to know the original TMPDIR.
 if [ "$NFT_TEST_HAS_REALROOT" = "" ] ; then
 	# The caller didn't set NFT_TEST_HAS_REALROOT and didn't specify
 	# -R/--without-root option. Autodetect it based on `id -u`.

[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux