diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-10-07 13:13:54 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-05-18 13:53:58 -0700 |
commit | af787874a8e4eab8222382128ccfb5549b31c801 (patch) | |
tree | 6f67ec9f0a3f6b48681d7f981e83732266916456 /test cases | |
parent | 0ec94ca0629415d4b555e8ef38a5093a65e0539e (diff) | |
download | meson-af787874a8e4eab8222382128ccfb5549b31c801.zip meson-af787874a8e4eab8222382128ccfb5549b31c801.tar.gz meson-af787874a8e4eab8222382128ccfb5549b31c801.tar.bz2 |
pass exe_wrapper to test scripts through the environment
This adds a new MESON_EXE_WRAPPER environment variable containing the
string form of the exe_wrapper, if there is an exe_wrapper defined.
Fixes #4427
Diffstat (limited to 'test cases')
-rwxr-xr-x | test cases/unit/72 cross test passed/exewrapper.py | 24 | ||||
-rw-r--r-- | test cases/unit/72 cross test passed/meson.build | 7 | ||||
-rw-r--r-- | test cases/unit/72 cross test passed/meson_options.txt | 5 |
3 files changed, 36 insertions, 0 deletions
diff --git a/test cases/unit/72 cross test passed/exewrapper.py b/test cases/unit/72 cross test passed/exewrapper.py new file mode 100755 index 0000000..2c15ed6 --- /dev/null +++ b/test cases/unit/72 cross test passed/exewrapper.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# Test that the MESON_EXE_WRAPPER environment variable is set + +import argparse +import os +import sys + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('binary') # unused, but needed for test behavior + parser.add_argument('--expected', action='store_true') + args = parser.parse_args() + + defined = 'MESON_EXE_WRAPPER' in os.environ + + if args.expected != defined: + print(os.environ, file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/test cases/unit/72 cross test passed/meson.build b/test cases/unit/72 cross test passed/meson.build index cb3bb6d..4deb74b 100644 --- a/test cases/unit/72 cross test passed/meson.build +++ b/test cases/unit/72 cross test passed/meson.build @@ -10,3 +10,10 @@ py = import('python').find_installation() test('root', e) test('main', py, args : [meson.current_source_dir() / 'script.py', e]) + +wrapper_args = [] +if get_option('expect') + wrapper_args += '--expected' +endif + +test('exe_wrapper in env', py, args : [meson.current_source_dir() / 'exewrapper.py', e, wrapper_args]) diff --git a/test cases/unit/72 cross test passed/meson_options.txt b/test cases/unit/72 cross test passed/meson_options.txt new file mode 100644 index 0000000..084c776 --- /dev/null +++ b/test cases/unit/72 cross test passed/meson_options.txt @@ -0,0 +1,5 @@ +option( + 'expect', + type : 'boolean', + value : false, +) |