aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authors.txt1
-rw-r--r--mesonbuild/environment.py13
-rwxr-xr-xmesontest.py9
3 files changed, 18 insertions, 5 deletions
diff --git a/authors.txt b/authors.txt
index 2f36256..a5f3d46 100644
--- a/authors.txt
+++ b/authors.txt
@@ -63,3 +63,4 @@ Kseniia Vasilchuk
Philipp Geier
Mike Sinkovsky
Dima Krasner
+Fabio Porcedda
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 51a3d43..13b38d5 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -19,6 +19,7 @@ from . import mlog
from .compilers import *
from .mesonlib import EnvironmentException, Popen_safe
import configparser
+import shlex
import shutil
build_filename = 'meson.build'
@@ -369,7 +370,9 @@ class Environment:
def detect_c_compiler(self, want_cross):
evar = 'CC'
if self.is_cross_build() and want_cross:
- compilers = [self.cross_info.config['binaries']['c']]
+ compilers = self.cross_info.config['binaries']['c']
+ if not isinstance(compilers, list):
+ compilers = [compilers]
ccache = []
is_cross = True
if self.cross_info.need_exe_wrapper():
@@ -377,7 +380,7 @@ class Environment:
else:
exe_wrap = []
elif evar in os.environ:
- compilers = os.environ[evar].split()
+ compilers = shlex.split(os.environ[evar])
ccache = []
is_cross = False
exe_wrap = None
@@ -406,13 +409,13 @@ class Environment:
continue
gtype = self.get_gnu_compiler_type(defines)
version = self.get_gnu_version_from_defines(defines)
- return GnuCCompiler(ccache + [compiler], version, gtype, is_cross, exe_wrap, defines)
+ return GnuCCompiler(ccache + compilers, version, gtype, is_cross, exe_wrap, defines)
if 'clang' in out:
if 'Apple' in out or for_darwin(want_cross, self):
cltype = CLANG_OSX
else:
cltype = CLANG_STANDARD
- return ClangCCompiler(ccache + [compiler], version, cltype, is_cross, exe_wrap)
+ return ClangCCompiler(ccache + compilers, version, cltype, is_cross, exe_wrap)
if 'Microsoft' in out or 'Microsoft' in err:
# Visual Studio prints version number to stderr but
# everything else to stdout. Why? Lord only knows.
@@ -421,7 +424,7 @@ class Environment:
if '(ICC)' in out:
# TODO: add microsoft add check OSX
inteltype = ICC_STANDARD
- return IntelCCompiler(ccache + [compiler], version, inteltype, is_cross, exe_wrap)
+ return IntelCCompiler(ccache + compilers, version, inteltype, is_cross, exe_wrap)
errmsg = 'Unknown compiler(s): "' + ', '.join(compilers) + '"'
if popen_exceptions:
errmsg += '\nThe follow exceptions were encountered:'
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