From 6beefac09a8cd0cedb2b1ec6fc41e4a7109264c1 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 7 Sep 2017 21:38:02 +0530 Subject: Add a test for the custom target incdirs change https://github.com/mesonbuild/meson/pull/2291 --- run_unittests.py | 4 +++- test cases/common/138 include order/ctsub/copyfile.py | 6 ++++++ test cases/common/138 include order/ctsub/emptyfile.c | 0 test cases/common/138 include order/ctsub/main.h | 1 + test cases/common/138 include order/ctsub/meson.build | 9 +++++++++ test cases/common/138 include order/meson.build | 2 ++ test cases/common/138 include order/sub4/meson.build | 2 +- 7 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test cases/common/138 include order/ctsub/copyfile.py create mode 100644 test cases/common/138 include order/ctsub/emptyfile.c create mode 100644 test cases/common/138 include order/ctsub/main.h create mode 100644 test cases/common/138 include order/ctsub/meson.build diff --git a/run_unittests.py b/run_unittests.py index f33824a..377374f 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -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) diff --git a/test cases/common/138 include order/ctsub/copyfile.py b/test cases/common/138 include order/ctsub/copyfile.py new file mode 100644 index 0000000..ff42ac3 --- /dev/null +++ b/test cases/common/138 include order/ctsub/copyfile.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +import shutil + +shutil.copyfile(sys.argv[1], sys.argv[2]) diff --git a/test cases/common/138 include order/ctsub/emptyfile.c b/test cases/common/138 include order/ctsub/emptyfile.c new file mode 100644 index 0000000..e69de29 diff --git a/test cases/common/138 include order/ctsub/main.h b/test cases/common/138 include order/ctsub/main.h new file mode 100644 index 0000000..9d9acf3 --- /dev/null +++ b/test cases/common/138 include order/ctsub/main.h @@ -0,0 +1 @@ +#error "ctsub/main.h included" diff --git a/test cases/common/138 include order/ctsub/meson.build b/test cases/common/138 include order/ctsub/meson.build new file mode 100644 index 0000000..a242e07 --- /dev/null +++ b/test cases/common/138 include order/ctsub/meson.build @@ -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@']) diff --git a/test cases/common/138 include order/meson.build b/test cases/common/138 include order/meson.build index c79cb0a..c370bb1 100644 --- a/test cases/common/138 include order/meson.build +++ b/test cases/common/138 include order/meson.build @@ -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 diff --git a/test cases/common/138 include order/sub4/meson.build b/test cases/common/138 include order/sub4/meson.build index ab4c455..c01edaa 100644 --- a/test cases/common/138 include order/sub4/meson.build +++ b/test cases/common/138 include order/sub4/meson.build @@ -1,4 +1,4 @@ -e = executable('someexe', 'main.c', +e = executable('someexe', 'main.c', ctfile, c_args : ['-I' + sub3], include_directories : j, dependencies : dep) -- cgit v1.1