aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2010-09-20 13:42:59 -0700
committerGravatar Carl Worth <cworth@cworth.org>2010-09-20 13:44:32 -0700
commit60c599036e528bc8a856c3312f0222cc7b1fd32a (patch)
tree53013d16b4a1d219ba59ecb351ce8e0682ca3322
parent265de5006f08a90371cc9caec0c0e6f702f42204 (diff)
test: Fix test suite so that --valgrind option works.
The output is ugly, and we need a better suppressions file, but this is at least a start.
-rwxr-xr-xtest/basic2
-rw-r--r--test/test-lib.sh13
-rw-r--r--test/valgrind/default.supp0
-rwxr-xr-xtest/valgrind/valgrind.sh22
4 files changed, 25 insertions, 12 deletions
diff --git a/test/basic b/test/basic
index 8e68ef8a..88704a17 100755
--- a/test/basic
+++ b/test/basic
@@ -52,7 +52,7 @@ test_expect_code 2 'failure to clean up causes the test to fail' '
# Ensure that all tests are being run
test_begin_subtest 'Ensure that all available tests will be run by notmuch-test'
tests_in_suite=$(grep TESTS= ../notmuch-test | sed -e "s/TESTS=\"\(.*\)\"/\1/" | tr " " "\n" | sort)
-available=$(ls -1 ../ | grep -v -E "^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test|README|test-lib.sh|test-results|tmp.*)" | sort)
+available=$(ls -1 ../ | grep -v -E "^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test|README|test-lib.sh|test-results|tmp.*|valgrind)" | sort)
test_expect_equal "$tests_in_suite" "$available"
################################################################
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 15238705..42dfde13 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -740,7 +740,6 @@ find_notmuch_path ()
# Test the binaries we have just built. The tests are kept in
# test/ subdirectory and are run in 'trash directory' subdirectory.
TEST_DIRECTORY=$(pwd)
-# FIXME: Only the normal case bellow is updated to notmuch
if test -n "$valgrind"
then
make_symlink () {
@@ -786,15 +785,12 @@ then
# override all git executables in TEST_DIRECTORY/..
GIT_VALGRIND=$TEST_DIRECTORY/valgrind
mkdir -p "$GIT_VALGRIND"/bin
- for file in $TEST_DIRECTORY/../git* $TEST_DIRECTORY/../test-*
- do
- make_valgrind_symlink $file
- done
+ make_valgrind_symlink $TEST_DIRECTORY/../notmuch
OLDIFS=$IFS
IFS=:
for path in $PATH
do
- ls "$path"/git-* 2> /dev/null |
+ ls "$path"/notmuch 2> /dev/null |
while read file
do
make_valgrind_symlink "$file"
@@ -804,11 +800,6 @@ then
PATH=$GIT_VALGRIND/bin:$PATH
GIT_EXEC_PATH=$GIT_VALGRIND/bin
export GIT_VALGRIND
-elif test -n "$GIT_TEST_INSTALLED" ; then
- GIT_EXEC_PATH=$($GIT_TEST_INSTALLED/git --exec-path) ||
- error "Cannot run git from $GIT_TEST_INSTALLED."
- PATH=$GIT_TEST_INSTALLED:$TEST_DIRECTORY/..:$PATH
- GIT_EXEC_PATH=${GIT_TEST_EXEC_PATH:-$GIT_EXEC_PATH}
else # normal case
notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
test -n "$notmuch_path" && PATH="$notmuch_path:$PATH"
diff --git a/test/valgrind/default.supp b/test/valgrind/default.supp
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/valgrind/default.supp
diff --git a/test/valgrind/valgrind.sh b/test/valgrind/valgrind.sh
new file mode 100755
index 00000000..582b4dca
--- /dev/null
+++ b/test/valgrind/valgrind.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+base=$(basename "$0")
+
+TRACK_ORIGINS=
+
+VALGRIND_VERSION=$(valgrind --version)
+VALGRIND_MAJOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*\([0-9]*\)')
+VALGRIND_MINOR=$(expr "$VALGRIND_VERSION" : '[^0-9]*[0-9]*\.\([0-9]*\)')
+test 3 -gt "$VALGRIND_MAJOR" ||
+test 3 -eq "$VALGRIND_MAJOR" -a 4 -gt "$VALGRIND_MINOR" ||
+TRACK_ORIGINS=--track-origins=yes
+
+exec valgrind -q --error-exitcode=126 \
+ --leak-check=no \
+ --suppressions="$GIT_VALGRIND/default.supp" \
+ --gen-suppressions=all \
+ $TRACK_ORIGINS \
+ --log-fd=4 \
+ --input-fd=4 \
+ $GIT_VALGRIND_OPTIONS \
+ "$GIT_VALGRIND"/../../"$base" "$@"