[gesamt] Added ag/codea/codeb testcases
[testub10.git] / scripts / debug_gesamt
diff --git a/scripts/debug_gesamt b/scripts/debug_gesamt
new file mode 100755 (executable)
index 0000000..7f9c12e
--- /dev/null
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+i=$1
+beispiel=gesamt
+PROGRAM=./$beispiel
+
+#LOC=.
+LOC=/usr/ftp/pub/ubvl/test/$beispiel
+
+allow_null_glob_expansion=1
+
+if [ ! -d ~/abgabe/$beispiel ]; then
+  echo "Fehler: Verzeichnis ~/abgabe/$beispiel existiert nicht."
+  exit 1
+else
+  cd ~/abgabe/$beispiel
+  echo 'Teste "make"'
+  make
+fi
+
+if test ! -x $PROGRAM
+then
+       echo "Fehler: Kein Programm $PROGRAM"
+       exit 1
+fi
+let prgnum=0
+#for i in $LOC/*.0 $LOC2/*.0
+if [ -f $i ]; then
+       let prgnum=prgnum+1
+       let errorfound=0
+       echo "==========> Eingabe von $i:"
+       cat $i
+       echo
+       RESFILE=test${beispiel}out$$
+       $PROGRAM <$i >$RESFILE
+       retval=$?
+       echo -n "Übersetzung: "
+       if test $retval -eq 0
+       then
+               echo "Status korrekt"
+       else
+               echo "[Errot] Status=$retval. Erwartet: 0"
+               let errorfound=1
+       fi
+       echo
+       echo "Ausgabe:"
+       if [ -f ~/test/scripts/clr.py ]; then
+               cat $RESFILE | ~/test/scripts/clr.py
+       else
+               cat $RESFILE
+       fi
+       mv -f $RESFILE $RESFILE.s
+       CALLFILE=${i%.*}.call
+       echo
+       if [ ! -f $CALLFILE ]; then
+       echo "Fehler: Datei $CALLFILE existiert nicht, kann Code nicht ausführen..."
+       exit 1
+       else
+       echo "Übersetze und linke das Testprogramm:"
+       if cc -g -I. -DCALL=\"$CALLFILE\" $LOC/testmain.c $LOC/callingconvention.o $RESFILE.s; then
+               echo
+               echo "Rufe folgendes Codefragment auf:"
+               cat $CALLFILE
+               echo
+               gdb ./a.out 
+       else
+               echo "[Error] Erzeugter Code konnte nicht assembliert und gelinkt werden."
+               let errorfound=1
+       fi
+       fi
+       rm -f a.out $RESFILE $RESFILE.s
+fi