powerpc: Fix adapt_count update in __lll_unlock_elision
[glibc.git] / support / tst-support_record_failure-2.sh
blob175137780a96e83cbef9f1839c740adfe02991f5
1 #!/bin/sh
2 # Test failure recording (with and without --direct).
3 # Copyright (C) 2016-2017 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 # <http://www.gnu.org/licenses/>. */
20 set -e
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
27 run_test () {
28 expected_status="$1"
29 expected_output="$2"
30 shift 2
31 args="${common_objpfx}support/tst-support_record_failure $*"
32 echo "running: $args"
33 set +e
34 output="$(${test_program_prefix_before_env} \
35 ${run_program} ${test_program_prefix_after_env} $args)"
36 status=$?
37 set -e
38 echo " exit status: $status"
39 if test "$output" != "$expected_output" ; then
40 echo "error: unexpected ouput: $output"
41 exit 1
43 if test "$status" -ne "$expected_status" ; then
44 echo "error: exit status $expected_status expected"
45 exit 1
49 different_status () {
50 direct="$1"
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:108: not true: false
56 error: 1 test failures" $direct --test-verify
57 run_test 2 "error: tst-support_record_failure.c:108: not true: false
58 info: execution passed failed TEST_VERIFY
59 error: 1 test failures" $direct --test-verify --verbose
62 different_status
63 different_status --direct
65 run_test 1 "error: tst-support_record_failure.c:115: 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:115: not true: false" \
69 --direct --test-verify-exit