aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-11-11 01:53:23 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-11-20 23:08:17 +0200
commit5d51bc79c7555e681a0c638da9528458257744ae (patch)
tree9d8e24be05870144a8763a094a8b273fd657c262 /run_unittests.py
parentb3dfb80c15cae24c66d07425bb7a327528438a55 (diff)
downloadmeson-5d51bc79c7555e681a0c638da9528458257744ae.zip
meson-5d51bc79c7555e681a0c638da9528458257744ae.tar.gz
meson-5d51bc79c7555e681a0c638da9528458257744ae.tar.bz2
Replaced sys.executable use with the mesonlib equivalent.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 2d4dfbb..cdf2902 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -34,6 +34,7 @@ import mesonbuild.mesonlib
import mesonbuild.coredata
from mesonbuild.interpreter import ObjectHolder
from mesonbuild.mesonlib import is_linux, is_windows, is_osx, is_cygwin, windows_proof_rmtree
+from mesonbuild.mesonlib import python_command, meson_command
from mesonbuild.environment import Environment
from mesonbuild.dependencies import DependencyException
from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram
@@ -462,10 +463,10 @@ class BasePlatformTests(unittest.TestCase):
self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja'))
self.meson_mainfile = os.path.join(src_root, 'meson.py')
self.meson_args = ['--backend=' + self.backend.name]
- self.meson_command = [sys.executable, self.meson_mainfile] + self.meson_args
- self.mconf_command = [sys.executable, os.path.join(src_root, 'meson.py'), 'configure']
- self.mintro_command = [sys.executable, os.path.join(src_root, 'meson.py'), 'introspect']
- self.mtest_command = [sys.executable, os.path.join(src_root, 'meson.py'), 'test', '-C', self.builddir]
+ self.meson_command = meson_command + self.meson_args
+ self.mconf_command = meson_command + ['configure']
+ self.mintro_command = meson_command + ['introspect']
+ self.mtest_command = meson_command + ['test', '-C', self.builddir]
# Backend-specific build commands
self.build_command, self.clean_command, self.test_command, self.install_command, \
self.uninstall_command = get_backend_commands(self.backend)
@@ -1122,14 +1123,14 @@ class AllPlatformTests(BasePlatformTests):
# exelist + some argument. This is meant to test that setting
# something like `ccache gcc -pipe` or `distcc ccache gcc` works.
wrapper = os.path.join(testdir, 'compiler wrapper.py')
- wrappercc = [sys.executable, wrapper] + cc.get_exelist() + ['-DSOME_ARG']
+ wrappercc = python_command + [wrapper] + cc.get_exelist() + ['-DSOME_ARG']
wrappercc_s = ''
for w in wrappercc:
wrappercc_s += shlex.quote(w) + ' '
os.environ[evar] = wrappercc_s
wcc = getattr(env, 'detect_{}_compiler'.format(lang))(False)
# Check static linker too
- wrapperlinker = [sys.executable, wrapper] + linker.get_exelist() + linker.get_always_args()
+ wrapperlinker = python_command + [wrapper] + linker.get_exelist() + linker.get_always_args()
wrapperlinker_s = ''
for w in wrapperlinker:
wrapperlinker_s += shlex.quote(w) + ' '
@@ -1718,12 +1719,12 @@ class WindowsTests(BasePlatformTests):
os.environ['PATH'] += os.pathsep + testdir
prog = ExternalProgram('test-script-ext')
self.assertTrue(prog.found(), msg='test-script-ext not found in PATH')
- self.assertPathEqual(prog.get_command()[0], sys.executable)
+ self.assertPathEqual(prog.get_command()[0], python_command[0])
self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py')
# Finding a script in PATH with extension works and adds the interpreter
prog = ExternalProgram('test-script-ext.py')
self.assertTrue(prog.found(), msg='test-script-ext.py not found in PATH')
- self.assertPathEqual(prog.get_command()[0], sys.executable)
+ self.assertPathEqual(prog.get_command()[0], python_command[0])
self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py')
def test_ignore_libs(self):
@@ -2247,7 +2248,7 @@ class RewriterTests(unittest.TestCase):
super().setUp()
src_root = os.path.dirname(__file__)
self.testroot = os.path.realpath(tempfile.mkdtemp())
- self.rewrite_command = [sys.executable, os.path.join(src_root, 'mesonrewriter.py')]
+ self.rewrite_command = python_command + [os.path.join(src_root, 'mesonrewriter.py')]
self.tmpdir = os.path.realpath(tempfile.mkdtemp())
self.workdir = os.path.join(self.tmpdir, 'foo')
self.test_dir = os.path.join(src_root, 'test cases/rewrite')