Add a test for the custom target incdirs change

https://github.com/mesonbuild/meson/pull/2291
pull/2291/head
Nirbheek Chauhan 7 years ago
parent 5b1babd611
commit db199b06e6
  1. 4
      run_unittests.py
  2. 6
      test cases/common/138 include order/ctsub/copyfile.py
  3. 0
      test cases/common/138 include order/ctsub/emptyfile.c
  4. 1
      test cases/common/138 include order/ctsub/main.h
  5. 9
      test cases/common/138 include order/ctsub/meson.build
  6. 2
      test cases/common/138 include order/meson.build
  7. 2
      test cases/common/138 include order/sub4/meson.build

@ -899,7 +899,7 @@ class AllPlatformTests(BasePlatformTests):
raise Exception('Could not find someexe and somfxe commands')
# Check include order for 'someexe'
incs = [a for a in shlex.split(execmd) if a.startswith("-I")]
self.assertEqual(len(incs), 8)
self.assertEqual(len(incs), 9)
# target private dir
self.assertPathEqual(incs[0], "-Isub4/someexe@exe")
# target build subdir
@ -916,6 +916,8 @@ class AllPlatformTests(BasePlatformTests):
self.assertPathEqual(incs[6], "-Isub1")
# target internal dependency include_directories: source dir
self.assertPathBasenameEqual(incs[7], 'sub1')
# custom target include dir
self.assertPathEqual(incs[8], '-Ictsub')
# Check include order for 'somefxe'
incs = [a for a in shlex.split(fxecmd) if a.startswith('-I')]
self.assertEqual(len(incs), 9)

@ -0,0 +1,6 @@
#!/usr/bin/env python3
import sys
import shutil
shutil.copyfile(sys.argv[1], sys.argv[2])

@ -0,0 +1 @@
#error "ctsub/main.h included"

@ -0,0 +1,9 @@
# https://github.com/mesonbuild/meson/pull/2291
copy = find_program('copyfile.py')
configure_file(input : 'main.h',
output : 'main.h',
command : [copy, '@INPUT@', '@OUTPUT@'])
ctfile = custom_target('emptyfile',
input : 'emptyfile.c',
output : 'emptyfile.c',
command : [copy, '@INPUT@', '@OUTPUT@'])

@ -10,6 +10,8 @@ project('include order', 'c')
# 5. Include paths added via `include_directories:` of internal deps
# Within this, the build dir takes precedence over the source dir
# Custom target dir with a built header
subdir('ctsub')
# Defines an internal dep
subdir('sub1')
# Defines a per-target include path

@ -1,4 +1,4 @@
e = executable('someexe', 'main.c',
e = executable('someexe', 'main.c', ctfile,
c_args : ['-I' + sub3],
include_directories : j,
dependencies : dep)

Loading…
Cancel
Save