aboutsummaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-06-01 13:00:17 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-01 19:20:04 +0000
commit0a035dea6d0b1416fc76e323bbd7b0ab5a60a4af (patch)
tree0399ae08fe7cd92d23563db29a401f5454b68693 /run_project_tests.py
parent14750b50ea9c9f53237bed59a79365e1ebbdacda (diff)
downloadmeson-0a035dea6d0b1416fc76e323bbd7b0ab5a60a4af.zip
meson-0a035dea6d0b1416fc76e323bbd7b0ab5a60a4af.tar.gz
meson-0a035dea6d0b1416fc76e323bbd7b0ab5a60a4af.tar.bz2
Set the meson command to use when we know what it is
Instead of using fragile guessing to figure out how to invoke meson, set the value when meson is run. Also rework how we pass of meson_script_launcher to regenchecker.py -- it wasn't even being used With this change, we only need to guess the meson path when running the tests, and in that case: 1. If MESON_EXE is set in the env, we know how to run meson for project tests. 2. MESON_EXE is not set, which means we run the configure in-process for project tests and need to guess what meson to run, so either - meson.py is found next to run_tests.py, or - meson, meson.py, or meson.exe is in PATH Otherwise, you can invoke meson in the following ways: 1. meson is installed, and mesonbuild is available in PYTHONPATH: - meson, meson.py, meson.exe from PATH - python3 -m mesonbuild.mesonmain - python3 /path/to/meson.py - meson is a shell wrapper to meson.real 2. meson is not installed, and is run from git: - Absolute path to meson.py - Relative path to meson.py - Symlink to meson.py All these are tested in test_meson_commands.py, except meson.exe since that involves building the meson msi and installing it.
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index 2669a92..0b77a37 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -38,8 +38,7 @@ import time
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
import re
-from run_unittests import get_fake_options, run_configure
-
+from run_tests import get_fake_options, run_configure, get_meson_script
from run_tests import get_backend_commands, get_backend_args_for_dir, Backend
from run_tests import ensure_backend_detects_changes
@@ -88,12 +87,6 @@ no_meson_log_msg = 'No meson-log.txt found.'
system_compiler = None
-meson_command = os.path.join(os.getcwd(), 'meson')
-if not os.path.exists(meson_command):
- meson_command += '.py'
- if not os.path.exists(meson_command):
- raise RuntimeError('Could not find main Meson script to run.')
-
class StopException(Exception):
def __init__(self):
super().__init__('Stopped by user')
@@ -324,7 +317,7 @@ def _run_test(testdir, test_build_dir, install_dir, extra_args, compiler, backen
if pass_libdir_to_test(testdir):
gen_args += ['--libdir', 'lib']
gen_args += [testdir, test_build_dir] + flags + test_args + extra_args
- (returncode, stdo, stde) = run_configure(meson_command, gen_args)
+ (returncode, stdo, stde) = run_configure(gen_args)
try:
logfile = Path(test_build_dir, 'meson-logs', 'meson-log.txt')
mesonlog = logfile.open(errors='ignore', encoding='utf-8').read()
@@ -417,7 +410,7 @@ def have_d_compiler():
def have_objc_compiler():
with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir:
- env = environment.Environment(None, build_dir, None, get_fake_options('/'), [])
+ env = environment.Environment(None, build_dir, get_fake_options('/'), [])
try:
objc_comp = env.detect_objc_compiler(False)
except mesonlib.MesonException:
@@ -432,7 +425,7 @@ def have_objc_compiler():
def have_objcpp_compiler():
with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir:
- env = environment.Environment(None, build_dir, None, get_fake_options('/'), [])
+ env = environment.Environment(None, build_dir, get_fake_options('/'), [])
try:
objcpp_comp = env.detect_objcpp_compiler(False)
except mesonlib.MesonException:
@@ -648,11 +641,12 @@ def check_format():
check_file(fullname)
def check_meson_commands_work():
- global backend, meson_command, compile_commands, test_commands, install_commands
+ global backend, compile_commands, test_commands, install_commands
testdir = PurePath('test cases', 'common', '1 trivial').as_posix()
+ meson_commands = mesonlib.python_command + [get_meson_script()]
with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir:
print('Checking that configuring works...')
- gen_cmd = mesonlib.meson_command + [testdir, build_dir] + backend_flags
+ gen_cmd = meson_commands + [testdir, build_dir] + backend_flags
pc, o, e = Popen_safe(gen_cmd)
if pc.returncode != 0:
raise RuntimeError('Failed to configure {!r}:\n{}\n{}'.format(testdir, e, o))