diff options
author | Ahmed Masud <ahmed.masud@trustifier.com> | 2018-10-19 17:17:48 -0400 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2018-10-19 14:17:48 -0700 |
commit | 078ef6641c3c36946fab22d0d4c8e330d2b4d518 (patch) | |
tree | 3f67ca5c656a0852a2d8aea2d2fec4aacee53ec0 /test | |
parent | e469e1f8d19408e83d30aa1cfab06dd133304ad8 (diff) | |
download | libfuse-078ef6641c3c36946fab22d0d4c8e330d2b4d518.tar.gz |
Do not fail "ninja test" when running as subproject
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 12 | ||||
-rw-r--r-- | test/wrong_command.c | 7 |
2 files changed, 16 insertions, 3 deletions
diff --git a/test/meson.build b/test/meson.build index 69af767..5c5c2e6 100644 --- a/test/meson.build +++ b/test/meson.build @@ -19,6 +19,12 @@ td += custom_target('test_scripts', input: test_scripts, '@INPUT@', meson.current_build_dir() ]) # Provide something helpful when running 'ninja test' -wrong_cmd = executable('wrong_command', 'wrong_command.c', - install: false) -test('wrong_cmd', wrong_cmd) + +if meson.is_subproject() + test('libfuse is a subproject, skipping tests', executable('wrong_command', + 'wrong_command.c', install: false, + c_args: [ '-DMESON_IS_SUBPROJECT' ])) +else + test('wrong_command', executable('wrong_command', 'wrong_command.c', + install: false)) +endif diff --git a/test/wrong_command.c b/test/wrong_command.c index 8366a98..8b563c9 100644 --- a/test/wrong_command.c +++ b/test/wrong_command.c @@ -1,9 +1,16 @@ #include <stdio.h> int main(void) { +#ifdef MESON_IS_SUBPROJECT + fprintf(stderr, "libfuse tests were skipped because it's a meson subproject.\n" + "If you wish to run them try:\n" + "'cd <srcdir>/subprojects/libfuse && meson . build && cd build && python3 -m pytest test/' instead"); + return 77; /* report as a skipped test */ +#else fprintf(stderr, "\x1B[31m\e[1m" "This is not the command you are looking for.\n" "You probably want to run 'python3 -m pytest test/' instead" "\e[0m\n"); return 1; +#endif } |