1#! /bin/sh
2
3# Test an "ice-on-valid-code" GCC bug that results in a compiler
4# segfault, using environment variables set in several reghunt scripts
5# and configuration files.
6#
7# Copyright (C) 2007 Free Software Foundation.
8#
9# This file is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# For a copy of the GNU General Public License, write the the
20# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21# Boston, MA 02111-1301, USA.
22
23ID=$1
24
25LOGID=`printf "%04d" ${ID}`
26LOG=${BUGID}.${LOGID}.out
27MSGID="bug ${BUGID}, id ${ID}"
28
29$REG_TEST_COMPILER $REG_OPTS $REG_TESTCASE > ${LOG} 2>&1
30
31if [ $? -eq 0 ]; then
32    echo "`date`  test compiled successfully for ${MSGID}"
33    exit $REG_PASS
34fi
35
36grep -q 'No such file or directory' ${LOG}
37if [ $? -eq 0 ]; then
38    echo "`date`    unexpected failure: missing file for ${MSGID}"
39    exit $REG_ERROR
40fi
41
42grep -q 'egmentation fault' ${LOG}
43if [ $? -ne 0 ]; then
44    echo "`date`    unexpected failure: no segfault message for ${MSGID}"
45    exit $REG_ERROR
46fi
47
48echo "`date`  compilation failed for ${MSGID}"
49exit $REG_FAIL
50