Commit 0f6d2e5202 for openssl.org
commit 0f6d2e5202c4033e9d82f928050bd9101332bd5a
Author: Neil Horman <nhorman@openssl.org>
Date: Thu Jan 15 13:27:34 2026 -0500
Exclude some tests from valgrind
Some tests (liek the mem_alloc and abort tests do things with malloc
intentionally as sanity checks that valgrind complains about, and so we
just shouldn't run those tests under valgrind at all
Reviewed-by: Saša NedvÄ›dický <sashan@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jan 29 16:37:30 2026
(Merged from https://github.com/openssl/openssl/pull/29573)
diff --git a/test/recipes/01-test_abort.t b/test/recipes/01-test_abort.t
index f7e066bd47..55c8c27be2 100644
--- a/test/recipes/01-test_abort.t
+++ b/test/recipes/01-test_abort.t
@@ -8,9 +8,14 @@
use OpenSSL::Test;
+use OpenSSL::Test::Utils;
+use OpenSSL::Test::Simple;
setup("test_abort");
+plan skip_all => "This test should not be run under valgrind"
+ if ( defined $ENV{OSSL_USE_VALGRIND} );
+
plan tests => 1;
is(run(test(["aborttest"])), 0, "Testing that abort is caught correctly");
diff --git a/test/recipes/02-test_mem_alloc.t b/test/recipes/02-test_mem_alloc.t
index 89a3eceeb7..99b9c15840 100644
--- a/test/recipes/02-test_mem_alloc.t
+++ b/test/recipes/02-test_mem_alloc.t
@@ -6,8 +6,13 @@
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
+use OpenSSL::Test;
+use OpenSSL::Test::Utils;
use OpenSSL::Test::Simple;
+plan skip_all => "This test should not be run under valgrind"
+ if ( defined $ENV{OSSL_USE_VALGRIND} );
+
{
local $ENV{"ASAN_OPTIONS"} = "allocator_may_return_null=true";
local $ENV{"MSAN_OPTIONS"} = "allocator_may_return_null=true";
diff --git a/test/recipes/02-test_mem_alloc_custom_fns.t b/test/recipes/02-test_mem_alloc_custom_fns.t
index 06667f0d64..edff4057a8 100644
--- a/test/recipes/02-test_mem_alloc_custom_fns.t
+++ b/test/recipes/02-test_mem_alloc_custom_fns.t
@@ -6,8 +6,13 @@
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
+use OpenSSL::Test;
+use OpenSSL::Test::Utils;
use OpenSSL::Test::Simple;
+plan skip_all => "This test should not be run under valgrind"
+ if ( defined $ENV{OSSL_USE_VALGRIND} );
+
{
local $ENV{"ASAN_OPTIONS"} = "allocator_may_return_null=true";
local $ENV{"MSAN_OPTIONS"} = "allocator_may_return_null=true";
diff --git a/test/recipes/90-test_memleak.t b/test/recipes/90-test_memleak.t
index 76f1dcb06d..38d45c9f0f 100644
--- a/test/recipes/90-test_memleak.t
+++ b/test/recipes/90-test_memleak.t
@@ -8,9 +8,13 @@
use OpenSSL::Test;
+use OpenSSL::Test::Utils;
setup("test_memleak");
+plan skip_all => "This test should not be run under valgrind"
+ if (defined ($ENV{OSSL_USE_VALGRIND}));
+
plan skip_all => "MacOS currently doesn't support leak sanitizer"
if $^O eq 'darwin';
diff --git a/test/recipes/90-test_threads.t b/test/recipes/90-test_threads.t
index 8033ad10c6..048b46e1c5 100644
--- a/test/recipes/90-test_threads.t
+++ b/test/recipes/90-test_threads.t
@@ -23,6 +23,9 @@ my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
my $config_path = abs_path(srctop_file("test", $no_fips ? "default.cnf"
: "default-and-fips.cnf"));
+plan skip_all => "This test should not be run under valgrind"
+ if (defined $ENV{OSSL_USE_VALGRIND});
+
plan tests => 3;
if ($no_fips) {