diff options
author | Aleksey Filippov <alekseyf@google.com> | 2018-03-14 20:51:03 +0000 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-15 21:14:58 +0200 |
commit | 7f042b5fe2c3bf3bdd254aefe5936c20cb4bd293 (patch) | |
tree | be53fa41c9075355641e375bfa5439f3e6b0bb79 /test cases | |
parent | 2e128f71bb3215567a5bb2267abae00ed4ee09be (diff) | |
download | meson-7f042b5fe2c3bf3bdd254aefe5936c20cb4bd293.zip meson-7f042b5fe2c3bf3bdd254aefe5936c20cb4bd293.tar.gz meson-7f042b5fe2c3bf3bdd254aefe5936c20cb4bd293.tar.bz2 |
Use target.get_id() instead of basename and type_suffix concatenation at call site
Fixes the bug with flat layout and identical target names in subprojects.
Without this change directories are not created with subproject prefix
and they can collide.
Remove dead makedirs code in Backend.__init__(), during initialization
of backend build.targets is empty. Create output directories in
Vs2010Backend.generate_projects() instead.
Also use double blank line in run_unittests.py according to
https://www.python.org/dev/peps/pep-0008/#blank-lines.
Diffstat (limited to 'test cases')
5 files changed, 32 insertions, 0 deletions
diff --git a/test cases/common/182 identical target name in subproject flat layout/foo.c b/test cases/common/182 identical target name in subproject flat layout/foo.c new file mode 100644 index 0000000..ed42789 --- /dev/null +++ b/test cases/common/182 identical target name in subproject flat layout/foo.c @@ -0,0 +1 @@ +int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/182 identical target name in subproject flat layout/main.c b/test cases/common/182 identical target name in subproject flat layout/main.c new file mode 100644 index 0000000..6f02aeb --- /dev/null +++ b/test cases/common/182 identical target name in subproject flat layout/main.c @@ -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; +} diff --git a/test cases/common/182 identical target name in subproject flat layout/meson.build b/test cases/common/182 identical target name in subproject flat layout/meson.build new file mode 100644 index 0000000..d859fda --- /dev/null +++ b/test cases/common/182 identical target name in subproject flat layout/meson.build @@ -0,0 +1,11 @@ +project('subproject 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') +subproj_foo = subproject('subproj').get_variable('foo') + +exe = executable('prog', 'main.c', link_with : [main_foo, subproj_foo]) +test('main test', exe) diff --git a/test cases/common/182 identical target name in subproject flat layout/subprojects/subproj/foo.c b/test cases/common/182 identical target name in subproject flat layout/subprojects/subproj/foo.c new file mode 100644 index 0000000..f334292 --- /dev/null +++ b/test cases/common/182 identical target name in subproject flat layout/subprojects/subproj/foo.c @@ -0,0 +1 @@ +int meson_test_subproj_foo(void) { return 20; } diff --git a/test cases/common/182 identical target name in subproject flat layout/subprojects/subproj/meson.build b/test cases/common/182 identical target name in subproject flat layout/subprojects/subproj/meson.build new file mode 100644 index 0000000..c927194 --- /dev/null +++ b/test cases/common/182 identical target name in subproject flat layout/subprojects/subproj/meson.build @@ -0,0 +1,3 @@ +project('subproj', 'c') + +foo = static_library('foo', 'foo.c', name_prefix : 'subproj') |