From 66563ae897a3ac48991240fd0c36c3cb9964432c Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flow@cs.fau.de>
Date: Mon, 16 Nov 2020 10:47:36 +0100
Subject: [PATCH] [test] Set glibc's MALLOC_PERTURB to a known value

Otherwise meson will use a random value.
---
 tests/meson.build | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/meson.build b/tests/meson.build
index a02648e4..b7d3ddce 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -34,6 +34,14 @@ tests = {
 
 undef_ndebug = '-UNDEBUG'
 test_dep = [thread_dep]
+test_env = environment(
+  {
+	# Set glibc's MALLOC_PERTURB to 1. This means that newly allocated
+	# memory will be initialized with 0x01, and that free'ed memory
+	# will be set to 0xFE (I think).
+	'MALLOC_PERTURB_': '1',
+  }
+)
 
 foreach source, test_dict : tests
   # TODO: Use meson fs (filesystem) module once meson >= 0.53 is in
@@ -55,6 +63,7 @@ foreach source, test_dict : tests
 	   test_exe,
 	   is_parallel: test_dict.get('is_parallel', true),
 	   suite: test_dict.get('test_suite', 'all'),
-	   timeout: 60
+	   timeout: 60,
+	   env: test_env,
 	  )
 endforeach
-- 
GitLab