From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- .../128 build by default targets in tests/main.c | 3 +++ .../meson.build | 23 ++++++++++++++++++++++ .../write_file.py | 6 ++++++ 3 files changed, 32 insertions(+) create mode 100644 test cases/common/128 build by default targets in tests/main.c create mode 100644 test cases/common/128 build by default targets in tests/meson.build create mode 100644 test cases/common/128 build by default targets in tests/write_file.py (limited to 'test cases/common/128 build by default targets in tests') diff --git a/test cases/common/128 build by default targets in tests/main.c b/test cases/common/128 build by default targets in tests/main.c new file mode 100644 index 0000000..03b2213 --- /dev/null +++ b/test cases/common/128 build by default targets in tests/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} diff --git a/test cases/common/128 build by default targets in tests/meson.build b/test cases/common/128 build by default targets in tests/meson.build new file mode 100644 index 0000000..5cc5055 --- /dev/null +++ b/test cases/common/128 build by default targets in tests/meson.build @@ -0,0 +1,23 @@ +project('unit-test', 'c', version : '1.0') + +write_file = find_program('write_file.py') + +# A test that consumes and verifies the output generated by a custom target. +# Should work even if target is not built by default. Makes sure that foo.out +# is actually created before the test command that uses foo_out is run. +foo_out = custom_target('foo.out', + output : 'foo.out', + command : [write_file, '@OUTPUT@']) + +# Also verify that a build_by_default : false BuildTarget added to a test is +# built before the test is run. +exe_out = executable('out', 'main.c', build_by_default : false) + +py_file_exists = '''import os, sys +if not os.path.exists(sys.argv[1]) or not os.path.exists(sys.argv[2]): + print("could not find {!r} or {!r} in {!r}" + "".format(sys.argv[1], sys.argv[2], os.getcwd())) + sys.exit(1)''' + +python = import('python3').find_python() +test('output-check', python, args : ['-c', py_file_exists, foo_out, exe_out]) diff --git a/test cases/common/128 build by default targets in tests/write_file.py b/test cases/common/128 build by default targets in tests/write_file.py new file mode 100644 index 0000000..ff9c224 --- /dev/null +++ b/test cases/common/128 build by default targets in tests/write_file.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[1], 'w') as f: + f.write('Test') -- cgit v1.2.3