ppc: 'neue' testfaelle angepasst
[testub10.git] / scripts / debug_gesamt_ppc
1 #!/bin/bash
2
3 i=$1
4 beispiel=gesamt_ppc
5 PROGRAM=./$beispiel
6
7 #LOC=.
8 #LOC=/usr/ftp/pub/ubvl/test/$beispiel
9 LOC=~/test/scripts
10
11 allow_null_glob_expansion=1
12
13 if [ ! -d ~/abgabe/$beispiel ]; then
14   echo "Fehler: Verzeichnis ~/abgabe/$beispiel existiert nicht."
15   exit 1
16 else
17   cd ~/abgabe/$beispiel
18   echo 'Teste "make"'
19   make
20 fi
21
22 if test ! -x $PROGRAM
23 then
24         echo "Fehler: Kein Programm $PROGRAM"
25         exit 1
26 fi
27 let prgnum=0
28 #for i in $LOC/*.0 $LOC2/*.0
29 if [ -f $i ]; then
30         let prgnum=prgnum+1
31         let errorfound=0
32         echo "==========> Eingabe von $i:"
33         cat $i
34         echo
35         RESFILE=test${beispiel}out$$
36         $PROGRAM <$i >$RESFILE
37         retval=$?
38         echo -n "Übersetzung: "
39         if test $retval -eq 0
40         then
41                 echo "Status korrekt"
42         else
43                 echo "[Errot] Status=$retval. Erwartet: 0"
44                 let errorfound=1
45         fi
46         echo
47         echo "Ausgabe:"
48         if [ -f ~/test/scripts/clr.py ]; then
49                 cat $RESFILE | ~/test/scripts/clr.py
50         else
51                 cat $RESFILE
52         fi
53         mv -f $RESFILE $RESFILE.s
54         CALLFILE=${i%.*}.call
55         echo
56         if [ ! -f $CALLFILE ]; then
57         echo "Fehler: Datei $CALLFILE existiert nicht, kann Code nicht ausführen..."
58         exit 1
59         else
60         echo "Übersetze und linke das Testprogramm:"
61         if cc -g -I. -DCALL=\"$CALLFILE\" $LOC/testmain.c $LOC/callingconvention.o $RESFILE.s; then
62                 echo
63                 echo "Rufe folgendes Codefragment auf:"
64                 cat $CALLFILE
65                 echo
66                 gdb ./a.out 
67         else
68                 echo "[Error] Erzeugter Code konnte nicht assembliert und gelinkt werden."
69                 let errorfound=1
70         fi
71         fi
72         rm -f a.out $RESFILE $RESFILE.s
73 fi