From 708e4b1258d3cdad5c88fa31a6c2fa0890a8415c Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Sun, 25 Mar 2018 00:50:42 +0000 Subject: [PATCH] Add test case for test(depends) keyword parameter --- test cases/common/188 test depends/gen.py | 13 ++++++++++ test cases/common/188 test depends/main.c | 1 + .../common/188 test depends/meson.build | 26 +++++++++++++++++++ test cases/common/188 test depends/test.py | 20 ++++++++++++++ 4 files changed, 60 insertions(+) create mode 100755 test cases/common/188 test depends/gen.py create mode 100644 test cases/common/188 test depends/main.c create mode 100644 test cases/common/188 test depends/meson.build create mode 100755 test cases/common/188 test depends/test.py diff --git a/test cases/common/188 test depends/gen.py b/test cases/common/188 test depends/gen.py new file mode 100755 index 000000000..ee4ed9818 --- /dev/null +++ b/test cases/common/188 test depends/gen.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys + + +def main(): + with open(sys.argv[1], 'w') as out: + out.write(sys.argv[2]) + out.write('\n') + + +if __name__ == '__main__': + main() diff --git a/test cases/common/188 test depends/main.c b/test cases/common/188 test depends/main.c new file mode 100644 index 000000000..78f2de106 --- /dev/null +++ b/test cases/common/188 test depends/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/test cases/common/188 test depends/meson.build b/test cases/common/188 test depends/meson.build new file mode 100644 index 000000000..888c45118 --- /dev/null +++ b/test cases/common/188 test depends/meson.build @@ -0,0 +1,26 @@ +project('test depends', 'c') + +gen = find_program('gen.py') + +custom_dep = custom_target('custom_dep', + build_by_default : false, + output : 'custom_dep.txt', + command : [gen, '@OUTPUT@', 'custom_dep'], +) + +exe_dep = executable('exe_dep', 'main.c', + build_by_default : false, +) + +test_prog = find_program('test.py') +test('string dependencies', test_prog, + args : [ + # This is declared for convenience, + # real use case might have some obscure method + # to find these dependencies, e.g. automatic plugin loading. + 'custom_dep.txt', + exe_dep.full_path(), + ], + depends : [custom_dep, exe_dep], + workdir : meson.current_build_dir(), +) diff --git a/test cases/common/188 test depends/test.py b/test cases/common/188 test depends/test.py new file mode 100755 index 000000000..5b9f65c86 --- /dev/null +++ b/test cases/common/188 test depends/test.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import os +import os.path +import sys + + +def main(): + print('Looking in:', os.getcwd()) + not_found = list() + for f in sys.argv[1:]: + if not os.path.exists(f): + not_found.append(f) + if not_found: + print('Not found:', ', '.join(not_found)) + sys.exit(1) + + +if __name__ == '__main__': + main()