From 8d5c33f92f610bc401bc8e60574b787ddeb235eb Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Wed, 18 Apr 2018 00:33:41 +0300 Subject: Renamed test dirs so numbers are sequential. --- run_unittests.py | 2 +- .../common/189 same target name flat layout/foo.c | 1 - .../common/189 same target name flat layout/main.c | 16 --------- .../189 same target name flat layout/meson.build | 11 ------ .../189 same target name flat layout/subdir/foo.c | 1 - .../subdir/meson.build | 1 - test cases/common/190 find override/meson.build | 12 ------- .../common/190 find override/otherdir/main.c | 5 --- .../common/190 find override/otherdir/main2.c | 5 --- .../common/190 find override/otherdir/meson.build | 26 -------------- .../common/190 find override/otherdir/source.desc | 1 - .../common/190 find override/otherdir/source2.desc | 1 - .../common/190 find override/subdir/converter.py | 15 -------- .../190 find override/subdir/gencodegen.py.in | 15 -------- .../common/190 find override/subdir/meson.build | 14 -------- test cases/common/190 openmp/main.c | 16 --------- test cases/common/190 openmp/main.cpp | 16 --------- test cases/common/190 openmp/main.f90 | 8 ----- test cases/common/190 openmp/meson.build | 40 ---------------------- .../declare_dependency/headers/foo.c | 16 --------- .../declare_dependency/headers/foo.h | 16 --------- .../declare_dependency/main.c | 25 -------------- .../declare_dependency/meson.build | 28 --------------- .../declare_dependency/other.c | 20 ----------- .../common/191 partial dependency/meson.build | 17 --------- .../common/192 same target name flat layout/foo.c | 1 + .../common/192 same target name flat layout/main.c | 16 +++++++++ .../192 same target name flat layout/meson.build | 11 ++++++ .../192 same target name flat layout/subdir/foo.c | 1 + .../subdir/meson.build | 1 + test cases/common/193 find override/meson.build | 12 +++++++ .../common/193 find override/otherdir/main.c | 5 +++ .../common/193 find override/otherdir/main2.c | 5 +++ .../common/193 find override/otherdir/meson.build | 26 ++++++++++++++ .../common/193 find override/otherdir/source.desc | 1 + .../common/193 find override/otherdir/source2.desc | 1 + .../common/193 find override/subdir/converter.py | 15 ++++++++ .../193 find override/subdir/gencodegen.py.in | 15 ++++++++ .../common/193 find override/subdir/meson.build | 14 ++++++++ .../declare_dependency/headers/foo.c | 16 +++++++++ .../declare_dependency/headers/foo.h | 16 +++++++++ .../declare_dependency/main.c | 25 ++++++++++++++ .../declare_dependency/meson.build | 28 +++++++++++++++ .../declare_dependency/other.c | 20 +++++++++++ .../common/194 partial dependency/meson.build | 17 +++++++++ test cases/common/195 openmp/main.c | 16 +++++++++ test cases/common/195 openmp/main.cpp | 16 +++++++++ test cases/common/195 openmp/main.f90 | 8 +++++ test cases/common/195 openmp/meson.build | 40 ++++++++++++++++++++++ test cases/failing/72 override used/meson.build | 5 --- test cases/failing/72 override used/other.py | 3 -- test cases/failing/72 override used/something.py | 3 -- test cases/failing/74 override used/meson.build | 5 +++ test cases/failing/74 override used/other.py | 3 ++ test cases/failing/74 override used/something.py | 3 ++ 55 files changed, 338 insertions(+), 338 deletions(-) delete mode 100644 test cases/common/189 same target name flat layout/foo.c delete mode 100644 test cases/common/189 same target name flat layout/main.c delete mode 100644 test cases/common/189 same target name flat layout/meson.build delete mode 100644 test cases/common/189 same target name flat layout/subdir/foo.c delete mode 100644 test cases/common/189 same target name flat layout/subdir/meson.build delete mode 100644 test cases/common/190 find override/meson.build delete mode 100644 test cases/common/190 find override/otherdir/main.c delete mode 100644 test cases/common/190 find override/otherdir/main2.c delete mode 100644 test cases/common/190 find override/otherdir/meson.build delete mode 100644 test cases/common/190 find override/otherdir/source.desc delete mode 100644 test cases/common/190 find override/otherdir/source2.desc delete mode 100755 test cases/common/190 find override/subdir/converter.py delete mode 100755 test cases/common/190 find override/subdir/gencodegen.py.in delete mode 100644 test cases/common/190 find override/subdir/meson.build delete mode 100644 test cases/common/190 openmp/main.c delete mode 100644 test cases/common/190 openmp/main.cpp delete mode 100644 test cases/common/190 openmp/main.f90 delete mode 100644 test cases/common/190 openmp/meson.build delete mode 100644 test cases/common/191 partial dependency/declare_dependency/headers/foo.c delete mode 100644 test cases/common/191 partial dependency/declare_dependency/headers/foo.h delete mode 100644 test cases/common/191 partial dependency/declare_dependency/main.c delete mode 100644 test cases/common/191 partial dependency/declare_dependency/meson.build delete mode 100644 test cases/common/191 partial dependency/declare_dependency/other.c delete mode 100644 test cases/common/191 partial dependency/meson.build create mode 100644 test cases/common/192 same target name flat layout/foo.c create mode 100644 test cases/common/192 same target name flat layout/main.c create mode 100644 test cases/common/192 same target name flat layout/meson.build create mode 100644 test cases/common/192 same target name flat layout/subdir/foo.c create mode 100644 test cases/common/192 same target name flat layout/subdir/meson.build create mode 100644 test cases/common/193 find override/meson.build create mode 100644 test cases/common/193 find override/otherdir/main.c create mode 100644 test cases/common/193 find override/otherdir/main2.c create mode 100644 test cases/common/193 find override/otherdir/meson.build create mode 100644 test cases/common/193 find override/otherdir/source.desc create mode 100644 test cases/common/193 find override/otherdir/source2.desc create mode 100755 test cases/common/193 find override/subdir/converter.py create mode 100755 test cases/common/193 find override/subdir/gencodegen.py.in create mode 100644 test cases/common/193 find override/subdir/meson.build create mode 100644 test cases/common/194 partial dependency/declare_dependency/headers/foo.c create mode 100644 test cases/common/194 partial dependency/declare_dependency/headers/foo.h create mode 100644 test cases/common/194 partial dependency/declare_dependency/main.c create mode 100644 test cases/common/194 partial dependency/declare_dependency/meson.build create mode 100644 test cases/common/194 partial dependency/declare_dependency/other.c create mode 100644 test cases/common/194 partial dependency/meson.build create mode 100644 test cases/common/195 openmp/main.c create mode 100644 test cases/common/195 openmp/main.cpp create mode 100644 test cases/common/195 openmp/main.f90 create mode 100644 test cases/common/195 openmp/meson.build delete mode 100644 test cases/failing/72 override used/meson.build delete mode 100755 test cases/failing/72 override used/other.py delete mode 100755 test cases/failing/72 override used/something.py create mode 100644 test cases/failing/74 override used/meson.build create mode 100755 test cases/failing/74 override used/other.py create mode 100755 test cases/failing/74 override used/something.py diff --git a/run_unittests.py b/run_unittests.py index a6be2e241..e0cd1ec50 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1923,7 +1923,7 @@ int main(int argc, char **argv) { 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') + testdir = os.path.join(self.common_test_dir, '192 same target name flat layout') self.init(testdir, extra_args=['--layout=flat']) self.build() diff --git a/test cases/common/189 same target name flat layout/foo.c b/test cases/common/189 same target name flat layout/foo.c deleted file mode 100644 index ed427899a..000000000 --- a/test cases/common/189 same target name flat layout/foo.c +++ /dev/null @@ -1 +0,0 @@ -int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/189 same target name flat layout/main.c b/test cases/common/189 same target name flat layout/main.c deleted file mode 100644 index 6f02aeb82..000000000 --- a/test cases/common/189 same target name flat layout/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -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/189 same target name flat layout/meson.build b/test cases/common/189 same target name flat layout/meson.build deleted file mode 100644 index a3c95fa25..000000000 --- a/test cases/common/189 same target name flat layout/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -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) diff --git a/test cases/common/189 same target name flat layout/subdir/foo.c b/test cases/common/189 same target name flat layout/subdir/foo.c deleted file mode 100644 index f33429229..000000000 --- a/test cases/common/189 same target name flat layout/subdir/foo.c +++ /dev/null @@ -1 +0,0 @@ -int meson_test_subproj_foo(void) { return 20; } diff --git a/test cases/common/189 same target name flat layout/subdir/meson.build b/test cases/common/189 same target name flat layout/subdir/meson.build deleted file mode 100644 index 223a5ef90..000000000 --- a/test cases/common/189 same target name flat layout/subdir/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir_foo = static_library('foo', 'foo.c', name_prefix : 'subdir') diff --git a/test cases/common/190 find override/meson.build b/test cases/common/190 find override/meson.build deleted file mode 100644 index 3b8af8091..000000000 --- a/test cases/common/190 find override/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -project('find program override', 'c') - -gencodegen = find_program('gencodegen', required : false) - -assert(not gencodegen.found(), 'gencodegen is an internal program, should not be found') - -# Test the check-if-found-else-override workflow -if not gencodegen.found() - subdir('subdir') -endif - -subdir('otherdir') diff --git a/test cases/common/190 find override/otherdir/main.c b/test cases/common/190 find override/otherdir/main.c deleted file mode 100644 index 2cef67c8d..000000000 --- a/test cases/common/190 find override/otherdir/main.c +++ /dev/null @@ -1,5 +0,0 @@ -int be_seeing_you(); - -int main(int argc, char **argv) { - return be_seeing_you() == 6 ? 0 : 1; -} diff --git a/test cases/common/190 find override/otherdir/main2.c b/test cases/common/190 find override/otherdir/main2.c deleted file mode 100644 index 6d716882c..000000000 --- a/test cases/common/190 find override/otherdir/main2.c +++ /dev/null @@ -1,5 +0,0 @@ -int number_returner(); - -int main(int argc, char **argv) { - return number_returner() == 100 ? 0 : 1; -} diff --git a/test cases/common/190 find override/otherdir/meson.build b/test cases/common/190 find override/otherdir/meson.build deleted file mode 100644 index dc41f5bf7..000000000 --- a/test cases/common/190 find override/otherdir/meson.build +++ /dev/null @@ -1,26 +0,0 @@ -gen = find_program('codegen') # Should use overridden value set in "subdir". - -src = custom_target('arrival', - input : 'source.desc', - output : 'file.c', - command : [gen, '@INPUT@', '@OUTPUT@'] - ) - -e = executable('six', 'main.c', src) - -test('six', e) - -# The same again, but this time with a program that was genererated -# with configure_file. - -gen = find_program('gencodegen') - -src = custom_target('hundred', - input : 'source2.desc', - output : 'file2.c', - command : [gen, '@INPUT@', '@OUTPUT@'] - ) - -e = executable('hundred', 'main2.c', src) - -test('hundred', e) diff --git a/test cases/common/190 find override/otherdir/source.desc b/test cases/common/190 find override/otherdir/source.desc deleted file mode 100644 index 8b19c9c2f..000000000 --- a/test cases/common/190 find override/otherdir/source.desc +++ /dev/null @@ -1 +0,0 @@ -be_seeing_you diff --git a/test cases/common/190 find override/otherdir/source2.desc b/test cases/common/190 find override/otherdir/source2.desc deleted file mode 100644 index 965f868df..000000000 --- a/test cases/common/190 find override/otherdir/source2.desc +++ /dev/null @@ -1 +0,0 @@ -number_returner diff --git a/test cases/common/190 find override/subdir/converter.py b/test cases/common/190 find override/subdir/converter.py deleted file mode 100755 index ee2ff85a3..000000000 --- a/test cases/common/190 find override/subdir/converter.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import pathlib - -[ifilename, ofilename] = sys.argv[1:3] - -ftempl = '''int %s() { - return 6; -} -''' - -d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() - -pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/190 find override/subdir/gencodegen.py.in b/test cases/common/190 find override/subdir/gencodegen.py.in deleted file mode 100755 index 57d9c40b4..000000000 --- a/test cases/common/190 find override/subdir/gencodegen.py.in +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import pathlib - -[ifilename, ofilename] = sys.argv[1:3] - -ftempl = '''int %s() { - return @NUMBER@; -} -''' - -d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() - -pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/190 find override/subdir/meson.build b/test cases/common/190 find override/subdir/meson.build deleted file mode 100644 index e5de34dde..000000000 --- a/test cases/common/190 find override/subdir/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -x = find_program('converter.py') - -meson.override_find_program('codegen', x) - -# Override a command with a generated script - -cdata = configuration_data() - -cdata.set('NUMBER', 100) -numprog = configure_file(input : 'gencodegen.py.in', - output : 'gencodegen.py', - configuration : cdata) - -meson.override_find_program('gencodegen', numprog) diff --git a/test cases/common/190 openmp/main.c b/test cases/common/190 openmp/main.c deleted file mode 100644 index cc81f4897..000000000 --- a/test cases/common/190 openmp/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(void) { -#ifdef _OPENMP - if (omp_get_max_threads() == 2) { - return 0; - } else { - printf("Max threads is %d not 2.\n", omp_get_max_threads()); - return 1; - } -#else - printf("_OPENMP is not defined; is OpenMP compilation working?\n"); - return 1; -#endif -} diff --git a/test cases/common/190 openmp/main.cpp b/test cases/common/190 openmp/main.cpp deleted file mode 100644 index b12be3fd8..000000000 --- a/test cases/common/190 openmp/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(void) { -#ifdef _OPENMP - if (omp_get_max_threads() == 2) { - return 0; - } else { - std::cout << "Max threads is " << omp_get_max_threads() << " not 2." << std::endl; - return 1; - } -#else - printf("_OPENMP is not defined; is OpenMP compilation working?\n"); - return 1; -#endif -} diff --git a/test cases/common/190 openmp/main.f90 b/test cases/common/190 openmp/main.f90 deleted file mode 100644 index c062d8691..000000000 --- a/test cases/common/190 openmp/main.f90 +++ /dev/null @@ -1,8 +0,0 @@ -program main - if (omp_get_max_threads() .eq. 2) then - stop 0 - else - print *, 'Max threads is', omp_get_max_threads(), 'not 2.' - stop 1 - endif -end program main diff --git a/test cases/common/190 openmp/meson.build b/test cases/common/190 openmp/meson.build deleted file mode 100644 index a05ca59d9..000000000 --- a/test cases/common/190 openmp/meson.build +++ /dev/null @@ -1,40 +0,0 @@ -project('openmp', 'c', 'cpp') - -cc = meson.get_compiler('c') -if cc.get_id() == 'gcc' and cc.version().version_compare('<4.2.0') - error('MESON_SKIP_TEST gcc is too old to support OpenMP.') -endif -if cc.get_id() == 'clang' and cc.version().version_compare('<3.7.0') - error('MESON_SKIP_TEST clang is too old to support OpenMP.') -endif -if cc.get_id() == 'msvc' and cc.version().version_compare('<17') - error('MESON_SKIP_TEST msvc is too old to support OpenMP.') -endif -if host_machine.system() == 'darwin' - error('MESON_SKIP_TEST macOS does not support OpenMP.') -endif - -openmp = dependency('openmp') - -exec = executable('exec', - 'main.c', - dependencies : [openmp]) - -execpp = executable('execpp', - 'main.cpp', - dependencies : [openmp]) - -env = environment() -env.set('OMP_NUM_THREADS', '2') - -test('OpenMP C', exec, env : env) -test('OpenMP C++', execpp, env : env) - - -if add_languages('fortran', required : false) - exef = executable('exef', - 'main.f90', - dependencies : [openmp]) - - test('OpenMP Fortran', execpp, env : env) -endif diff --git a/test cases/common/191 partial dependency/declare_dependency/headers/foo.c b/test cases/common/191 partial dependency/declare_dependency/headers/foo.c deleted file mode 100644 index 215112ca5..000000000 --- a/test cases/common/191 partial dependency/declare_dependency/headers/foo.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#error "Included C sources that shouldn't be." diff --git a/test cases/common/191 partial dependency/declare_dependency/headers/foo.h b/test cases/common/191 partial dependency/declare_dependency/headers/foo.h deleted file mode 100644 index 28c81c9d3..000000000 --- a/test cases/common/191 partial dependency/declare_dependency/headers/foo.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -int foo(void); diff --git a/test cases/common/191 partial dependency/declare_dependency/main.c b/test cases/common/191 partial dependency/declare_dependency/main.c deleted file mode 100644 index e9ed0329a..000000000 --- a/test cases/common/191 partial dependency/declare_dependency/main.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "foo.h" - -int main() { - int a = foo(); - if (a == 1) { - return 0; - } else { - return 1; - } -} diff --git a/test cases/common/191 partial dependency/declare_dependency/meson.build b/test cases/common/191 partial dependency/declare_dependency/meson.build deleted file mode 100644 index 86e26089d..000000000 --- a/test cases/common/191 partial dependency/declare_dependency/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright © 2018 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -dec_dep = declare_dependency( - sources : files('headers/foo.c'), - include_directories : include_directories('headers'), -) - -sub_dep = dec_dep.partial_dependency(includes : true) - -dec_exe = executable( - 'declare_dep', - files('main.c', 'other.c'), - dependencies : sub_dep, -) - -test('Declare Dependency', dec_exe) diff --git a/test cases/common/191 partial dependency/declare_dependency/other.c b/test cases/common/191 partial dependency/declare_dependency/other.c deleted file mode 100644 index b1e199e44..000000000 --- a/test cases/common/191 partial dependency/declare_dependency/other.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright © 2018 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "foo.h" - -int foo(void) { - return 1; -} diff --git a/test cases/common/191 partial dependency/meson.build b/test cases/common/191 partial dependency/meson.build deleted file mode 100644 index e908487f1..000000000 --- a/test cases/common/191 partial dependency/meson.build +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright © 2018 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -project('partial dependency', ['c', 'cpp']) - -subdir('declare_dependency') diff --git a/test cases/common/192 same target name flat layout/foo.c b/test cases/common/192 same target name flat layout/foo.c new file mode 100644 index 000000000..ed427899a --- /dev/null +++ b/test cases/common/192 same target name flat layout/foo.c @@ -0,0 +1 @@ +int meson_test_main_foo(void) { return 10; } diff --git a/test cases/common/192 same target name flat layout/main.c b/test cases/common/192 same target name flat layout/main.c new file mode 100644 index 000000000..6f02aeb82 --- /dev/null +++ b/test cases/common/192 same target name flat layout/main.c @@ -0,0 +1,16 @@ +#include + +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/192 same target name flat layout/meson.build b/test cases/common/192 same target name flat layout/meson.build new file mode 100644 index 000000000..a3c95fa25 --- /dev/null +++ b/test cases/common/192 same target name flat layout/meson.build @@ -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) diff --git a/test cases/common/192 same target name flat layout/subdir/foo.c b/test cases/common/192 same target name flat layout/subdir/foo.c new file mode 100644 index 000000000..f33429229 --- /dev/null +++ b/test cases/common/192 same target name flat layout/subdir/foo.c @@ -0,0 +1 @@ +int meson_test_subproj_foo(void) { return 20; } diff --git a/test cases/common/192 same target name flat layout/subdir/meson.build b/test cases/common/192 same target name flat layout/subdir/meson.build new file mode 100644 index 000000000..223a5ef90 --- /dev/null +++ b/test cases/common/192 same target name flat layout/subdir/meson.build @@ -0,0 +1 @@ +subdir_foo = static_library('foo', 'foo.c', name_prefix : 'subdir') diff --git a/test cases/common/193 find override/meson.build b/test cases/common/193 find override/meson.build new file mode 100644 index 000000000..3b8af8091 --- /dev/null +++ b/test cases/common/193 find override/meson.build @@ -0,0 +1,12 @@ +project('find program override', 'c') + +gencodegen = find_program('gencodegen', required : false) + +assert(not gencodegen.found(), 'gencodegen is an internal program, should not be found') + +# Test the check-if-found-else-override workflow +if not gencodegen.found() + subdir('subdir') +endif + +subdir('otherdir') diff --git a/test cases/common/193 find override/otherdir/main.c b/test cases/common/193 find override/otherdir/main.c new file mode 100644 index 000000000..2cef67c8d --- /dev/null +++ b/test cases/common/193 find override/otherdir/main.c @@ -0,0 +1,5 @@ +int be_seeing_you(); + +int main(int argc, char **argv) { + return be_seeing_you() == 6 ? 0 : 1; +} diff --git a/test cases/common/193 find override/otherdir/main2.c b/test cases/common/193 find override/otherdir/main2.c new file mode 100644 index 000000000..6d716882c --- /dev/null +++ b/test cases/common/193 find override/otherdir/main2.c @@ -0,0 +1,5 @@ +int number_returner(); + +int main(int argc, char **argv) { + return number_returner() == 100 ? 0 : 1; +} diff --git a/test cases/common/193 find override/otherdir/meson.build b/test cases/common/193 find override/otherdir/meson.build new file mode 100644 index 000000000..dc41f5bf7 --- /dev/null +++ b/test cases/common/193 find override/otherdir/meson.build @@ -0,0 +1,26 @@ +gen = find_program('codegen') # Should use overridden value set in "subdir". + +src = custom_target('arrival', + input : 'source.desc', + output : 'file.c', + command : [gen, '@INPUT@', '@OUTPUT@'] + ) + +e = executable('six', 'main.c', src) + +test('six', e) + +# The same again, but this time with a program that was genererated +# with configure_file. + +gen = find_program('gencodegen') + +src = custom_target('hundred', + input : 'source2.desc', + output : 'file2.c', + command : [gen, '@INPUT@', '@OUTPUT@'] + ) + +e = executable('hundred', 'main2.c', src) + +test('hundred', e) diff --git a/test cases/common/193 find override/otherdir/source.desc b/test cases/common/193 find override/otherdir/source.desc new file mode 100644 index 000000000..8b19c9c2f --- /dev/null +++ b/test cases/common/193 find override/otherdir/source.desc @@ -0,0 +1 @@ +be_seeing_you diff --git a/test cases/common/193 find override/otherdir/source2.desc b/test cases/common/193 find override/otherdir/source2.desc new file mode 100644 index 000000000..965f868df --- /dev/null +++ b/test cases/common/193 find override/otherdir/source2.desc @@ -0,0 +1 @@ +number_returner diff --git a/test cases/common/193 find override/subdir/converter.py b/test cases/common/193 find override/subdir/converter.py new file mode 100755 index 000000000..ee2ff85a3 --- /dev/null +++ b/test cases/common/193 find override/subdir/converter.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +import pathlib + +[ifilename, ofilename] = sys.argv[1:3] + +ftempl = '''int %s() { + return 6; +} +''' + +d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() + +pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/193 find override/subdir/gencodegen.py.in b/test cases/common/193 find override/subdir/gencodegen.py.in new file mode 100755 index 000000000..57d9c40b4 --- /dev/null +++ b/test cases/common/193 find override/subdir/gencodegen.py.in @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +import pathlib + +[ifilename, ofilename] = sys.argv[1:3] + +ftempl = '''int %s() { + return @NUMBER@; +} +''' + +d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() + +pathlib.Path(ofilename).write_text(ftempl % d) diff --git a/test cases/common/193 find override/subdir/meson.build b/test cases/common/193 find override/subdir/meson.build new file mode 100644 index 000000000..e5de34dde --- /dev/null +++ b/test cases/common/193 find override/subdir/meson.build @@ -0,0 +1,14 @@ +x = find_program('converter.py') + +meson.override_find_program('codegen', x) + +# Override a command with a generated script + +cdata = configuration_data() + +cdata.set('NUMBER', 100) +numprog = configure_file(input : 'gencodegen.py.in', + output : 'gencodegen.py', + configuration : cdata) + +meson.override_find_program('gencodegen', numprog) diff --git a/test cases/common/194 partial dependency/declare_dependency/headers/foo.c b/test cases/common/194 partial dependency/declare_dependency/headers/foo.c new file mode 100644 index 000000000..215112ca5 --- /dev/null +++ b/test cases/common/194 partial dependency/declare_dependency/headers/foo.c @@ -0,0 +1,16 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#error "Included C sources that shouldn't be." diff --git a/test cases/common/194 partial dependency/declare_dependency/headers/foo.h b/test cases/common/194 partial dependency/declare_dependency/headers/foo.h new file mode 100644 index 000000000..28c81c9d3 --- /dev/null +++ b/test cases/common/194 partial dependency/declare_dependency/headers/foo.h @@ -0,0 +1,16 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +int foo(void); diff --git a/test cases/common/194 partial dependency/declare_dependency/main.c b/test cases/common/194 partial dependency/declare_dependency/main.c new file mode 100644 index 000000000..e9ed0329a --- /dev/null +++ b/test cases/common/194 partial dependency/declare_dependency/main.c @@ -0,0 +1,25 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "foo.h" + +int main() { + int a = foo(); + if (a == 1) { + return 0; + } else { + return 1; + } +} diff --git a/test cases/common/194 partial dependency/declare_dependency/meson.build b/test cases/common/194 partial dependency/declare_dependency/meson.build new file mode 100644 index 000000000..86e26089d --- /dev/null +++ b/test cases/common/194 partial dependency/declare_dependency/meson.build @@ -0,0 +1,28 @@ +# Copyright © 2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dec_dep = declare_dependency( + sources : files('headers/foo.c'), + include_directories : include_directories('headers'), +) + +sub_dep = dec_dep.partial_dependency(includes : true) + +dec_exe = executable( + 'declare_dep', + files('main.c', 'other.c'), + dependencies : sub_dep, +) + +test('Declare Dependency', dec_exe) diff --git a/test cases/common/194 partial dependency/declare_dependency/other.c b/test cases/common/194 partial dependency/declare_dependency/other.c new file mode 100644 index 000000000..b1e199e44 --- /dev/null +++ b/test cases/common/194 partial dependency/declare_dependency/other.c @@ -0,0 +1,20 @@ +/* Copyright © 2018 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "foo.h" + +int foo(void) { + return 1; +} diff --git a/test cases/common/194 partial dependency/meson.build b/test cases/common/194 partial dependency/meson.build new file mode 100644 index 000000000..e908487f1 --- /dev/null +++ b/test cases/common/194 partial dependency/meson.build @@ -0,0 +1,17 @@ +# Copyright © 2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +project('partial dependency', ['c', 'cpp']) + +subdir('declare_dependency') diff --git a/test cases/common/195 openmp/main.c b/test cases/common/195 openmp/main.c new file mode 100644 index 000000000..cc81f4897 --- /dev/null +++ b/test cases/common/195 openmp/main.c @@ -0,0 +1,16 @@ +#include +#include + +int main(void) { +#ifdef _OPENMP + if (omp_get_max_threads() == 2) { + return 0; + } else { + printf("Max threads is %d not 2.\n", omp_get_max_threads()); + return 1; + } +#else + printf("_OPENMP is not defined; is OpenMP compilation working?\n"); + return 1; +#endif +} diff --git a/test cases/common/195 openmp/main.cpp b/test cases/common/195 openmp/main.cpp new file mode 100644 index 000000000..b12be3fd8 --- /dev/null +++ b/test cases/common/195 openmp/main.cpp @@ -0,0 +1,16 @@ +#include +#include + +int main(void) { +#ifdef _OPENMP + if (omp_get_max_threads() == 2) { + return 0; + } else { + std::cout << "Max threads is " << omp_get_max_threads() << " not 2." << std::endl; + return 1; + } +#else + printf("_OPENMP is not defined; is OpenMP compilation working?\n"); + return 1; +#endif +} diff --git a/test cases/common/195 openmp/main.f90 b/test cases/common/195 openmp/main.f90 new file mode 100644 index 000000000..c062d8691 --- /dev/null +++ b/test cases/common/195 openmp/main.f90 @@ -0,0 +1,8 @@ +program main + if (omp_get_max_threads() .eq. 2) then + stop 0 + else + print *, 'Max threads is', omp_get_max_threads(), 'not 2.' + stop 1 + endif +end program main diff --git a/test cases/common/195 openmp/meson.build b/test cases/common/195 openmp/meson.build new file mode 100644 index 000000000..a05ca59d9 --- /dev/null +++ b/test cases/common/195 openmp/meson.build @@ -0,0 +1,40 @@ +project('openmp', 'c', 'cpp') + +cc = meson.get_compiler('c') +if cc.get_id() == 'gcc' and cc.version().version_compare('<4.2.0') + error('MESON_SKIP_TEST gcc is too old to support OpenMP.') +endif +if cc.get_id() == 'clang' and cc.version().version_compare('<3.7.0') + error('MESON_SKIP_TEST clang is too old to support OpenMP.') +endif +if cc.get_id() == 'msvc' and cc.version().version_compare('<17') + error('MESON_SKIP_TEST msvc is too old to support OpenMP.') +endif +if host_machine.system() == 'darwin' + error('MESON_SKIP_TEST macOS does not support OpenMP.') +endif + +openmp = dependency('openmp') + +exec = executable('exec', + 'main.c', + dependencies : [openmp]) + +execpp = executable('execpp', + 'main.cpp', + dependencies : [openmp]) + +env = environment() +env.set('OMP_NUM_THREADS', '2') + +test('OpenMP C', exec, env : env) +test('OpenMP C++', execpp, env : env) + + +if add_languages('fortran', required : false) + exef = executable('exef', + 'main.f90', + dependencies : [openmp]) + + test('OpenMP Fortran', execpp, env : env) +endif diff --git a/test cases/failing/72 override used/meson.build b/test cases/failing/72 override used/meson.build deleted file mode 100644 index 61885bba1..000000000 --- a/test cases/failing/72 override used/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('overridde an already found exe', 'c') - -old = find_program('something.py') -replacement = find_program('other.py') -meson.override_find_program('something.py', replacement) diff --git a/test cases/failing/72 override used/other.py b/test cases/failing/72 override used/other.py deleted file mode 100755 index f62ba960d..000000000 --- a/test cases/failing/72 override used/other.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print('Doing something else.') diff --git a/test cases/failing/72 override used/something.py b/test cases/failing/72 override used/something.py deleted file mode 100755 index 64c9454c3..000000000 --- a/test cases/failing/72 override used/something.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python3 - -print('Doing something.') diff --git a/test cases/failing/74 override used/meson.build b/test cases/failing/74 override used/meson.build new file mode 100644 index 000000000..61885bba1 --- /dev/null +++ b/test cases/failing/74 override used/meson.build @@ -0,0 +1,5 @@ +project('overridde an already found exe', 'c') + +old = find_program('something.py') +replacement = find_program('other.py') +meson.override_find_program('something.py', replacement) diff --git a/test cases/failing/74 override used/other.py b/test cases/failing/74 override used/other.py new file mode 100755 index 000000000..f62ba960d --- /dev/null +++ b/test cases/failing/74 override used/other.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('Doing something else.') diff --git a/test cases/failing/74 override used/something.py b/test cases/failing/74 override used/something.py new file mode 100755 index 000000000..64c9454c3 --- /dev/null +++ b/test cases/failing/74 override used/something.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 + +print('Doing something.') -- cgit v1.2.3