summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-12-07 16:14:40 +0000
committerPádraig Brady <P@draigBrady.com>2013-12-07 19:12:55 +0000
commit47a977ca99ad90f6fbe2efe84a17ac382a84ebf1 (patch)
tree737226e0c448d90a12d3c158ede7bdcbe7dde8f2 /tests
parentb4f5dca24f3ca2eea6060cff9695d746c125747b (diff)
downloadcoreutils-47a977ca99ad90f6fbe2efe84a17ac382a84ebf1.tar.xz
tests: avoid a false memory leak test failure
* tests/misc/shuf-reservoir.sh: Restrict the valgrind "exit on leak" behavior to developer environments where specific "lint" code is enabled to avoid inconsequential leaks.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/shuf-reservoir.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/misc/shuf-reservoir.sh b/tests/misc/shuf-reservoir.sh
index e971c594e..bf682290c 100755
--- a/tests/misc/shuf-reservoir.sh
+++ b/tests/misc/shuf-reservoir.sh
@@ -24,6 +24,10 @@ print_ver_ shuf
expensive_
require_valgrind_
+# Only exit with error for leaks when in development mode
+# in which case we enable code to suppress inconsequential leaks.
+grep '^#define lint 1' "$CONFIG_HEADER" && leaklevel=full || leaklevel=summary
+
# Run "shuf" with specific number of input lines and output lines
# Check the output for expected number of lines.
run_shuf_n()
@@ -32,8 +36,8 @@ run_shuf_n()
OUTPUT_LINES="$2"
# Critical memory-related bugs will cause a segfault here
- # (with varying numbres of input/output lines)
- seq "$INPUT_LINES" | valgrind --leak-check=full --error-exitcode=1 \
+ # (with varying numbers of input/output lines)
+ seq "$INPUT_LINES" | valgrind --leak-check=$leaklevel --error-exitcode=1 \
shuf -n "$OUTPUT_LINES" -o "out_${INPUT_LINES}_${OUTPUT_LINES}" || return 1
EXPECTED_LINES="$OUTPUT_LINES"