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
pull/2191/head
Nirbheek Chauhan 7 years ago
parent cae5caa7f1
commit 0c518a8077
  1. 13
      run_unittests.py
  2. 1
      test cases/common/159 reserved targets/PHONY/meson.build
  3. 1
      test cases/common/159 reserved targets/all/meson.build
  4. 1
      test cases/common/159 reserved targets/benchmark/meson.build
  5. 1
      test cases/common/159 reserved targets/clean-ctlist/meson.build
  6. 1
      test cases/common/159 reserved targets/clean-gcda/meson.build
  7. 1
      test cases/common/159 reserved targets/clean-gcno/meson.build
  8. 1
      test cases/common/159 reserved targets/clean/meson.build
  9. 1
      test cases/common/159 reserved targets/coverage-html/meson.build
  10. 1
      test cases/common/159 reserved targets/coverage-text/meson.build
  11. 1
      test cases/common/159 reserved targets/coverage-xml/meson.build
  12. 1
      test cases/common/159 reserved targets/coverage/meson.build
  13. 1
      test cases/common/159 reserved targets/dist/meson.build
  14. 1
      test cases/common/159 reserved targets/distcheck/meson.build
  15. 1
      test cases/common/159 reserved targets/install/meson.build
  16. 28
      test cases/common/159 reserved targets/meson.build
  17. 1
      test cases/common/159 reserved targets/phony/meson.build
  18. 1
      test cases/common/159 reserved targets/reconfigure/meson.build
  19. 2
      test cases/common/159 reserved targets/runtarget/meson.build
  20. 1
      test cases/common/159 reserved targets/scan-build/meson.build
  21. 3
      test cases/common/159 reserved targets/test.c
  22. 1
      test cases/common/159 reserved targets/test/meson.build
  23. 1
      test cases/common/159 reserved targets/uninstall/meson.build

@ -30,6 +30,7 @@ import mesonbuild.mlog
import mesonbuild.compilers import mesonbuild.compilers
import mesonbuild.environment import mesonbuild.environment
import mesonbuild.mesonlib import mesonbuild.mesonlib
import mesonbuild.coredata
from mesonbuild.mesonlib import is_linux, is_windows, is_osx, is_cygwin, windows_proof_rmtree from mesonbuild.mesonlib import is_linux, is_windows, is_osx, is_cygwin, windows_proof_rmtree
from mesonbuild.environment import Environment from mesonbuild.environment import Environment
from mesonbuild.dependencies import DependencyException 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 or
'"/D" "FOO" "/D" "BAR"' in cmd) '"/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): class FailureTests(BasePlatformTests):
''' '''

@ -0,0 +1 @@
executable('test-PHONY', '../test.c')

@ -0,0 +1 @@
executable('test-all', '../test.c')

@ -0,0 +1 @@
executable('test-benchmark', '../test.c')

@ -0,0 +1 @@
executable('test-clean-ctlist', '../test.c')

@ -0,0 +1 @@
executable('test-clean-gcda', '../test.c')

@ -0,0 +1 @@
executable('test-clean-gcno', '../test.c')

@ -0,0 +1 @@
executable('test-clean', '../test.c')

@ -0,0 +1 @@
executable('test-coverage-html', '../test.c')

@ -0,0 +1 @@
executable('test-coverage-text', '../test.c')

@ -0,0 +1 @@
executable('test-coverage-xml', '../test.c')

@ -0,0 +1 @@
executable('test-coverage', '../test.c')

@ -0,0 +1 @@
executable('test-dist', '../test.c')

@ -0,0 +1 @@
executable('test-distcheck', '../test.c')

@ -0,0 +1 @@
executable('test-install', '../test.c')

@ -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)

@ -0,0 +1 @@
executable('test-phony', '../test.c')

@ -0,0 +1 @@
executable('test-reconfigure', '../test.c')

@ -0,0 +1,2 @@
configure_file(output : 'config.h', configuration: configuration_data())
run_target('runtarget', command : ['echo'])

@ -0,0 +1 @@
executable('test-scan-build', '../test.c')

@ -0,0 +1,3 @@
int main(int argc, char *argv[]) {
return 0;
}

@ -0,0 +1 @@
executable('test-test', '../test.c')

@ -0,0 +1 @@
executable('test-uninstall', '../test.c')
Loading…
Cancel
Save