From f0626e6cc15bfcba66e3218314f9aee5ba3d6052 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 13 Jun 2016 00:06:05 +0300 Subject: [PATCH] Created failing test for using generated outputs in a custom target. --- test cases/common/113 generatorcustom/catter.py | 13 +++++++++++++ test cases/common/113 generatorcustom/gen.py | 11 +++++++++++ test cases/common/113 generatorcustom/main.c | 7 +++++++ .../common/113 generatorcustom/meson.build | 17 +++++++++++++++++ test cases/common/113 generatorcustom/res1.txt | 1 + test cases/common/113 generatorcustom/res2.txt | 1 + 6 files changed, 50 insertions(+) create mode 100755 test cases/common/113 generatorcustom/catter.py create mode 100755 test cases/common/113 generatorcustom/gen.py create mode 100644 test cases/common/113 generatorcustom/main.c create mode 100644 test cases/common/113 generatorcustom/meson.build create mode 100644 test cases/common/113 generatorcustom/res1.txt create mode 100644 test cases/common/113 generatorcustom/res2.txt diff --git a/test cases/common/113 generatorcustom/catter.py b/test cases/common/113 generatorcustom/catter.py new file mode 100755 index 000000000..1ee0f538c --- /dev/null +++ b/test cases/common/113 generatorcustom/catter.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys, os + +output = sys.argv[1] +inputs = sys.argv[2:] + +with open(output, 'w') as ofile: + ofile.write('#pragma once\n') + for i in inputs: + content = open(i, 'r').read() + i.write(content) + i.write('\n') diff --git a/test cases/common/113 generatorcustom/gen.py b/test cases/common/113 generatorcustom/gen.py new file mode 100755 index 000000000..2fc0fdddf --- /dev/null +++ b/test cases/common/113 generatorcustom/gen.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import sys, os + +ifile = sys.argv[1] +ofile = sys.argv[2] + +resname = open(ifile, 'r').readline().strip() + +templ = 'char %s[] = "%s";\n' +open(ofile, 'w').write(templ % (resname, resname)) diff --git a/test cases/common/113 generatorcustom/main.c b/test cases/common/113 generatorcustom/main.c new file mode 100644 index 000000000..04abcf69a --- /dev/null +++ b/test cases/common/113 generatorcustom/main.c @@ -0,0 +1,7 @@ +#include + +#include"alltogether.h" + +int main(int argc, char **argv) { + return 0; +} diff --git a/test cases/common/113 generatorcustom/meson.build b/test cases/common/113 generatorcustom/meson.build new file mode 100644 index 000000000..529f28a82 --- /dev/null +++ b/test cases/common/113 generatorcustom/meson.build @@ -0,0 +1,17 @@ +project('generatorcustom', 'c') + +creator = find_program('gen.py') +catter = find_program('catter.py') + +gen = generator(creator, + output: '@BASENAME@.h', + arguments : ['@INPUT@', '@OUTPUT@']) + +hs = gen.process('res1.txt', 'res2.txt') + +all_headers_in_one = custom_target('alltogether', + input : hs, + output : 'alltogether.h', + command : [catter, '@INPUT@', '@OUTPUT@']) + +executable('proggie', 'main.c', hs) diff --git a/test cases/common/113 generatorcustom/res1.txt b/test cases/common/113 generatorcustom/res1.txt new file mode 100644 index 000000000..6487c56ba --- /dev/null +++ b/test cases/common/113 generatorcustom/res1.txt @@ -0,0 +1 @@ +res1 diff --git a/test cases/common/113 generatorcustom/res2.txt b/test cases/common/113 generatorcustom/res2.txt new file mode 100644 index 000000000..0a8879d51 --- /dev/null +++ b/test cases/common/113 generatorcustom/res2.txt @@ -0,0 +1 @@ +res2