0
|
1 #! /bin/sh
|
|
2
|
|
3 # Test a bug for which the compiler hangs, using environment variables
|
|
4 # set in several reghunt scripts and configuration files.
|
|
5 #
|
|
6 # Copyright (C) 2007 Free Software Foundation.
|
|
7 #
|
|
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.
|
|
12 #
|
|
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.
|
|
17 #
|
|
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.
|
|
21
|
|
22 ID=$1
|
|
23 LOGID=`printf "%04d" ${ID}`
|
|
24 LOG=${BUGID}.${LOGID}.out
|
|
25 MSGID="bug ${BUGID}, id ${ID}"
|
|
26
|
|
27 trap "echo \"`date` compiler hang for ${MSGID}\"; pkill -9 cc1; exit $REG_FAIL" SIGUSR1
|
|
28 SLEEPCNT=10
|
|
29
|
|
30 # Set up to trap the hang.
|
|
31 sleep $SLEEPCNT && /bin/kill -s SIGUSR1 0 &
|
|
32 SLEEPID=$!
|
|
33
|
|
34 # This might hang.
|
|
35 $REG_TEST_COMPILER $REG_OPTS $REG_TESTCASE > ${LOG} 2>&1
|
|
36
|
|
37 # The command didn't hang. Capture its return value so we can check
|
|
38 # whether it had other unexpected problems.
|
|
39 RET=$?
|
|
40
|
|
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
|
|
44
|
|
45 if [ $RET -eq 0 ]; then
|
|
46 echo "`date` test compiled successfully for ${MSGID}"
|
|
47 exit $REG_PASS
|
|
48 fi
|
|
49
|
|
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
|
|
54 fi
|
|
55
|
|
56 grep -q "egmentation fault"
|
|
57 if [ $? -eq 0 ]; then
|
|
58 echo "`date` unexpected failure: segfault for ${MSGID}"
|
|
59 exit $REG_ERROR
|
|
60 fi
|
|
61
|
|
62 echo "`date` unexpected failure for ${MSGID}"
|
|
63 exit $REG_ERROR
|