summaryrefslogtreecommitdiffstats
path: root/test cases/native/3 pipeline/depends
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/native/3 pipeline/depends
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/native/3 pipeline/depends')
-rwxr-xr-xtest cases/native/3 pipeline/depends/copyrunner.py7
-rw-r--r--test cases/native/3 pipeline/depends/filecopier.c23
-rw-r--r--test cases/native/3 pipeline/depends/libsrc.c.in3
-rw-r--r--test cases/native/3 pipeline/depends/meson.build11
-rw-r--r--test cases/native/3 pipeline/depends/prog.c5
5 files changed, 49 insertions, 0 deletions
diff --git a/test cases/native/3 pipeline/depends/copyrunner.py b/test cases/native/3 pipeline/depends/copyrunner.py
new file mode 100755
index 0000000..0ef6a6d
--- /dev/null
+++ b/test cases/native/3 pipeline/depends/copyrunner.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python3
+
+import sys, subprocess
+
+prog, infile, outfile = sys.argv[1:]
+
+subprocess.check_call([prog, infile, outfile])
diff --git a/test cases/native/3 pipeline/depends/filecopier.c b/test cases/native/3 pipeline/depends/filecopier.c
new file mode 100644
index 0000000..e10e4e7
--- /dev/null
+++ b/test cases/native/3 pipeline/depends/filecopier.c
@@ -0,0 +1,23 @@
+#include<stdio.h>
+#include<assert.h>
+
+#define BUFSIZE 1024
+
+int main(int argc, char **argv) {
+ char buffer[BUFSIZE];
+ size_t num_read;
+ size_t num_written;
+ FILE *fin = fopen(argv[1], "rb");
+ FILE *fout;
+ assert(argc>0);
+ assert(fin);
+ num_read = fread(buffer, 1, BUFSIZE, fin);
+ assert(num_read > 0);
+ fclose(fin);
+ fout = fopen(argv[2], "wb");
+ assert(fout);
+ num_written = fwrite(buffer, 1, num_read, fout);
+ assert(num_written == num_read);
+ fclose(fout);
+ return 0;
+}
diff --git a/test cases/native/3 pipeline/depends/libsrc.c.in b/test cases/native/3 pipeline/depends/libsrc.c.in
new file mode 100644
index 0000000..8180551
--- /dev/null
+++ b/test cases/native/3 pipeline/depends/libsrc.c.in
@@ -0,0 +1,3 @@
+int func(void) {
+ return 42;
+}
diff --git a/test cases/native/3 pipeline/depends/meson.build b/test cases/native/3 pipeline/depends/meson.build
new file mode 100644
index 0000000..5111fee
--- /dev/null
+++ b/test cases/native/3 pipeline/depends/meson.build
@@ -0,0 +1,11 @@
+runner = find_program('copyrunner.py')
+
+copier = executable('copier', 'filecopier.c', native: true)
+
+cg = generator(runner,
+ output: ['@BASENAME@.c'],
+ arguments: [copier.full_path(), '@INPUT@', '@OUTPUT@'],
+ depends: copier)
+
+test('generatordep',
+ executable('gd', 'prog.c', cg.process('libsrc.c.in')))
diff --git a/test cases/native/3 pipeline/depends/prog.c b/test cases/native/3 pipeline/depends/prog.c
new file mode 100644
index 0000000..54c40e1
--- /dev/null
+++ b/test cases/native/3 pipeline/depends/prog.c
@@ -0,0 +1,5 @@
+int func(void);
+
+int main(void) {
+ return func() != 42;
+}