makereport.sh 3.48 KB
Newer Older
Christian Würdig's avatar
Christian Würdig committed
1
2
#!/bin/sh

3
EDG_BIN="eccp"
Matthias Braun's avatar
Matthias Braun committed
4
EDG_CFLAGS="${ADDCFLAGS} -O3 -c -D__builtin_memcpy=memcpy -D__builtin_memset=memset -D__builtin_strlen=strlen -D__builtin_strcpy=strcpy -D__builtin_strcmp=strcmp -DNO_TRAMPOLINES"
5
6
GCC_CFLAGS="-O3 -g -fomit-frame-pointer"
LINKFLAGS="-lm"
7
8
TIMEOUT_COMPILE=300
TIMEOUT_RUN=30
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

CFILES="*.c"
OUTPUTDIR="stats-`date +%d.%m.%y`"

mkdir -p build_firm
mkdir -p build_gcc
mkdir -p $OUTPUTDIR

XMLRES=$OUTPUTDIR/result.xml
cat > $XMLRES << __END__
<?xml version="1.0"?>
<results>
    <environment>
        <EDG_CFLAGS>${EDG_CFLAGS}</EDG_CFLAGS>
        <GCC_CFLAGS>${GCC_CFLAGS}</GCC_CFLAGS>
    </environment>
__END__

# so endless apps stop at some point...
28
#ulimit -t2
29

Christian Würdig's avatar
Christian Würdig committed
30
31
basedir=`pwd`

Christian Würdig's avatar
Christian Würdig committed
32
DIRS=". gcc-testsuite gcc-testsuite/ieee langshootout"
33
34
35
test -n "$1" && DIRS="$1"

for dir in $DIRS; do
Christian Würdig's avatar
Christian Würdig committed
36
37
38
	curdir=$basedir/$dir
    echo "<section name=\"$curdir/\">" >> $XMLRES
for file in $curdir/$CFILES; do
39
40
41
42
43
44
45
46
47
48
49
50
    COMPILE_RES="ok"
    LINK_RES="omitted"
    GCC_RES="ok"
    GCC_RUN_RES="omitted"
    FIRM_RUN_RES="omitted"
    DIFF_RES="omitted"

    name="`basename $file .c`"
    res="$OUTPUTDIR/buildresult_$name.txt"
    echo "Building $name"
    echo "Results for $name" > $res
    echo "*** EDG/FIRM Compile" >> $res
Christian Würdig's avatar
Christian Würdig committed
51
    CMD="ulimit -t${TIMEOUT_COMPILE} ; ${EDG_BIN} ${EDG_CFLAGS} $file"
52
    echo "$CMD" >> $res
Christian Würdig's avatar
Christian Würdig committed
53
    /bin/bash -c "ulimit -t${TIMEOUT_COMPILE} ; ${EDG_BIN} ${EDG_CFLAGS} $file" >> $res 2>&1 || COMPILE_RES="failed"
54
55
56

    if [ ${COMPILE_RES} == "ok" ]; then
        LINK_RES="ok"
Christian Würdig's avatar
Christian Würdig committed
57
        CMD="mv $curdir/$name.s build_firm/$name.s"
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
        echo "$CMD" >> $res
        $CMD >> $res 2>&1
        echo "*** Linking" >> $res
        CMD="gcc build_firm/$name.s ${LINKFLAGS} -o build_firm/$name.exe"
        echo "$CMD" >> $res
        $CMD >> $res 2>&1 || LINK_RES="failed"
    fi

    echo "*** GCC Compile" >> $res
    CMD="gcc ${GCC_CFLAGS} $file ${LINKFLAGS} -o build_gcc/$name.exe"
    echo "$CMD" >> $res
    $CMD >> $res 2>&1 || GCC_RES="failed"

    if [ ${GCC_RES} = "ok" ]; then
        GCC_RUN_RES="ok"

        echo "*** Run GCC" >> $res
Christian Würdig's avatar
Christian Würdig committed
75
        CMD="ulimit -t${TIMEOUT_RUN} ; build_gcc/$name.exe > $OUTPUTDIR/result_gcc_$name.txt 2>&1"
76
        echo "$CMD" >> $res
Christian Würdig's avatar
Christian Würdig committed
77
        /bin/bash -c "ulimit -t${TIMEOUT_RUN} ; build_gcc/$name.exe" > $OUTPUTDIR/result_gcc_$name.txt 2>&1 || GCC_RUN_RES="failed"
78
79
80
81
82
83
    fi

    if [ ${LINK_RES} = "ok" ]; then
        FIRM_RUN_RES="ok"

        echo "*** Run Firm" >> $res
Christian Würdig's avatar
Christian Würdig committed
84
        CMD="ulimit -t${TIMEOUT_RUN} ; build_firm/$name.exe > $OUTPUTDIR/result_gcc_$name.txt 2>&1"
85
        echo "$CMD" >> $res
Christian Würdig's avatar
Christian Würdig committed
86
        /bin/bash -c "ulimit -t${TIMEOUT_RUN} ; build_firm/$name.exe" > $OUTPUTDIR/result_firm_$name.txt 2>&1 || FIRM_RUN_RES="failed"
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
    fi

    if [ ${GCC_RUN_RES} = "ok" -a ${FIRM_RUN_RES} = "ok" ]; then
        DIFF_RES="ok"

        echo "*** Compare Results" >> $res
        CMD="diff -u $OUTPUTDIR/result_gcc_$name.txt $OUTPUTDIR/result_firm_$name.txt"
        $CMD > $OUTPUTDIR/result_diff_$name.txt 2>&1 || DIFF_RES="failed"
    fi

    cat >> $XMLRES << __END__
    <result name="$name">
        <compile>$COMPILE_RES</compile>
        <link>$LINK_RES</link>
        <gcc_compile>$GCC_RES</gcc_compile>
        <gcc_run>$GCC_RUN_RES</gcc_run>
        <firm_run>$FIRM_RUN_RES</firm_run>
        <diff>$DIFF_RES</diff>
    </result>
__END__
Christian Würdig's avatar
Christian Würdig committed
107
108
done
    echo "</section>" >> $XMLRES
109
110
111
112
113
114
115
116
done

echo "</results>" >> $XMLRES

xsltproc --output $OUTPUTDIR/index.html makehtml.xslt $XMLRES

# maybe execute custom actions after result has been generated
[ -e after_compile.sh ] && ./after_compile.sh "$OUTPUTDIR"