fixed comment: get_call_abi() get the call type, NOT the method type of the called...
[libfirm] / ir / be / test / makereport.sh
1 #!/bin/sh
2
3 export LANG=
4 export LC_ALL=
5 export LC_COLLATE=
6 if test "$1" != "--recursive-hack"; then
7         "$0" --recursive-hack "$@"
8         exit $?
9 else
10         shift
11 fi
12
13 EXEC_PREFIX=
14 if [ "$ECC" = "" ]; then
15         ECC="eccp"
16 fi
17 #EXEC_PREFIX="qemu-arm"
18 #ECC="/ben/beck/ipd/bin/eccp -march=arm -bra-chordal-co-algo=heur"
19 ECC_CFLAGS="${ADDCFLAGS} -v -O3 -D__builtin_memcpy=memcpy -D__builtin_memset=memset -D__builtin_strlen=strlen -D__builtin_strcpy=strcpy -D__builtin_strcmp=strcmp -DNO_TRAMPOLINES -ffp-strict"
20 GCC="icc"
21 GCC_CFLAGS="-O0 -Itcc -fp-model precise"
22 LINKFLAGS="-lm"
23 TIMEOUT_COMPILE=300
24 TIMEOUT_RUN=30
25
26 CFILES="*.c"
27 OUTPUTDIR="stats-`date +%y.%m.%d`"
28
29 mkdir -p build_firm
30 mkdir -p build_gcc
31 mkdir -p $OUTPUTDIR
32
33 XMLRES=$OUTPUTDIR/result.xml
34 cat > $XMLRES << __END__
35 <?xml version="1.0"?>
36 <results>
37     <environment>
38         <ECC_CFLAGS>${ECC_CFLAGS}</ECC_CFLAGS>
39         <GCC_CFLAGS>${GCC_CFLAGS}</GCC_CFLAGS>
40     </environment>
41 __END__
42
43 # so endless apps stop at some point...
44 #ulimit -t 2
45
46 basedir=`pwd`
47
48 DIRS=". langshootout ack gcc-testsuite gcc-testsuite/ieee"
49 test -n "$1" && DIRS="$1"
50
51 for dir in $DIRS; do
52         curdir=$basedir/$dir
53     echo "<section name=\"$curdir/\">" >> $XMLRES
54 for file in $curdir/$CFILES; do
55     COMPILE_RES="ok"
56     LINK_RES="omitted"
57     GCC_RES="ok"
58     GCC_RUN_RES="omitted"
59     FIRM_RUN_RES="omitted"
60     DIFF_RES="omitted"
61     FILE_FLAGS=`awk '/\/\\*\\$ .* \\$\\*\// { for (i = 2; i < NF; ++i) printf "%s ", $i }' $file`
62
63     name="`basename $file .c`"
64         obj_name="build_firm/$name.o"
65     res="$OUTPUTDIR/buildresult_$name.txt"
66     echo -n "Building $name"
67     echo "Results for $name" > $res
68     echo "*** ECC/FIRM Compile" >> $res
69     CMD="ulimit -t ${TIMEOUT_COMPILE} ; ${ECC} -c -o ${obj_name} ${ECC_CFLAGS} ${FILE_FLAGS} ${file}"
70     echo "$CMD" >> $res
71     /bin/sh -c "$CMD" >> $res 2>&1 || { COMPILE_RES="failed"; echo -n " ... FAILED"; }
72
73     if [ ${COMPILE_RES} = "ok" ]; then
74         LINK_RES="ok"
75         echo "*** Linking" >> $res
76         CMD="${ECC} $obj_name ${LINKFLAGS} -o build_firm/$name.exe"
77         echo "$CMD" >> $res
78         $CMD >> $res 2>&1 || { LINK_RES="failed"; echo -n " ... FAILED"; }
79     fi
80
81     echo "*** GCC Compile" >> $res
82     CMD="${GCC} ${GCC_CFLAGS} ${FILE_FLAGS} $file ${LINKFLAGS} -o build_gcc/$name.exe"
83     echo "$CMD" >> $res
84     $CMD >> $res 2>&1 || GCC_RES="failed"
85
86     if [ ${GCC_RES} = "ok" ]; then
87         GCC_RUN_RES="ok"
88
89         echo "*** Run GCC" >> $res
90         CMD="ulimit -t ${TIMEOUT_RUN} ; build_gcc/$name.exe > $OUTPUTDIR/result_gcc_$name.txt 2>&1"
91         echo "$CMD" >> $res
92         /bin/sh -c "$CMD" > $OUTPUTDIR/result_gcc_$name.txt 2>&1 || GCC_RUN_RES="failed"
93     fi
94
95     if [ ${LINK_RES} = "ok" ]; then
96         FIRM_RUN_RES="ok"
97
98         echo "*** Run Firm" >> $res
99         CMD="ulimit -t ${TIMEOUT_RUN} ; ${EXEC_PREFIX} build_firm/$name.exe > $OUTPUTDIR/result_firm_$name.txt 2>&1"
100         echo "$CMD" >> $res
101         /bin/sh -c "$CMD" > $OUTPUTDIR/result_firm_$name.txt 2>&1 || { FIRM_RUN_RES="failed"; echo -n " ... FAILED"; }
102     fi
103
104     if [ ${GCC_RUN_RES} = "ok" -a ${FIRM_RUN_RES} = "ok" ]; then
105         DIFF_RES="ok"
106
107         echo "*** Compare Results" >> $res
108         CMD="diff -u $OUTPUTDIR/result_gcc_$name.txt $OUTPUTDIR/result_firm_$name.txt"
109         $CMD > $OUTPUTDIR/result_diff_$name.txt 2>&1 || { DIFF_RES="failed"; echo -n " ... FAILED"; }
110     fi
111     echo
112
113     cat >> $XMLRES << __END__
114     <result name="$name">
115         <compile>$COMPILE_RES</compile>
116         <link>$LINK_RES</link>
117         <gcc_compile>$GCC_RES</gcc_compile>
118         <gcc_run>$GCC_RUN_RES</gcc_run>
119         <firm_run>$FIRM_RUN_RES</firm_run>
120         <diff>$DIFF_RES</diff>
121     </result>
122 __END__
123 done
124     echo "</section>" >> $XMLRES
125 done
126
127 echo "</results>" >> $XMLRES
128
129 xsltproc --output $OUTPUTDIR/index.html makehtml.xslt $XMLRES
130
131 # maybe execute custom actions after result has been generated
132 [ -e after_compile.sh ] && ./after_compile.sh "$OUTPUTDIR"