diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-08-19 15:02:05 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-09-09 21:22:26 -0700 |
commit | 3a011df4df1e57536e5792350fb932f0f9eacb0a (patch) | |
tree | e1c91ddad5b79cc2c784f15f943daf398ca6184f | |
parent | 52aba19b17a10c7edbef05f8dc86aa917b59f5c3 (diff) | |
download | meson-3a011df4df1e57536e5792350fb932f0f9eacb0a.zip meson-3a011df4df1e57536e5792350fb932f0f9eacb0a.tar.gz meson-3a011df4df1e57536e5792350fb932f0f9eacb0a.tar.bz2 |
unitests: dont assume cc exists or is valid
On illumos (and presumably Solaris, though I can't test) cc normally
points to Sun CC, which we don't support. So ensure that gcc is used
explicitly in that case.
-rwxr-xr-x | run_unittests.py | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/run_unittests.py b/run_unittests.py index 07f0b93..f06be23 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -48,9 +48,10 @@ import mesonbuild.modules.gnome from mesonbuild.interpreter import Interpreter, ObjectHolder from mesonbuild.ast import AstInterpreter from mesonbuild.mesonlib import ( - BuildDirLock, LibType, MachineChoice, PerMachine, Version, - is_windows, is_osx, is_cygwin, is_dragonflybsd, is_openbsd, is_haiku, - windows_proof_rmtree, python_command, version_compare, split_args, quote_arg + BuildDirLock, LibType, MachineChoice, PerMachine, Version, is_windows, + is_osx, is_cygwin, is_dragonflybsd, is_openbsd, is_haiku, is_sunos, + windows_proof_rmtree, python_command, version_compare, split_args, + quote_arg ) from mesonbuild.environment import detect_ninja from mesonbuild.mesonlib import MesonException, EnvironmentException @@ -2955,11 +2956,15 @@ int main(int argc, char **argv) { def test_cross_file_system_paths(self): if is_windows(): raise unittest.SkipTest('system crossfile paths not defined for Windows (yet)') + if is_sunos(): + cc = 'gcc' + else: + cc = 'cc' testdir = os.path.join(self.common_test_dir, '1 trivial') cross_content = textwrap.dedent("""\ [binaries] - c = '/usr/bin/cc' + c = '/usr/bin/{}' ar = '/usr/bin/ar' strip = '/usr/bin/ar' @@ -2970,7 +2975,7 @@ int main(int argc, char **argv) { cpu_family = 'x86' cpu = 'i686' endian = 'little' - """) + """.format(cc)) with tempfile.TemporaryDirectory() as d: dir_ = os.path.join(d, 'meson', 'cross') @@ -5154,21 +5159,23 @@ class LinuxlikeTests(BasePlatformTests): testdir = os.path.join(self.unit_test_dir, '11 cross prog') crossfile = tempfile.NamedTemporaryFile(mode='w') print(os.path.join(testdir, 'some_cross_tool.py')) - crossfile.write('''[binaries] -c = '/usr/bin/cc' -ar = '/usr/bin/ar' -strip = '/usr/bin/ar' -sometool.py = ['{0}'] -someothertool.py = '{0}' - -[properties] - -[host_machine] -system = 'linux' -cpu_family = 'arm' -cpu = 'armv7' # Not sure if correct. -endian = 'little' -'''.format(os.path.join(testdir, 'some_cross_tool.py'))) + crossfile.write(textwrap.dedent('''\ + [binaries] + c = '/usr/bin/{1}' + ar = '/usr/bin/ar' + strip = '/usr/bin/ar' + sometool.py = ['{0}'] + someothertool.py = '{0}' + + [properties] + + [host_machine] + system = 'linux' + cpu_family = 'arm' + cpu = 'armv7' # Not sure if correct. + endian = 'little' + ''').format(os.path.join(testdir, 'some_cross_tool.py'), + 'gcc' if is_sunos() else 'cc')) crossfile.flush() self.meson_cross_file = crossfile.name self.init(testdir) |