summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2016-02-07 12:12:19 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2016-02-10 00:03:26 +0000
commit2c9f7ff8e77f13267519311c294eba51e5ea1b38 (patch)
treeff1a5bc7a4f3bf93e3de9ad9126caceea15d8941
parent8ea69f926b5c97af51b7ae6666b80643f5456dbd (diff)
Testsuite: Support running exim under valgrind
Fails mostly thanks to lack of suid handling, but -be tests usable if you retry after de-suid of eximdir/exim
-rw-r--r--src/src/store.c6
-rw-r--r--test/aux-fixed/valgrind.supp8
-rwxr-xr-xtest/runtest9
3 files changed, 20 insertions, 3 deletions
diff --git a/src/src/store.c b/src/src/store.c
index e402835c7..9c1d1d83f 100644
--- a/src/src/store.c
+++ b/src/src/store.c
@@ -354,7 +354,11 @@ the released memory. */
newlength = bc + b->length - (char *)ptr;
#ifndef COMPILE_UTILITY
-if (running_in_test_harness) memset(ptr, 0xF0, newlength);
+if (running_in_test_harness)
+ {
+ (void) VALGRIND_MAKE_MEM_DEFINED(ptr, newlength);
+ memset(ptr, 0xF0, newlength);
+ }
#endif
(void) VALGRIND_MAKE_MEM_NOACCESS(ptr, newlength);
yield_length[store_pool] = newlength - (newlength % alignment);
diff --git a/test/aux-fixed/valgrind.supp b/test/aux-fixed/valgrind.supp
new file mode 100644
index 000000000..5f3b8dfd4
--- /dev/null
+++ b/test/aux-fixed/valgrind.supp
@@ -0,0 +1,8 @@
+{
+ macro_whitelist
+ Memcheck:Leak
+ fun:malloc
+ fun:store_malloc_3
+ fun:macros_trusted
+ fun:main
+}
diff --git a/test/runtest b/test/runtest
index efcd3ed1c..8dcb0587c 100755
--- a/test/runtest
+++ b/test/runtest
@@ -38,6 +38,7 @@ $gnutls_dh_bits_normal = 2236;
$cf = "bin/cf -exact";
$cr = "\r";
$debug = 0;
+$flavour = 'FOO';
$force_continue = 0;
$force_update = 0;
$log_failed_filename = "failed-summary.log";
@@ -45,7 +46,7 @@ $more = "less -XF";
$optargs = "";
$save_output = 0;
$server_opts = "";
-$flavour = 'FOO';
+$valgrind = 0;
$have_ipv4 = 1;
$have_ipv6 = 1;
@@ -2149,7 +2150,10 @@ elsif (/^([A-Z_]+=\S+\s+)?(\d+)?\s*(sudo(?:\s+-u\s+(\w+))?\s+)?exim(_\S+)?\s+(.*
$args =~ s/(?:^|\s)-d\S*// if $optargs =~ /(?:^|\s)-d/;
- $cmd = "$envset$sudo$parm_cwd/eximdir/exim$special$optargs " .
+ my $opt_valgrind = $valgrind ? "valgrind --leak-check=yes --suppressions=$parm_cwd/aux-fixed/valgrind.supp " : "";
+
+ $cmd = "$envset$sudo$opt_valgrind" .
+ "$parm_cwd/eximdir/exim$special$optargs " .
"-DEXIM_PATH=$parm_cwd/eximdir/exim$special " .
"-C $parm_cwd/test-config $args " .
">>test-stdout 2>>test-stderr";
@@ -2404,6 +2408,7 @@ while (@ARGV > 0 && $ARGV[0] =~ /^-/)
if ($arg eq "-NOIPV4") { $have_ipv4 = 0; next; }
if ($arg eq "-NOIPV6") { $have_ipv6 = 0; next; }
if ($arg eq "-KEEP") { $save_output = 1; next; }
+ if ($arg eq "-VALGRIND") { $valgrind = 1; next; }
if ($arg =~ /^-FLAVOU?R$/) { $flavour = shift; next; }
}
$optargs .= " $arg";