missing return 0s
[libfirm] / ir / be / test / makereport.sh
1 EDG_BIN="edgcpfe"
2 EDG_CFLAGS="--c --gnu=30305 -I/usr/lib/gcc-lib/i586-suse-linux/3.3.5/include"
3 GCC_CFLAGS="-O3 -g -fomit-frame-pointer"
4 LINKFLAGS="-lm"
5 TIMEOUT_COMPILE=300
6 TIMEOUT_RUN=30
7
8 CFILES="*.c"
9 OUTPUTDIR="stats-`date +%d.%m.%y`"
10
11 mkdir -p build_firm
12 mkdir -p build_gcc
13 mkdir -p $OUTPUTDIR
14
15 XMLRES=$OUTPUTDIR/result.xml
16 cat > $XMLRES << __END__
17 <?xml version="1.0"?>
18 <results>
19     <environment>
20         <EDG_CFLAGS>${EDG_CFLAGS}</EDG_CFLAGS>
21         <GCC_CFLAGS>${GCC_CFLAGS}</GCC_CFLAGS>
22     </environment>
23 __END__
24
25 # so endless apps stop at some point...
26 #ulimit -t2
27
28 basedir=`pwd`
29
30 for dir in . gcc-testsuite gcc-testsuite/ieee; do
31         curdir=$basedir/$dir
32     echo "<section name=\"$curdir/\">" >> $XMLRES
33 for file in $curdir/$CFILES; do
34     COMPILE_RES="ok"
35     LINK_RES="omitted"
36     GCC_RES="ok"
37     GCC_RUN_RES="omitted"
38     FIRM_RUN_RES="omitted"
39     DIFF_RES="omitted"
40
41     name="`basename $file .c`"
42     res="$OUTPUTDIR/buildresult_$name.txt"
43     echo "Building $name"
44     echo "Results for $name" > $res
45     echo "*** EDG/FIRM Compile" >> $res
46     CMD="ulimit -t${TIMEOUT_COMPILE} ; ${EDG_BIN} ${EDG_CFLAGS} $file"
47     echo "$CMD" >> $res
48     /bin/bash -c "ulimit -t${TIMEOUT_COMPILE} ; ${EDG_BIN} ${EDG_CFLAGS} $file" >> $res 2>&1 || COMPILE_RES="failed"
49
50     if [ ${COMPILE_RES} == "ok" ]; then
51         LINK_RES="ok"
52         CMD="mv $curdir/$name.s build_firm/$name.s"
53         echo "$CMD" >> $res
54         $CMD >> $res 2>&1
55         echo "*** Linking" >> $res
56         CMD="gcc build_firm/$name.s ${LINKFLAGS} -o build_firm/$name.exe"
57         echo "$CMD" >> $res
58         $CMD >> $res 2>&1 || LINK_RES="failed"
59     fi
60
61     echo "*** GCC Compile" >> $res
62     CMD="gcc ${GCC_CFLAGS} $file ${LINKFLAGS} -o build_gcc/$name.exe"
63     echo "$CMD" >> $res
64     $CMD >> $res 2>&1 || GCC_RES="failed"
65
66     if [ ${GCC_RES} = "ok" ]; then
67         GCC_RUN_RES="ok"
68
69         echo "*** Run GCC" >> $res
70         CMD="ulimit -t${TIMEOUT_RUN} ; build_gcc/$name.exe > $OUTPUTDIR/result_gcc_$name.txt 2>&1"
71         echo "$CMD" >> $res
72         /bin/bash -c "ulimit -t${TIMEOUT_RUN} ; build_gcc/$name.exe" > $OUTPUTDIR/result_gcc_$name.txt 2>&1 || GCC_RUN_RES="failed"
73     fi
74
75     if [ ${LINK_RES} = "ok" ]; then
76         FIRM_RUN_RES="ok"
77
78         echo "*** Run Firm" >> $res
79         CMD="ulimit -t${TIMEOUT_RUN} ; build_firm/$name.exe > $OUTPUTDIR/result_gcc_$name.txt 2>&1"
80         echo "$CMD" >> $res
81         /bin/bash -c "ulimit -t${TIMEOUT_RUN} ; build_firm/$name.exe" > $OUTPUTDIR/result_firm_$name.txt 2>&1 || FIRM_RUN_RES="failed"
82     fi
83
84     if [ ${GCC_RUN_RES} = "ok" -a ${FIRM_RUN_RES} = "ok" ]; then
85         DIFF_RES="ok"
86
87         echo "*** Compare Results" >> $res
88         CMD="diff -u $OUTPUTDIR/result_gcc_$name.txt $OUTPUTDIR/result_firm_$name.txt"
89         $CMD > $OUTPUTDIR/result_diff_$name.txt 2>&1 || DIFF_RES="failed"
90     fi
91
92     cat >> $XMLRES << __END__
93     <result name="$name">
94         <compile>$COMPILE_RES</compile>
95         <link>$LINK_RES</link>
96         <gcc_compile>$GCC_RES</gcc_compile>
97         <gcc_run>$GCC_RUN_RES</gcc_run>
98         <firm_run>$FIRM_RUN_RES</firm_run>
99         <diff>$DIFF_RES</diff>
100     </result>
101 __END__
102 done
103     echo "</section>" >> $XMLRES
104 done
105
106 echo "</results>" >> $XMLRES
107
108 xsltproc --output $OUTPUTDIR/index.html makehtml.xslt $XMLRES
109
110 # maybe execute custom actions after result has been generated
111 [ -e after_compile.sh ] && ./after_compile.sh "$OUTPUTDIR"