aboutsummaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-07-17 19:57:24 +0200
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-07-23 05:50:55 +0000
commit3b2126531a732ddd54cab2404ac1cb8b44fb49f7 (patch)
tree39e80e071e1464e7461eb78df74d69f99fe5b15e /run_project_tests.py
parente2499fab8b27547c54adb5dd501b2a7a7ddd0f0d (diff)
downloadmeson-3b2126531a732ddd54cab2404ac1cb8b44fb49f7.zip
meson-3b2126531a732ddd54cab2404ac1cb8b44fb49f7.tar.gz
meson-3b2126531a732ddd54cab2404ac1cb8b44fb49f7.tar.bz2
cmake: added test case for environment variables
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index 797e1a9..80b56bb 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -35,6 +35,7 @@ from mesonbuild import mtest
from mesonbuild.mesonlib import MachineChoice, stringlistify, Popen_safe
from mesonbuild.coredata import backendlist
import argparse
+import json
import xml.etree.ElementTree as ET
import time
import multiprocessing
@@ -348,6 +349,7 @@ def _run_test(testdir, test_build_dir, install_dir, extra_args, compiler, backen
compile_commands, clean_commands, install_commands, uninstall_commands = commands
test_args = parse_test_args(testdir)
gen_start = time.time()
+ setup_env = None
# Configure in-process
if pass_prefix_to_test(testdir):
gen_args = ['--prefix', '/usr']
@@ -362,7 +364,15 @@ def _run_test(testdir, test_build_dir, install_dir, extra_args, compiler, backen
crossfile = os.path.join(testdir, 'crossfile.ini')
if os.path.exists(crossfile):
gen_args.extend(['--cross-file', crossfile])
- (returncode, stdo, stde) = run_configure(gen_args)
+ setup_env_file = os.path.join(testdir, 'setup_env.json')
+ if os.path.exists(setup_env_file):
+ setup_env = os.environ.copy()
+ with open(setup_env_file, 'r') as fp:
+ data = json.load(fp)
+ for key, val in data.items():
+ val = val.replace('@ROOT@', os.path.abspath(testdir))
+ setup_env[key] = val
+ (returncode, stdo, stde) = run_configure(gen_args, env=setup_env)
try:
logfile = Path(test_build_dir, 'meson-logs', 'meson-log.txt')
mesonlog = logfile.open(errors='ignore', encoding='utf-8').read()