diff options
Diffstat (limited to 'meson/test cases/failing test')
14 files changed, 81 insertions, 0 deletions
diff --git a/meson/test cases/failing test/1 trivial/main.c b/meson/test cases/failing test/1 trivial/main.c new file mode 100644 index 000000000..3e70e5079 --- /dev/null +++ b/meson/test cases/failing test/1 trivial/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 1; +} diff --git a/meson/test cases/failing test/1 trivial/meson.build b/meson/test cases/failing test/1 trivial/meson.build new file mode 100644 index 000000000..ed5a3d2b3 --- /dev/null +++ b/meson/test cases/failing test/1 trivial/meson.build @@ -0,0 +1,3 @@ +project('trivial', 'c') + +test('My Test', executable('main', 'main.c')) diff --git a/meson/test cases/failing test/2 signal/main.c b/meson/test cases/failing test/2 signal/main.c new file mode 100644 index 000000000..2ee1d8075 --- /dev/null +++ b/meson/test cases/failing test/2 signal/main.c @@ -0,0 +1,6 @@ +#include <signal.h> +#include <unistd.h> + +int main(void) { + kill(getpid(), SIGSEGV); +} diff --git a/meson/test cases/failing test/2 signal/meson.build b/meson/test cases/failing test/2 signal/meson.build new file mode 100644 index 000000000..9d84c263e --- /dev/null +++ b/meson/test cases/failing test/2 signal/meson.build @@ -0,0 +1,7 @@ +project('signal', 'c') + +if build_machine.system() == 'windows' + error('MESON_SKIP_TEST test is not compatible with MS Windows.') +else + test('My Signal Test', executable('main', 'main.c')) +endif diff --git a/meson/test cases/failing test/3 ambiguous/main.c b/meson/test cases/failing test/3 ambiguous/main.c new file mode 100644 index 000000000..2ee1d8075 --- /dev/null +++ b/meson/test cases/failing test/3 ambiguous/main.c @@ -0,0 +1,6 @@ +#include <signal.h> +#include <unistd.h> + +int main(void) { + kill(getpid(), SIGSEGV); +} diff --git a/meson/test cases/failing test/3 ambiguous/meson.build b/meson/test cases/failing test/3 ambiguous/meson.build new file mode 100644 index 000000000..58f0de071 --- /dev/null +++ b/meson/test cases/failing test/3 ambiguous/meson.build @@ -0,0 +1,10 @@ +project('ambiguous', 'c') + +if build_machine.system() == 'windows' + error('MESON_SKIP_TEST test is not compatible with MS Windows.') +else + exe = executable('main', 'main.c') + test_runner = find_program('test_runner.sh') + + test('My Ambiguous Status Test', test_runner, args : [exe.full_path()]) +endif diff --git a/meson/test cases/failing test/3 ambiguous/test_runner.sh b/meson/test cases/failing test/3 ambiguous/test_runner.sh new file mode 100755 index 000000000..08873ce26 --- /dev/null +++ b/meson/test cases/failing test/3 ambiguous/test_runner.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# +# This tests that using a shell as an intermediary between Meson and the +# actual unit test which dies due to a signal is still recorded correctly. +# +# The quotes are because the path may contain spaces. +"$1" diff --git a/meson/test cases/failing test/4 hard error/main.c b/meson/test cases/failing test/4 hard error/main.c new file mode 100644 index 000000000..a1e705ade --- /dev/null +++ b/meson/test cases/failing test/4 hard error/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 99; +} diff --git a/meson/test cases/failing test/4 hard error/meson.build b/meson/test cases/failing test/4 hard error/meson.build new file mode 100644 index 000000000..6979b0416 --- /dev/null +++ b/meson/test cases/failing test/4 hard error/meson.build @@ -0,0 +1,4 @@ +project('trivial', 'c') + +# Exit code 99 even overrides should_fail +test('My Test', executable('main', 'main.c'), should_fail: true) diff --git a/meson/test cases/failing test/5 tap tests/meson.build b/meson/test cases/failing test/5 tap tests/meson.build new file mode 100644 index 000000000..664ac34d2 --- /dev/null +++ b/meson/test cases/failing test/5 tap tests/meson.build @@ -0,0 +1,9 @@ +project('test features', 'c') + +tester = executable('tester', 'tester.c') +test_with_status = executable('test-with-status', 'tester_with_status.c') +test('nonzero return code no tests', tester, args : [], protocol: 'tap') +test('nonzero return code with tests', test_with_status, protocol: 'tap') +test('missing test', tester, args : ['1..1'], protocol: 'tap') +test('incorrect skip', tester, args : ['1..1 # skip\nok 1'], protocol: 'tap') +test('partially skipped', tester, args : ['not ok 1\nok 2 # skip'], protocol: 'tap') diff --git a/meson/test cases/failing test/5 tap tests/tester.c b/meson/test cases/failing test/5 tap tests/tester.c new file mode 100644 index 000000000..ac582e7c0 --- /dev/null +++ b/meson/test cases/failing test/5 tap tests/tester.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main(int argc, char **argv) { + if (argc != 2) { + fprintf(stderr, "Incorrect number of arguments, got %i\n", argc); + return 1; + } + puts(argv[1]); + return 0; +} diff --git a/meson/test cases/failing test/5 tap tests/tester_with_status.c b/meson/test cases/failing test/5 tap tests/tester_with_status.c new file mode 100644 index 000000000..7613afefc --- /dev/null +++ b/meson/test cases/failing test/5 tap tests/tester_with_status.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char **argv) { + puts("1..1"); + puts("not ok 1 - some test"); + return 2; +} diff --git a/meson/test cases/failing test/6 xpass/meson.build b/meson/test cases/failing test/6 xpass/meson.build new file mode 100644 index 000000000..7649dde44 --- /dev/null +++ b/meson/test cases/failing test/6 xpass/meson.build @@ -0,0 +1,4 @@ +project('unexpected pass', 'c') + +test('should_fail_but_does_not', executable('xpass', 'xpass.c'), + should_fail: true) diff --git a/meson/test cases/failing test/6 xpass/xpass.c b/meson/test cases/failing test/6 xpass/xpass.c new file mode 100644 index 000000000..0314ff17b --- /dev/null +++ b/meson/test cases/failing test/6 xpass/xpass.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } |