aboutsummaryrefslogtreecommitdiff
path: root/test cases/common
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/common')
-rw-r--r--test cases/common/137 build by default/foo.c6
-rw-r--r--test cases/common/137 build by default/meson.build24
-rw-r--r--test cases/common/137 build by default/mygen.py8
-rw-r--r--test cases/common/137 build by default/source.txt1
4 files changed, 39 insertions, 0 deletions
diff --git a/test cases/common/137 build by default/foo.c b/test cases/common/137 build by default/foo.c
new file mode 100644
index 0000000..ca97916
--- /dev/null
+++ b/test cases/common/137 build by default/foo.c
@@ -0,0 +1,6 @@
+#include<stdio.h>
+
+int main(int argc, char **argv) {
+ printf("Existentialism.\n");
+ return 0;
+}
diff --git a/test cases/common/137 build by default/meson.build b/test cases/common/137 build by default/meson.build
new file mode 100644
index 0000000..6569548
--- /dev/null
+++ b/test cases/common/137 build by default/meson.build
@@ -0,0 +1,24 @@
+project('build on all', 'c')
+
+py3_mod = import('python3')
+py3 = py3_mod.find_python()
+
+executable('fooprog', 'foo.c', build_by_default : false)
+comp = files('mygen.py')
+mytarget = custom_target('gendat',
+ output : 'generated.dat',
+ input : 'source.txt',
+ command : [py3] + comp + ['@INPUT@', '@OUTPUT@'],
+ build_by_default : true,
+)
+
+ct_output = join_paths(meson.build_root(), 'generated.dat')
+exe_output = join_paths(meson.build_root(), 'fooprog')
+if host_machine.system() == 'windows'
+ exe_output += '.exe'
+endif
+
+ct_exists_exe_nexists = 'import os.path, sys; sys.exit(not os.path.exists(sys.argv[1]) and os.path.exists(sys.argv[2]))'
+
+test('check-build-by-default', py3,
+ args : ['-c', ct_exists_exe_nexists, ct_output, exe_output])
diff --git a/test cases/common/137 build by default/mygen.py b/test cases/common/137 build by default/mygen.py
new file mode 100644
index 0000000..5a74153
--- /dev/null
+++ b/test cases/common/137 build by default/mygen.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+
+import sys
+
+ifile = open(sys.argv[1])
+ofile = open(sys.argv[2], 'w')
+
+ofile.write(ifile.read())
diff --git a/test cases/common/137 build by default/source.txt b/test cases/common/137 build by default/source.txt
new file mode 100644
index 0000000..3573f4b
--- /dev/null
+++ b/test cases/common/137 build by default/source.txt
@@ -0,0 +1 @@
+I am a bunch of text.