aboutsummaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
authorMarvin Scholz <epirat07@gmail.com>2022-03-30 23:30:39 +0200
committerMarvin Scholz <epirat07@gmail.com>2022-03-31 10:55:55 +0200
commit34ea8fdf981b5e10c702e9adfcab7f9e316a129b (patch)
tree1eb02f1fc230ead3a7d6cddb58164f33db4a0658 /run_tests.py
parent9e597ce905aa2b426e87f590a671b6726c09f075 (diff)
downloadmeson-34ea8fdf981b5e10c702e9adfcab7f9e316a129b.zip
meson-34ea8fdf981b5e10c702e9adfcab7f9e316a129b.tar.gz
meson-34ea8fdf981b5e10c702e9adfcab7f9e316a129b.tar.bz2
unittests: move get_convincing_fake_env_and_cc to run_tests.py
Diffstat (limited to 'run_tests.py')
-rwxr-xr-xrun_tests.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/run_tests.py b/run_tests.py
index dc7a8f9..fcd9337 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -40,7 +40,7 @@ from mesonbuild import mesonlib
from mesonbuild import mesonmain
from mesonbuild import mtest
from mesonbuild import mlog
-from mesonbuild.environment import Environment, detect_ninja
+from mesonbuild.environment import Environment, detect_ninja, detect_machine_info
from mesonbuild.coredata import backendlist, version as meson_version
from mesonbuild.mesonlib import OptionKey, setup_vsenv
@@ -153,6 +153,17 @@ def get_fake_env(sdir='', bdir=None, prefix='', opts=None):
env.machines.host.cpu_family = 'x86_64' # Used on macOS inside find_library
return env
+def get_convincing_fake_env_and_cc(bdir, prefix):
+ '''
+ Return a fake env and C compiler with the fake env
+ machine info properly detected using that compiler.
+ Useful for running compiler checks in the unit tests.
+ '''
+ env = get_fake_env('', bdir, prefix)
+ cc = compilers.detect_c_compiler(env, mesonlib.MachineChoice.HOST)
+ # Detect machine info
+ env.machines.host = detect_machine_info({'c':cc})
+ return (env, cc)
Backend = Enum('Backend', 'ninja vs xcode')