aboutsummaryrefslogtreecommitdiff
path: root/mesontest.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-02-19 02:17:45 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2017-02-19 11:39:27 -0500
commit07c3d35d4bb97ece054decd2a3ecc40c42fd06f6 (patch)
tree6ef8842341bb23698767c0dc3cb75a8b43033f1b /mesontest.py
parent5ee92d5bb0c9ad6b6b5bf4b8847d8533dea24c77 (diff)
downloadmeson-07c3d35d4bb97ece054decd2a3ecc40c42fd06f6.zip
meson-07c3d35d4bb97ece054decd2a3ecc40c42fd06f6.tar.gz
meson-07c3d35d4bb97ece054decd2a3ecc40c42fd06f6.tar.bz2
mesontest: Set MALLOC_PERTURB_ to a random value
This is useful enough that we can enable this for everyone. If people really don't want this, they can pass MALLOC_PERTURB_=0 in the environment or in the test.
Diffstat (limited to 'mesontest.py')
-rwxr-xr-xmesontest.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mesontest.py b/mesontest.py
index f5da103..3545ed8 100755
--- a/mesontest.py
+++ b/mesontest.py
@@ -25,6 +25,7 @@ import time, datetime, multiprocessing, json
import concurrent.futures as conc
import platform
import signal
+import random
# GNU autotools interprets a return code of 77 from tests it executes to
# mean that the test should be skipped.
@@ -221,6 +222,14 @@ class TestHarness:
if len(test.extra_paths) > 0:
child_env['PATH'] += ';'.join([''] + test.extra_paths)
+ # If MALLOC_PERTURB_ is not set, or if it is set to an empty value,
+ # (i.e., the test or the environment don't explicitly set it), set
+ # it ourselves. We do this unconditionally because it is extremely
+ # useful to have in tests.
+ # Setting MALLOC_PERTURB_="0" will completely disable this feature.
+ if 'MALLOC_PERTURB_' not in child_env or not child_env['MALLOC_PERTURB_']:
+ child_env['MALLOC_PERTURB_'] = str(random.randint(1, 255))
+
setsid = None
stdout = None
stderr = None