diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-08-14 23:31:34 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-08-15 00:01:33 +0530 |
commit | 0c518a8077c200ffed61fad3ada7c726a5a6cbfd (patch) | |
tree | 8f705b14e1478af3e1166f707dc8e95f5ed7fe9e | |
parent | cae5caa7f1d804b8821bf55081707597e73fb7a1 (diff) | |
download | meson-0c518a8077c200ffed61fad3ada7c726a5a6cbfd.zip meson-0c518a8077c200ffed61fad3ada7c726a5a6cbfd.tar.gz meson-0c518a8077c200ffed61fad3ada7c726a5a6cbfd.tar.bz2 |
Add a test for dirs with reserved target names
And for dirs with the same name as run_target()s
Reproduces https://github.com/mesonbuild/meson/issues/1644
23 files changed, 65 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index f28672b..b889c3d 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -30,6 +30,7 @@ import mesonbuild.mlog import mesonbuild.compilers import mesonbuild.environment import mesonbuild.mesonlib +import mesonbuild.coredata from mesonbuild.mesonlib import is_linux, is_windows, is_osx, is_cygwin, windows_proof_rmtree from mesonbuild.environment import Environment from mesonbuild.dependencies import DependencyException @@ -1278,6 +1279,18 @@ int main(int argc, char **argv) { '/D FOO /D BAR' in cmd or '"/D" "FOO" "/D" "BAR"' in cmd) + def test_all_forbidden_targets_tested(self): + ''' + Test that all forbidden targets are tested in the '159 reserved targets' + test. Needs to be a unit test because it accesses Meson internals. + ''' + testdir = os.path.join(self.common_test_dir, '159 reserved targets') + targets = mesonbuild.coredata.forbidden_target_names + # We don't actually define a target with this name + targets.pop('build.ninja') + for i in targets: + self.assertPathExists(os.path.join(testdir, i)) + class FailureTests(BasePlatformTests): ''' diff --git a/test cases/common/159 reserved targets/PHONY/meson.build b/test cases/common/159 reserved targets/PHONY/meson.build new file mode 100644 index 0000000..d25583c --- /dev/null +++ b/test cases/common/159 reserved targets/PHONY/meson.build @@ -0,0 +1 @@ +executable('test-PHONY', '../test.c') diff --git a/test cases/common/159 reserved targets/all/meson.build b/test cases/common/159 reserved targets/all/meson.build new file mode 100644 index 0000000..adee882 --- /dev/null +++ b/test cases/common/159 reserved targets/all/meson.build @@ -0,0 +1 @@ +executable('test-all', '../test.c') diff --git a/test cases/common/159 reserved targets/benchmark/meson.build b/test cases/common/159 reserved targets/benchmark/meson.build new file mode 100644 index 0000000..242cc23 --- /dev/null +++ b/test cases/common/159 reserved targets/benchmark/meson.build @@ -0,0 +1 @@ +executable('test-benchmark', '../test.c') diff --git a/test cases/common/159 reserved targets/clean-ctlist/meson.build b/test cases/common/159 reserved targets/clean-ctlist/meson.build new file mode 100644 index 0000000..75eb207 --- /dev/null +++ b/test cases/common/159 reserved targets/clean-ctlist/meson.build @@ -0,0 +1 @@ +executable('test-clean-ctlist', '../test.c') diff --git a/test cases/common/159 reserved targets/clean-gcda/meson.build b/test cases/common/159 reserved targets/clean-gcda/meson.build new file mode 100644 index 0000000..488a527 --- /dev/null +++ b/test cases/common/159 reserved targets/clean-gcda/meson.build @@ -0,0 +1 @@ +executable('test-clean-gcda', '../test.c') diff --git a/test cases/common/159 reserved targets/clean-gcno/meson.build b/test cases/common/159 reserved targets/clean-gcno/meson.build new file mode 100644 index 0000000..eec789a --- /dev/null +++ b/test cases/common/159 reserved targets/clean-gcno/meson.build @@ -0,0 +1 @@ +executable('test-clean-gcno', '../test.c') diff --git a/test cases/common/159 reserved targets/clean/meson.build b/test cases/common/159 reserved targets/clean/meson.build new file mode 100644 index 0000000..4e27b6c --- /dev/null +++ b/test cases/common/159 reserved targets/clean/meson.build @@ -0,0 +1 @@ +executable('test-clean', '../test.c') diff --git a/test cases/common/159 reserved targets/coverage-html/meson.build b/test cases/common/159 reserved targets/coverage-html/meson.build new file mode 100644 index 0000000..10a4cc8 --- /dev/null +++ b/test cases/common/159 reserved targets/coverage-html/meson.build @@ -0,0 +1 @@ +executable('test-coverage-html', '../test.c') diff --git a/test cases/common/159 reserved targets/coverage-text/meson.build b/test cases/common/159 reserved targets/coverage-text/meson.build new file mode 100644 index 0000000..21dcae5 --- /dev/null +++ b/test cases/common/159 reserved targets/coverage-text/meson.build @@ -0,0 +1 @@ +executable('test-coverage-text', '../test.c') diff --git a/test cases/common/159 reserved targets/coverage-xml/meson.build b/test cases/common/159 reserved targets/coverage-xml/meson.build new file mode 100644 index 0000000..44d7bfb --- /dev/null +++ b/test cases/common/159 reserved targets/coverage-xml/meson.build @@ -0,0 +1 @@ +executable('test-coverage-xml', '../test.c') diff --git a/test cases/common/159 reserved targets/coverage/meson.build b/test cases/common/159 reserved targets/coverage/meson.build new file mode 100644 index 0000000..b401055 --- /dev/null +++ b/test cases/common/159 reserved targets/coverage/meson.build @@ -0,0 +1 @@ +executable('test-coverage', '../test.c') diff --git a/test cases/common/159 reserved targets/dist/meson.build b/test cases/common/159 reserved targets/dist/meson.build new file mode 100644 index 0000000..951bbb4 --- /dev/null +++ b/test cases/common/159 reserved targets/dist/meson.build @@ -0,0 +1 @@ +executable('test-dist', '../test.c') diff --git a/test cases/common/159 reserved targets/distcheck/meson.build b/test cases/common/159 reserved targets/distcheck/meson.build new file mode 100644 index 0000000..12b9328 --- /dev/null +++ b/test cases/common/159 reserved targets/distcheck/meson.build @@ -0,0 +1 @@ +executable('test-distcheck', '../test.c') diff --git a/test cases/common/159 reserved targets/install/meson.build b/test cases/common/159 reserved targets/install/meson.build new file mode 100644 index 0000000..4839901 --- /dev/null +++ b/test cases/common/159 reserved targets/install/meson.build @@ -0,0 +1 @@ +executable('test-install', '../test.c') diff --git a/test cases/common/159 reserved targets/meson.build b/test cases/common/159 reserved targets/meson.build new file mode 100644 index 0000000..a173bf3 --- /dev/null +++ b/test cases/common/159 reserved targets/meson.build @@ -0,0 +1,28 @@ +project('reserved target names', 'c', + default_options : ['b_coverage=true']) + +subdir('all') +subdir('benchmark') +subdir('clean') +subdir('clean-ctlist') +subdir('clean-gcda') +subdir('clean-gcno') +subdir('coverage') +subdir('coverage-html') +subdir('coverage-text') +subdir('coverage-xml') +subdir('dist') +subdir('distcheck') +subdir('install') +subdir('phony') +subdir('PHONY') +subdir('reconfigure') +subdir('scan-build') +subdir('test') +subdir('uninstall') + +subdir('runtarget') + +custom_target('ctlist-test', output : 'out.txt', + command : ['echo'], capture : true, + build_by_default : true) diff --git a/test cases/common/159 reserved targets/phony/meson.build b/test cases/common/159 reserved targets/phony/meson.build new file mode 100644 index 0000000..6710fc1 --- /dev/null +++ b/test cases/common/159 reserved targets/phony/meson.build @@ -0,0 +1 @@ +executable('test-phony', '../test.c') diff --git a/test cases/common/159 reserved targets/reconfigure/meson.build b/test cases/common/159 reserved targets/reconfigure/meson.build new file mode 100644 index 0000000..c3ea3da --- /dev/null +++ b/test cases/common/159 reserved targets/reconfigure/meson.build @@ -0,0 +1 @@ +executable('test-reconfigure', '../test.c') diff --git a/test cases/common/159 reserved targets/runtarget/meson.build b/test cases/common/159 reserved targets/runtarget/meson.build new file mode 100644 index 0000000..52c371b --- /dev/null +++ b/test cases/common/159 reserved targets/runtarget/meson.build @@ -0,0 +1,2 @@ +configure_file(output : 'config.h', configuration: configuration_data()) +run_target('runtarget', command : ['echo']) diff --git a/test cases/common/159 reserved targets/scan-build/meson.build b/test cases/common/159 reserved targets/scan-build/meson.build new file mode 100644 index 0000000..1002053 --- /dev/null +++ b/test cases/common/159 reserved targets/scan-build/meson.build @@ -0,0 +1 @@ +executable('test-scan-build', '../test.c') diff --git a/test cases/common/159 reserved targets/test.c b/test cases/common/159 reserved targets/test.c new file mode 100644 index 0000000..0fb4389 --- /dev/null +++ b/test cases/common/159 reserved targets/test.c @@ -0,0 +1,3 @@ +int main(int argc, char *argv[]) { + return 0; +} diff --git a/test cases/common/159 reserved targets/test/meson.build b/test cases/common/159 reserved targets/test/meson.build new file mode 100644 index 0000000..4ab123c --- /dev/null +++ b/test cases/common/159 reserved targets/test/meson.build @@ -0,0 +1 @@ +executable('test-test', '../test.c') diff --git a/test cases/common/159 reserved targets/uninstall/meson.build b/test cases/common/159 reserved targets/uninstall/meson.build new file mode 100644 index 0000000..21c6ca6 --- /dev/null +++ b/test cases/common/159 reserved targets/uninstall/meson.build @@ -0,0 +1 @@ +executable('test-uninstall', '../test.c') |