gcc-test-compiler-hangs revision 1.1.1.1.4.2 1 1.1.1.1.4.2 yamt #! /bin/sh
2 1.1.1.1.4.2 yamt
3 1.1.1.1.4.2 yamt # Test a bug for which the compiler hangs, using environment variables
4 1.1.1.1.4.2 yamt # set in several reghunt scripts and configuration files.
5 1.1.1.1.4.2 yamt #
6 1.1.1.1.4.2 yamt # Copyright (C) 2007 Free Software Foundation.
7 1.1.1.1.4.2 yamt #
8 1.1.1.1.4.2 yamt # This file is free software; you can redistribute it and/or modify
9 1.1.1.1.4.2 yamt # it under the terms of the GNU General Public License as published by
10 1.1.1.1.4.2 yamt # the Free Software Foundation; either version 3 of the License, or
11 1.1.1.1.4.2 yamt # (at your option) any later version.
12 1.1.1.1.4.2 yamt #
13 1.1.1.1.4.2 yamt # This program is distributed in the hope that it will be useful,
14 1.1.1.1.4.2 yamt # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 1.1.1.1.4.2 yamt # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 1.1.1.1.4.2 yamt # GNU General Public License for more details.
17 1.1.1.1.4.2 yamt #
18 1.1.1.1.4.2 yamt # For a copy of the GNU General Public License, write the the
19 1.1.1.1.4.2 yamt # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 1.1.1.1.4.2 yamt # Boston, MA 02111-1301, USA.
21 1.1.1.1.4.2 yamt
22 1.1.1.1.4.2 yamt ID=$1
23 1.1.1.1.4.2 yamt LOGID=`printf "%04d" ${ID}`
24 1.1.1.1.4.2 yamt LOG=${BUGID}.${LOGID}.out
25 1.1.1.1.4.2 yamt MSGID="bug ${BUGID}, id ${ID}"
26 1.1.1.1.4.2 yamt
27 1.1.1.1.4.2 yamt trap "echo \"`date` compiler hang for ${MSGID}\"; pkill -9 cc1; exit $REG_FAIL" SIGUSR1
28 1.1.1.1.4.2 yamt SLEEPCNT=10
29 1.1.1.1.4.2 yamt
30 1.1.1.1.4.2 yamt # Set up to trap the hang.
31 1.1.1.1.4.2 yamt sleep $SLEEPCNT && /bin/kill -s SIGUSR1 0 &
32 1.1.1.1.4.2 yamt SLEEPID=$!
33 1.1.1.1.4.2 yamt
34 1.1.1.1.4.2 yamt # This might hang.
35 1.1.1.1.4.2 yamt $REG_TEST_COMPILER $REG_OPTS $REG_TESTCASE > ${LOG} 2>&1
36 1.1.1.1.4.2 yamt
37 1.1.1.1.4.2 yamt # The command didn't hang. Capture its return value so we can check
38 1.1.1.1.4.2 yamt # whether it had other unexpected problems.
39 1.1.1.1.4.2 yamt RET=$?
40 1.1.1.1.4.2 yamt
41 1.1.1.1.4.2 yamt # Kill the sleep command so it won't finish normally and cause this
42 1.1.1.1.4.2 yamt # process to get a signal telling it to report a failure.
43 1.1.1.1.4.2 yamt /bin/kill $SLEEPID
44 1.1.1.1.4.2 yamt
45 1.1.1.1.4.2 yamt if [ $RET -eq 0 ]; then
46 1.1.1.1.4.2 yamt echo "`date` test compiled successfully for ${MSGID}"
47 1.1.1.1.4.2 yamt exit $REG_PASS
48 1.1.1.1.4.2 yamt fi
49 1.1.1.1.4.2 yamt
50 1.1.1.1.4.2 yamt grep -q 'No such file or directory' ${LOG}
51 1.1.1.1.4.2 yamt if [ $? -eq 0 ]; then
52 1.1.1.1.4.2 yamt echo "`date` unexpected failure: missing file for ${MSGID}"
53 1.1.1.1.4.2 yamt exit $REG_ERROR
54 1.1.1.1.4.2 yamt fi
55 1.1.1.1.4.2 yamt
56 1.1.1.1.4.2 yamt grep -q "egmentation fault"
57 1.1.1.1.4.2 yamt if [ $? -eq 0 ]; then
58 1.1.1.1.4.2 yamt echo "`date` unexpected failure: segfault for ${MSGID}"
59 1.1.1.1.4.2 yamt exit $REG_ERROR
60 1.1.1.1.4.2 yamt fi
61 1.1.1.1.4.2 yamt
62 1.1.1.1.4.2 yamt echo "`date` unexpected failure for ${MSGID}"
63 1.1.1.1.4.2 yamt exit $REG_ERROR
64