summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2023-03-31 01:11:19 +0200
committerBarnabás Pőcze <pobrn@protonmail.com>2023-03-31 01:20:13 +0200
commitea5a82ee26512f978453af650c89994af8bb3253 (patch)
tree2e1602b91210b9083ae806e574d063fb7b3499db
parent9c526974dcfad0191d77550bd636f242bbfa8367 (diff)
downloadmeson-0.tryme.tar.gz
tests: add test to ensure that build dir is preferred to src dir0.tryme
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.
-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 000000000..3c100c496
--- /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 000000000..0b07943b8
--- /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 9f275b866..8e05866ca 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 775e34fa1..6784af747 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"