Skip to content

Commit

Permalink
Add a test for the custom target incdirs change
Browse files Browse the repository at this point in the history
  • Loading branch information
nirbheek committed Sep 11, 2017
1 parent 62f45cd commit 6beefac
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 2 deletions.
4 changes: 3 additions & 1 deletion run_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ def test_internal_include_order(self):
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
Expand All @@ -916,6 +916,8 @@ def test_internal_include_order(self):
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)
Expand Down
6 changes: 6 additions & 0 deletions test cases/common/138 include order/ctsub/copyfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3

import sys
import shutil

shutil.copyfile(sys.argv[1], sys.argv[2])
Empty file.
1 change: 1 addition & 0 deletions test cases/common/138 include order/ctsub/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#error "ctsub/main.h included"
9 changes: 9 additions & 0 deletions test cases/common/138 include order/ctsub/meson.build
Original file line number Diff line number Diff line change
@@ -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@'])
2 changes: 2 additions & 0 deletions test cases/common/138 include order/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test cases/common/138 include order/sub4/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
e = executable('someexe', 'main.c',
e = executable('someexe', 'main.c', ctfile,
c_args : ['-I' + sub3],
include_directories : j,
dependencies : dep)
Expand Down

0 comments on commit 6beefac

Please sign in to comment.