aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2023-03-31 01:11:19 +0200
committerEli Schwartz <eschwartz93@gmail.com>2023-03-30 22:06:31 -0400
commit410f3dfc1b76ef42275a769a794503b41ea1ae29 (patch)
tree2e1602b91210b9083ae806e574d063fb7b3499db /test cases
parent9c526974dcfad0191d77550bd636f242bbfa8367 (diff)
downloadmeson-410f3dfc1b76ef42275a769a794503b41ea1ae29.zip
meson-410f3dfc1b76ef42275a769a794503b41ea1ae29.tar.gz
meson-410f3dfc1b76ef42275a769a794503b41ea1ae29.tar.bz2
tests: add test to ensure that build dir is preferred to src dir
Extend the "common/include order" test to ensure that the build directory is preferred over the source directory. For example, when using `configure_file()`, the resulting file should be preferred over a file with the same name in the source directory.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/130 include order/inc3/meson.build2
-rw-r--r--test cases/common/130 include order/inc3/prefer-build-dir-over-src-dir.h1
-rw-r--r--test cases/common/130 include order/meson.build4
-rw-r--r--test cases/common/130 include order/ordertest.c1
4 files changed, 7 insertions, 1 deletions
diff --git a/test cases/common/130 include order/inc3/meson.build b/test cases/common/130 include order/inc3/meson.build
new file mode 100644
index 0000000..3c100c4
--- /dev/null
+++ b/test cases/common/130 include order/inc3/meson.build
@@ -0,0 +1,2 @@
+configure_file(output: 'prefer-build-dir-over-src-dir.h',
+ configuration: configuration_data())
diff --git a/test cases/common/130 include order/inc3/prefer-build-dir-over-src-dir.h b/test cases/common/130 include order/inc3/prefer-build-dir-over-src-dir.h
new file mode 100644
index 0000000..0b07943
--- /dev/null
+++ b/test cases/common/130 include order/inc3/prefer-build-dir-over-src-dir.h
@@ -0,0 +1 @@
+#error "inc3/prefer-build-dir-over-src-dir.h included"
diff --git a/test cases/common/130 include order/meson.build b/test cases/common/130 include order/meson.build
index 9f275b8..8e05866 100644
--- a/test cases/common/130 include order/meson.build
+++ b/test cases/common/130 include order/meson.build
@@ -12,6 +12,8 @@ project('include order', 'c')
# Custom target dir with a built header
subdir('ctsub')
+# Configures a header file
+subdir('inc3')
# Defines an internal dep
subdir('sub1')
# Defines a per-target include path
@@ -32,5 +34,5 @@ test('eh', e)
test('oh', f)
# Test that the order in include_directories() is maintained
-incs = include_directories('inc1', 'inc2')
+incs = include_directories('inc1', 'inc2', 'inc3')
executable('ordertest', 'ordertest.c', include_directories: incs)
diff --git a/test cases/common/130 include order/ordertest.c b/test cases/common/130 include order/ordertest.c
index 775e34f..6784af7 100644
--- a/test cases/common/130 include order/ordertest.c
+++ b/test cases/common/130 include order/ordertest.c
@@ -1,4 +1,5 @@
#include "hdr.h"
+#include "prefer-build-dir-over-src-dir.h"
#if !defined(SOME_DEFINE) || SOME_DEFINE != 42
#error "Should have picked up hdr.h from inc1/hdr.h"