tests: Add a test case for finding ld

pull/6435/head
Dylan Baker 4 years ago committed by Jussi Pakkanen
parent 730a7b296f
commit 255fa5a320
  1. 1
      cross/linux-mingw-w64-32bit.txt
  2. 1
      cross/ubuntu-armhf.txt
  3. 6
      mesonbuild/environment.py
  4. 4
      run_unittests.py
  5. 4
      test cases/linuxlike/15 ld binary/meson.build

@ -6,6 +6,7 @@ strip = '/usr/bin/i686-w64-mingw32-strip'
pkgconfig = '/usr/bin/i686-w64-mingw32-pkg-config'
windres = '/usr/bin/i686-w64-mingw32-windres'
exe_wrapper = 'wine'
ld = '/usr/bin/i686-w64-mingw32-ld'
[properties]
# Directory that contains 'bin', 'lib', etc

@ -7,6 +7,7 @@ rust = ['rustc', '--target', 'arm-unknown-linux-gnueabihf', '-C', 'linker=/usr/b
ar = '/usr/arm-linux-gnueabihf/bin/ar'
strip = '/usr/arm-linux-gnueabihf/bin/strip'
pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
ld = '/usr/bin/arm-linux/gnueabihf-ld'
[properties]
root = '/usr/arm-linux-gnueabihf'

@ -749,7 +749,7 @@ class Environment:
check_args += self.coredata.compiler_options[for_machine][comp_class.language + '_args'].value
override = [] # type: T.List[str]
value = self.binaries[for_machine].lookup_entry(comp_class.language + 'ld')
value = self.binaries[for_machine].lookup_entry(comp_class.language + '_ld')
if value is not None:
override = comp_class.use_linker_args(value[0])
check_args += override
@ -812,7 +812,7 @@ class Environment:
check_args = comp_class.LINKER_PREFIX + ['--version'] + extra_args
override = [] # type: T.List[str]
value = self.binaries[for_machine].lookup_entry(comp_class.language + 'ld')
value = self.binaries[for_machine].lookup_entry(comp_class.language + '_ld')
if value is not None:
override = comp_class.use_linker_args(value[0])
check_args += override
@ -1355,7 +1355,7 @@ class Environment:
cc = self.detect_c_compiler(for_machine)
is_link_exe = isinstance(cc.linker, VisualStudioLikeLinkerMixin)
override = self.binaries[for_machine].lookup_entry('rustld')
override = self.binaries[for_machine].lookup_entry('rust_ld')
for compiler in compilers:
if isinstance(compiler, str):

@ -4664,7 +4664,7 @@ class WindowsTests(BasePlatformTests):
def _check_ld(self, name: str, lang: str, expected: str) -> None:
if not shutil.which(name):
raise unittest.SkipTest('Could not find {}.'.format(name))
envvar = mesonbuild.envconfig.BinaryTable.evarMap['{}ld'.format(lang)]
envvar = mesonbuild.envconfig.BinaryTable.evarMap['{}_ld'.format(lang)]
with mock.patch.dict(os.environ, {envvar: name}):
env = get_fake_env()
try:
@ -5945,7 +5945,7 @@ c = ['{0}']
raise unittest.SkipTest('Solaris currently cannot override the linker.')
if not shutil.which(check):
raise unittest.SkipTest('Could not find {}.'.format(check))
envvar = mesonbuild.envconfig.BinaryTable.evarMap['{}ld'.format(lang)]
envvar = mesonbuild.envconfig.BinaryTable.evarMap['{}_ld'.format(lang)]
with mock.patch.dict(os.environ, {envvar: name}):
env = get_fake_env()
comp = getattr(env, 'detect_{}_compiler'.format(lang))(MachineChoice.HOST)

@ -0,0 +1,4 @@
project('ld binary')
ld = find_program('ld')
assert(run_command(ld, '--version').returncode() == 0)
Loading…
Cancel
Save