diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-03-11 14:58:23 +0200 |
|---|---|---|
| committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-04-15 13:32:38 +0530 |
| commit | de65adb8b100731ff31eee92da44b4cc10ac5aa3 (patch) | |
| tree | 023b6dec62c5b45b8ce127fa03e53a19d133b9e1 /test cases/common | |
| parent | 3f7c6cf3d6a204e9665faad3c05bb5049f08ac74 (diff) | |
| download | meson-de65adb8b100731ff31eee92da44b4cc10ac5aa3.tar.gz | |
Made it possible to override find_program to return a different program.
Closes https://github.com/mesonbuild/meson/issues/2005
Diffstat (limited to 'test cases/common')
6 files changed, 39 insertions, 0 deletions
diff --git a/test cases/common/182 find override/meson.build b/test cases/common/182 find override/meson.build new file mode 100644 index 000000000..ebf3a050f --- /dev/null +++ b/test cases/common/182 find override/meson.build @@ -0,0 +1,4 @@ +project('find program override', 'c') + +subdir('subdir') +subdir('otherdir') diff --git a/test cases/common/182 find override/otherdir/main.c b/test cases/common/182 find override/otherdir/main.c new file mode 100644 index 000000000..2cef67c8d --- /dev/null +++ b/test cases/common/182 find override/otherdir/main.c @@ -0,0 +1,5 @@ +int be_seeing_you(); + +int main(int argc, char **argv) { + return be_seeing_you() == 6 ? 0 : 1; +} diff --git a/test cases/common/182 find override/otherdir/meson.build b/test cases/common/182 find override/otherdir/meson.build new file mode 100644 index 000000000..84e7e84e8 --- /dev/null +++ b/test cases/common/182 find override/otherdir/meson.build @@ -0,0 +1,11 @@ +gen = find_program('codegen') # Should use overridden value set in "subdir". + +src = custom_target('arrival', + input : 'source.desc', + output : 'file.c', + command : [gen, '@INPUT@', '@OUTPUT@'] + ) + +e = executable('six', 'main.c', src) + +test('six', e) diff --git a/test cases/common/182 find override/otherdir/source.desc b/test cases/common/182 find override/otherdir/source.desc new file mode 100644 index 000000000..8b19c9c2f --- /dev/null +++ b/test cases/common/182 find override/otherdir/source.desc @@ -0,0 +1 @@ +be_seeing_you diff --git a/test cases/common/182 find override/subdir/converter.py b/test cases/common/182 find override/subdir/converter.py new file mode 100755 index 000000000..55b2a7071 --- /dev/null +++ b/test cases/common/182 find override/subdir/converter.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import sys +import pathlib + +[ifilename, ofilename] = sys.argv[1:3] + +ftempl = '''int %s() { + return 6; +} +''' + +d = pathlib.Path(ifilename).read_text().split('\n')[0].strip() + +pathlib.Path(ofilename).write_text(ftempl % d)
\ No newline at end of file diff --git a/test cases/common/182 find override/subdir/meson.build b/test cases/common/182 find override/subdir/meson.build new file mode 100644 index 000000000..0d1f9d03b --- /dev/null +++ b/test cases/common/182 find override/subdir/meson.build @@ -0,0 +1,3 @@ +x = find_program('converter.py') + +meson.override_find_program('codegen', x) |
