summaryrefslogtreecommitdiff
path: root/test cases/common
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-03-11 14:58:23 +0200
committerNirbheek Chauhan <nirbheek@centricular.com>2018-04-15 13:32:38 +0530
commitde65adb8b100731ff31eee92da44b4cc10ac5aa3 (patch)
tree023b6dec62c5b45b8ce127fa03e53a19d133b9e1 /test cases/common
parent3f7c6cf3d6a204e9665faad3c05bb5049f08ac74 (diff)
downloadmeson-de65adb8b100731ff31eee92da44b4cc10ac5aa3.tar.gz
Made it possible to override find_program to return a different program.
Closes https://github.com/mesonbuild/meson/issues/2005
Diffstat (limited to 'test cases/common')
-rw-r--r--test cases/common/182 find override/meson.build4
-rw-r--r--test cases/common/182 find override/otherdir/main.c5
-rw-r--r--test cases/common/182 find override/otherdir/meson.build11
-rw-r--r--test cases/common/182 find override/otherdir/source.desc1
-rwxr-xr-xtest cases/common/182 find override/subdir/converter.py15
-rw-r--r--test cases/common/182 find override/subdir/meson.build3
6 files changed, 39 insertions, 0 deletions
diff --git a/test cases/common/182 find override/meson.build b/test cases/common/182 find override/meson.build
new file mode 100644
index 000000000..ebf3a050f
--- /dev/null
+++ b/test cases/common/182 find override/meson.build
@@ -0,0 +1,4 @@
+project('find program override', 'c')
+
+subdir('subdir')
+subdir('otherdir')
diff --git a/test cases/common/182 find override/otherdir/main.c b/test cases/common/182 find override/otherdir/main.c
new file mode 100644
index 000000000..2cef67c8d
--- /dev/null
+++ b/test cases/common/182 find override/otherdir/main.c
@@ -0,0 +1,5 @@
+int be_seeing_you();
+
+int main(int argc, char **argv) {
+ return be_seeing_you() == 6 ? 0 : 1;
+}
diff --git a/test cases/common/182 find override/otherdir/meson.build b/test cases/common/182 find override/otherdir/meson.build
new file mode 100644
index 000000000..84e7e84e8
--- /dev/null
+++ b/test cases/common/182 find override/otherdir/meson.build
@@ -0,0 +1,11 @@
+gen = find_program('codegen') # Should use overridden value set in "subdir".
+
+src = custom_target('arrival',
+ input : 'source.desc',
+ output : 'file.c',
+ command : [gen, '@INPUT@', '@OUTPUT@']
+ )
+
+e = executable('six', 'main.c', src)
+
+test('six', e)
diff --git a/test cases/common/182 find override/otherdir/source.desc b/test cases/common/182 find override/otherdir/source.desc
new file mode 100644
index 000000000..8b19c9c2f
--- /dev/null
+++ b/test cases/common/182 find override/otherdir/source.desc
@@ -0,0 +1 @@
+be_seeing_you
diff --git a/test cases/common/182 find override/subdir/converter.py b/test cases/common/182 find override/subdir/converter.py
new file mode 100755
index 000000000..55b2a7071
--- /dev/null
+++ b/test cases/common/182 find override/subdir/converter.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import sys
+import pathlib
+
+[ifilename, ofilename] = sys.argv[1:3]
+
+ftempl = '''int %s() {
+ return 6;
+}
+'''
+
+d = pathlib.Path(ifilename).read_text().split('\n')[0].strip()
+
+pathlib.Path(ofilename).write_text(ftempl % d) \ No newline at end of file
diff --git a/test cases/common/182 find override/subdir/meson.build b/test cases/common/182 find override/subdir/meson.build
new file mode 100644
index 000000000..0d1f9d03b
--- /dev/null
+++ b/test cases/common/182 find override/subdir/meson.build
@@ -0,0 +1,3 @@
+x = find_program('converter.py')
+
+meson.override_find_program('codegen', x)