Calculate target paths correctly when workdir is set.

pull/4745/head
Jussi Pakkanen 6 years ago
parent f2223fcf54
commit d085002d18
  1. 9
      mesonbuild/backend/backends.py
  2. 2
      test cases/common/97 test workdir/meson.build
  3. 5
      test cases/common/97 test workdir/subdir/checker.py
  4. 4
      test cases/common/97 test workdir/subdir/meson.build

@ -725,7 +725,7 @@ class Backend:
elif isinstance(a, str): elif isinstance(a, str):
cmd_args.append(a) cmd_args.append(a)
elif isinstance(a, build.Target): elif isinstance(a, build.Target):
cmd_args.append(self.get_target_filename(a)) cmd_args.append(self.construct_target_rel_path(a, t.workdir))
else: else:
raise MesonException('Bad object in test command.') raise MesonException('Bad object in test command.')
ts = TestSerialisation(t.get_name(), t.project_name, t.suite, cmd, is_cross, ts = TestSerialisation(t.get_name(), t.project_name, t.suite, cmd, is_cross,
@ -737,6 +737,13 @@ class Backend:
def write_test_serialisation(self, tests, datafile): def write_test_serialisation(self, tests, datafile):
pickle.dump(self.create_test_serialisation(tests), datafile) pickle.dump(self.create_test_serialisation(tests), datafile)
def construct_target_rel_path(self, a, workdir):
if workdir is None:
return self.get_target_filename(a)
assert(os.path.isabs(workdir))
abs_path = self.get_target_filename_abs(a)
return os.path.relpath(abs_path, workdir)
def generate_depmf_install(self, d): def generate_depmf_install(self, d):
if self.build.dep_manifest_name is None: if self.build.dep_manifest_name is None:
return return

@ -4,3 +4,5 @@ exe = executable('opener', 'opener.c')
test('basic', exe, workdir : meson.source_root()) test('basic', exe, workdir : meson.source_root())
test('shouldfail', exe, should_fail : true) test('shouldfail', exe, should_fail : true)
subdir('subdir')

@ -0,0 +1,5 @@
#!/usr/bin/env python3
import sys
data = open(sys.argv[1], 'rb').read()

@ -0,0 +1,4 @@
exe2 = executable('dummy', '../opener.c')
test('subdir', find_program('checker.py'),
workdir : meson.source_root(),
args: [exe2])
Loading…
Cancel
Save