aboutsummaryrefslogtreecommitdiff
path: root/test cases/common/74 ctarget dependency
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-08-03 01:37:46 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-03 02:29:44 +0300
commitf39600647d9fe95c91c80b0cc7e7a8c28524e778 (patch)
tree99f13e04856ec46b064bd0126de1a00b226914f5 /test cases/common/74 ctarget dependency
parent2e6df380f15643630f984311d8ab9ec693aba223 (diff)
downloadmeson-f39600647d9fe95c91c80b0cc7e7a8c28524e778.zip
meson-f39600647d9fe95c91c80b0cc7e7a8c28524e778.tar.gz
meson-f39600647d9fe95c91c80b0cc7e7a8c28524e778.tar.bz2
Condense test directory names.
Diffstat (limited to 'test cases/common/74 ctarget dependency')
-rwxr-xr-xtest cases/common/74 ctarget dependency/gen1.py12
-rwxr-xr-xtest cases/common/74 ctarget dependency/gen2.py10
-rw-r--r--test cases/common/74 ctarget dependency/input.dat1
-rw-r--r--test cases/common/74 ctarget dependency/meson.build20
4 files changed, 43 insertions, 0 deletions
diff --git a/test cases/common/74 ctarget dependency/gen1.py b/test cases/common/74 ctarget dependency/gen1.py
new file mode 100755
index 0000000..0fa6ea1
--- /dev/null
+++ b/test cases/common/74 ctarget dependency/gen1.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import time, sys
+
+# Make sure other script runs first if dependency
+# is missing.
+time.sleep(0.5)
+
+with open(sys.argv[1], 'r') as f:
+ contents = f.read()
+with open(sys.argv[2], 'w') as f:
+ f.write(contents)
diff --git a/test cases/common/74 ctarget dependency/gen2.py b/test cases/common/74 ctarget dependency/gen2.py
new file mode 100755
index 0000000..b087b02
--- /dev/null
+++ b/test cases/common/74 ctarget dependency/gen2.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import sys, os
+from glob import glob
+
+files = glob(os.path.join(sys.argv[1], '*.tmp'))
+assert(len(files) == 1)
+
+with open(files[0], 'r') as ifile, open(sys.argv[2], 'w') as ofile:
+ ofile.write(ifile.read())
diff --git a/test cases/common/74 ctarget dependency/input.dat b/test cases/common/74 ctarget dependency/input.dat
new file mode 100644
index 0000000..7af91e2
--- /dev/null
+++ b/test cases/common/74 ctarget dependency/input.dat
@@ -0,0 +1 @@
+This is a piece of text.
diff --git a/test cases/common/74 ctarget dependency/meson.build b/test cases/common/74 ctarget dependency/meson.build
new file mode 100644
index 0000000..cd11951
--- /dev/null
+++ b/test cases/common/74 ctarget dependency/meson.build
@@ -0,0 +1,20 @@
+project('custom target dependency', 'c')
+
+# Sometimes custom targets do not take input files
+# but instead do globbing or some similar wackiness.
+# In this case we need to be able to specify a
+# manual dependency between two custom targets,
+# if one needs to be run before the other.
+
+g1 = find_program('gen1.py')
+g2 = find_program('gen2.py')
+
+c1 = custom_target('medput',
+input : 'input.dat',
+output : 'medput.tmp',
+command : [g1, '@INPUT@', '@OUTPUT@'])
+
+custom_target('output',
+output : 'output.dat',
+command : [g2, '@OUTDIR@', '@OUTPUT@'],
+depends : c1)