2 # Test failure recording (with and without --direct).
3 # Copyright (C) 2016-2023 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <https://www.gnu.org/licenses/>. */
22 common_objpfx
=$1; shift
23 test_program_prefix_before_env
=$1; shift
24 run_program_env
=$1; shift
25 test_program_prefix_after_env
=$1; shift
31 args
="${common_objpfx}support/tst-support_record_failure $*"
34 output
="$(${test_program_prefix_before_env} \
35 ${run_program} ${test_program_prefix_after_env} $args)"
38 echo " exit status: $status"
39 if test "$output" != "$expected_output" ; then
40 echo "error: unexpected output: $output"
43 if test "$status" -ne "$expected_status" ; then
44 echo "error: exit status $expected_status expected"
51 run_test
1 "error: 1 test failures" $direct --status=0
52 run_test
1 "error: 1 test failures" $direct --status=1
53 run_test
2 "error: 1 test failures" $direct --status=2
54 run_test
1 "error: 1 test failures" $direct --status=77
55 run_test
2 "error: tst-support_record_failure.c:109: not true: false
56 error: 1 test failures" $direct --test-verify
57 run_test
2 "error: tst-support_record_failure.c:109: not true: false
58 info: execution passed failed TEST_VERIFY
59 error: 1 test failures" $direct --test-verify --verbose
63 different_status
--direct
65 run_test
1 "error: tst-support_record_failure.c:116: not true: false
66 error: 1 test failures" --test-verify-exit
67 # --direct does not print the summary error message if exit is called.
68 run_test
1 "error: tst-support_record_failure.c:116: not true: false" \
69 --direct --test-verify-exit