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