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