diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
commit | 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch) | |
tree | 4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/failing test | |
parent | Initial commit. (diff) | |
download | meson-upstream.tar.xz meson-upstream.zip |
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test cases/failing test/1 trivial/main.c | 3 | ||||
-rw-r--r-- | test cases/failing test/1 trivial/meson.build | 3 | ||||
-rw-r--r-- | test cases/failing test/2 signal/main.c | 6 | ||||
-rw-r--r-- | test cases/failing test/2 signal/meson.build | 7 | ||||
-rw-r--r-- | test cases/failing test/3 ambiguous/main.c | 6 | ||||
-rw-r--r-- | test cases/failing test/3 ambiguous/meson.build | 10 | ||||
-rwxr-xr-x | test cases/failing test/3 ambiguous/test_runner.sh | 7 | ||||
-rw-r--r-- | test cases/failing test/4 hard error/main.c | 3 | ||||
-rw-r--r-- | test cases/failing test/4 hard error/meson.build | 4 | ||||
-rw-r--r-- | test cases/failing test/5 tap tests/meson.build | 9 | ||||
-rw-r--r-- | test cases/failing test/5 tap tests/tester.c | 10 | ||||
-rw-r--r-- | test cases/failing test/5 tap tests/tester_with_status.c | 8 | ||||
-rw-r--r-- | test cases/failing test/6 xpass/meson.build | 4 | ||||
-rw-r--r-- | test cases/failing test/6 xpass/xpass.c | 1 |
14 files changed, 81 insertions, 0 deletions
diff --git a/test cases/failing test/1 trivial/main.c b/test cases/failing test/1 trivial/main.c new file mode 100644 index 0000000..3e70e50 --- /dev/null +++ b/test cases/failing test/1 trivial/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 1; +} diff --git a/test cases/failing test/1 trivial/meson.build b/test cases/failing test/1 trivial/meson.build new file mode 100644 index 0000000..ed5a3d2 --- /dev/null +++ b/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/test cases/failing test/2 signal/main.c b/test cases/failing test/2 signal/main.c new file mode 100644 index 0000000..2ee1d80 --- /dev/null +++ b/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/test cases/failing test/2 signal/meson.build b/test cases/failing test/2 signal/meson.build new file mode 100644 index 0000000..9d84c26 --- /dev/null +++ b/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/test cases/failing test/3 ambiguous/main.c b/test cases/failing test/3 ambiguous/main.c new file mode 100644 index 0000000..2ee1d80 --- /dev/null +++ b/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/test cases/failing test/3 ambiguous/meson.build b/test cases/failing test/3 ambiguous/meson.build new file mode 100644 index 0000000..58f0de0 --- /dev/null +++ b/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/test cases/failing test/3 ambiguous/test_runner.sh b/test cases/failing test/3 ambiguous/test_runner.sh new file mode 100755 index 0000000..08873ce --- /dev/null +++ b/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/test cases/failing test/4 hard error/main.c b/test cases/failing test/4 hard error/main.c new file mode 100644 index 0000000..a1e705a --- /dev/null +++ b/test cases/failing test/4 hard error/main.c @@ -0,0 +1,3 @@ +int main(void) { + return 99; +} diff --git a/test cases/failing test/4 hard error/meson.build b/test cases/failing test/4 hard error/meson.build new file mode 100644 index 0000000..6979b04 --- /dev/null +++ b/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/test cases/failing test/5 tap tests/meson.build b/test cases/failing test/5 tap tests/meson.build new file mode 100644 index 0000000..664ac34 --- /dev/null +++ b/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/test cases/failing test/5 tap tests/tester.c b/test cases/failing test/5 tap tests/tester.c new file mode 100644 index 0000000..ac582e7 --- /dev/null +++ b/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/test cases/failing test/5 tap tests/tester_with_status.c b/test cases/failing test/5 tap tests/tester_with_status.c new file mode 100644 index 0000000..7613afe --- /dev/null +++ b/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/test cases/failing test/6 xpass/meson.build b/test cases/failing test/6 xpass/meson.build new file mode 100644 index 0000000..7649dde --- /dev/null +++ b/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/test cases/failing test/6 xpass/xpass.c b/test cases/failing test/6 xpass/xpass.c new file mode 100644 index 0000000..0314ff1 --- /dev/null +++ b/test cases/failing test/6 xpass/xpass.c @@ -0,0 +1 @@ +int main(int argc, char **argv) { return 0; } |