summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/testctl30
-rwxr-xr-xtests/valgrind-version.sh48
3 files changed, 74 insertions, 6 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3f5ecfe..aecadba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,5 @@
SUBDIRS=test-inputs test-output-refs
-EXTRA_DIST=testctl vg.supp global-vars.sh\
+EXTRA_DIST=testctl vg.supp global-vars.sh valgrind-version.sh \
test-prop-ident.sh \
test-unknown-at-rule.sh \
test-unknown-at-rule2.sh
diff --git a/tests/testctl b/tests/testctl
index 18ec9ed..88dba5e 100755
--- a/tests/testctl
+++ b/tests/testctl
@@ -12,6 +12,7 @@
#the directory that contains the tests
HERE=`dirname $0`
+
#the list of tests to be run
TEST_PROG_LIST=
@@ -32,6 +33,10 @@ if test x$RUN_VALGRIND = x ; then
else
RUN_VALGRIND=yes
fi
+if test "x$CHECKER" = "x" ; then
+ CHECKER="valgrind --tool=memcheck"
+fi
+
VALGRIND_LOGS_DIR=valgrind-logs
VALGRIND=
TEST_PROG=
@@ -137,12 +142,27 @@ run_test_prog ()
if test x$RUN_VALGRIND = xno ; then
VALGRIND=
else
- VALGRIND=`which valgrind`
- if test x$VALGRIND = x ; then
- echo "Could not find valgrind in your path"
+ if ! test -x $HERE/valgrind-version.sh ; then
+ echo "Argh! Could not find file $HERE/valgrind-version.sh"
+ exit -1 ;
+ fi
+ version=`$HERE/valgrind-version.sh`
+ if ! test "x$version" = "xokay" ; then
+ echo "You must install a valgrind versin greater than 2.1.1"
+ echo "version=$version"
+ exit -1
+ fi
+ if test "x$CHECKER" = "x" ; then
+ VALGRIND=`which valgrind`
+ if test "x$VALGRIND" = x ; then
+ echo "Could not find valgrind in your path"
+ else
+ VALGRIND="$VALGRIND $VALGRIND_OPTIONS"
+ echo "Gonna run the tests with valgrind, using the following options: $VALGRIND_OPTIONS"
+ fi
else
- VALGRIND="$VALGRIND $VALGRIND_OPTIONS"
- echo "Gonna run the tests with valgrind, using the following options: $VALGRIND_OPTIONS"
+ VALGRIND="$CHECKER $VALGRIND_OPTIONS"
+ echo "Gonna run the tests with valgrind, using the cmd line: $VALGRIND"
fi
fi
export VALGRIND
diff --git a/tests/valgrind-version.sh b/tests/valgrind-version.sh
new file mode 100755
index 0000000..fbfd326
--- /dev/null
+++ b/tests/valgrind-version.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+valgrind=`which valgrind`
+awk=`which awk`
+if test "x$valgrind" = "x" ; then
+ echo "valgrind-not-present" ;
+ exit ;
+fi
+
+
+valgrind_version=`$valgrind --version`
+if test "x$valgrind_version" = x ; then
+ echo "not-present" ;
+ exit
+fi
+
+if test "x$awk" = x ; then
+ echo "awk-not-present"
+ exit
+fi
+
+string_version=`echo $valgrind_version | $awk -F '-' '{print $2}'`
+
+if test "x$string_version" = "x" ; then
+ echo "valgrind-version-unknown"
+ exit
+fi
+
+major=`echo $string_version | $awk -F '.' '{print $1}'`
+minor=`echo $string_version | $awk -F '.' '{print $2}'`
+micro=`echo $string_version | $awk -F '.' '{print $3}'`
+
+version=`expr $major \* 10000 + $minor \* 100 + $micro`
+
+if test "x$version" = "x" ; then
+ echo "valgrind-version-unknown"
+ exit ;
+fi
+
+if test "$version" -ge "20101" ; then
+ echo "okay"
+ exit ;
+else
+ echo "valgrind-version-lower"
+ exit ;
+fi
+
+