|
|
|
@ -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') |
|
|
|
|