summaryrefslogtreecommitdiffstats
path: root/test cases/common/129 build by default
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test cases/common/129 build by default/checkexists.py10
-rw-r--r--test cases/common/129 build by default/foo.c6
-rw-r--r--test cases/common/129 build by default/meson.build44
-rw-r--r--test cases/common/129 build by default/mygen.py8
-rw-r--r--test cases/common/129 build by default/source.txt1
5 files changed, 69 insertions, 0 deletions
diff --git a/test cases/common/129 build by default/checkexists.py b/test cases/common/129 build by default/checkexists.py
new file mode 100644
index 0000000..6664f72
--- /dev/null
+++ b/test cases/common/129 build by default/checkexists.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os.path, sys
+
+invert = False
+for path in sys.argv[1:]:
+ if path == '--not':
+ invert = True
+ elif not os.path.exists(path) ^ invert:
+ sys.exit(1)
diff --git a/test cases/common/129 build by default/foo.c b/test cases/common/129 build by default/foo.c
new file mode 100644
index 0000000..0322828
--- /dev/null
+++ b/test cases/common/129 build by default/foo.c
@@ -0,0 +1,6 @@
+#include<stdio.h>
+
+int main(void) {
+ printf("Existentialism.\n");
+ return 0;
+}
diff --git a/test cases/common/129 build by default/meson.build b/test cases/common/129 build by default/meson.build
new file mode 100644
index 0000000..b797f76
--- /dev/null
+++ b/test cases/common/129 build by default/meson.build
@@ -0,0 +1,44 @@
+project('build on all', 'c')
+
+py3_mod = import('python3')
+py3 = py3_mod.find_python()
+
+executable('fooprog', 'foo.c',
+ build_by_default : false,
+)
+
+executable('barprog', 'foo.c',
+ build_by_default : false,
+)
+
+comp = files('mygen.py')
+checkexists = files('checkexists.py')
+
+mytarget = custom_target('gendat1',
+ output : 'generated1.dat',
+ input : 'source.txt',
+ command : [py3] + comp + ['@INPUT@', '@OUTPUT@'],
+ build_by_default : true,
+)
+
+mytarget = custom_target('gendat2',
+ output : 'generated2.dat',
+ input : 'source.txt',
+ command : [py3] + comp + ['@INPUT@', '@OUTPUT@'],
+ build_by_default : true,
+ build_always : false,
+)
+
+ct1_output = join_paths(meson.build_root(), 'generated1.dat')
+ct2_output = join_paths(meson.build_root(), 'generated2.dat')
+exe1_output = join_paths(meson.build_root(), 'fooprog')
+exe2_output = join_paths(meson.build_root(), 'barprog')
+
+if host_machine.system() == 'windows'
+ exe1_output += '.exe'
+ exe2_output += '.exe'
+endif
+
+test('check-build-by-default', py3,
+ args : [checkexists,
+ ct1_output, ct2_output, '--not', exe1_output, exe2_output])
diff --git a/test cases/common/129 build by default/mygen.py b/test cases/common/129 build by default/mygen.py
new file mode 100644
index 0000000..5a74153
--- /dev/null
+++ b/test cases/common/129 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/129 build by default/source.txt b/test cases/common/129 build by default/source.txt
new file mode 100644
index 0000000..3573f4b
--- /dev/null
+++ b/test cases/common/129 build by default/source.txt
@@ -0,0 +1 @@
+I am a bunch of text.