Add '189 same target name flat layout' test

pull/3246/head
Aleksey Filippov 7 years ago
parent cb761718f0
commit f4ea6ac454
  1. 9
      run_unittests.py
  2. 1
      test cases/common/189 same target name flat layout/foo.c
  3. 16
      test cases/common/189 same target name flat layout/main.c
  4. 11
      test cases/common/189 same target name flat layout/meson.build
  5. 1
      test cases/common/189 same target name flat layout/subdir/foo.c
  6. 1
      test cases/common/189 same target name flat layout/subdir/meson.build

@ -1917,6 +1917,15 @@ int main(int argc, char **argv) {
self.init(testdir, extra_args=['--layout=flat'])
self.build()
def test_identical_target_name_in_subdir_flat_layout(self):
'''
Test that identical targets in different subdirs do not collide
if layout is flat.
'''
testdir = os.path.join(self.common_test_dir, '189 same target name flat layout')
self.init(testdir, extra_args=['--layout=flat'])
self.build()
def test_flock(self):
exception_raised = False
with tempfile.TemporaryDirectory() as tdir:

@ -0,0 +1 @@
int meson_test_main_foo(void) { return 10; }

@ -0,0 +1,16 @@
#include <stdio.h>
int meson_test_main_foo(void);
int meson_test_subproj_foo(void);
int main(void) {
if (meson_test_main_foo() != 10) {
printf("Failed meson_test_main_foo\n");
return 1;
}
if (meson_test_subproj_foo() != 20) {
printf("Failed meson_test_subproj_foo\n");
return 1;
}
return 0;
}

@ -0,0 +1,11 @@
project('subdir targets', 'c')
# Idea behind this test is to create targets with identical name
# but different output files. We can do this by choosing different
# name_prefix of libraries. Target id does not depend on name_prefix.
main_foo = static_library('foo', 'foo.c', name_prefix : 'main')
subdir('subdir') # defines subdir_foo
exe = executable('prog', 'main.c', link_with : [main_foo, subdir_foo])
test('main test', exe)

@ -0,0 +1 @@
int meson_test_subproj_foo(void) { return 20; }

@ -0,0 +1 @@
subdir_foo = static_library('foo', 'foo.c', name_prefix : 'subdir')
Loading…
Cancel
Save