new script file to run compiler...this one uses options and combines
authorbdemsky <bdemsky>
Wed, 7 Feb 2007 22:20:49 +0000 (22:20 +0000)
committerbdemsky <bdemsky>
Wed, 7 Feb 2007 22:20:49 +0000 (22:20 +0000)
the functionality of all previous ones

Robust/src/IR/Flat/BuildCode.java
Robust/src/Tests/dotest
Robust/src/buildscript
Robust/src/buildscriptrepair [deleted file]
Robust/src/buildscripttask

index 40ea96da43a20a60c9b9160e725a3da2a3993b7c..361c5da4db51958722111f15830f912dfc978e08 100644 (file)
@@ -336,6 +336,8 @@ public class BuildCode {
                output.println("  "+arraytype+"_"+ state.getArrayNumber(fd.getType()) +" * "+fd.getSymbol()+";");
            } else if (fd.getType().isClass())
                output.println("  "+fd.getType().getRepairSymbol()+" * "+fd.getSymbol()+";");
+           else if (fd.getType().isFloat())
+               output.println("  int "+fd.getSymbol()+"; /* really float */");
            else 
                output.println("  "+fd.getType().getRepairSymbol()+" "+fd.getSymbol()+";");
        }
index c724ccf8014e546b262238806e2a56f140740301..3681a9204effbb1e813ff8ba6e1eaa4fbb84b989 100755 (executable)
@@ -5,7 +5,7 @@ shift
 shift
 
 echo Doing Test $ARG1
-../buildscript $ARG1 $ARG2 &>/dev/null
+../buildscript -mainclass $ARG1 $ARG2 -o $ARG1 &>/dev/null
 $ARG1.bin $@ &> output/$ARG1.output
 diff output/$ARG1.output output/$ARG1.output.goal
 rm $ARG1.bin
index 9a20f7db31d860a31a896e358b5b6d876db1aa3c..5ddacc3ce9476ebad3c8c84f593a28fbe8533f8a 100755 (executable)
@@ -1,9 +1,172 @@
 #!/bin/bash
+
+printhelp() {
+echo -check generate check code
+echo -recover compile task code
+echo -specdir directory
+echo -debug generate debug symbols
+echo -runtimedebug printout runtime debug messages
+echo "-optimize call gcc with -O9 (optimize)"
+echo "-nooptimize call gcc with -O0 (do not optimize)"
+echo -curdir directory 
+echo -mainclass class with main method
+echo -o binary
+echo -instructionfailures inject code for instructionfailures
+echo -help help
+}
+
 ROBUSTROOT=~/research/Robust/src
-MAINFILE=$1
+REPAIRROOT=~/research/Repair/RepairCompiler/
+CURDIR=`pwd`
+CHECKFLAG=false
+RECOVERFLAG=false
+SPECDIR=`pwd`
+SRCFILES=''
+EXTRAOPTIONS=''
+MAINFILE='a'
+JAVAOPTS=''
+
+if [[ -z $1 ]]
+then
+printhelp
+exit
+fi
+
+while [[ -n $1 ]]
+do
+if [[ $1 = '-help' ]]
+then
+printhelp
+exit
+elif [[ $1 = '-o' ]]
+then
+MAINFILE="$2"
+shift
+elif [[ $1 = '-mainclass' ]]
+then
+JAVAOPTS="$JAVAOPTS -mainclass $2"
+shift
+elif [[ $1 = '-recover' ]]
+then
+RECOVERFLAG=true
+JAVAOPTS="$JAVAOPTS -task"
+elif [[ $1 = '-instructionfailures' ]]
+then
+JAVAOPTS="$JAVAOPTS -instructionfailures"
+elif [[ $1 = '-check' ]]
+then
+CHECKFLAG=true
+JAVAOPTS="$JAVAOPTS -conscheck"
+elif [[ $1 = '-specdir' ]]
+then
+cd $2
+SPECDIR=`pwd`
+cd $CURDIR
+shift
+elif [[ $1 = '-debug' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -g"
+elif [[ $1 = '-runtimedebug' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
+elif [[ $1 = '-nooptimize' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -O0"
+elif [[ $1 = '-optimize' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -O9"
+elif [[ $1 = '-curdir' ]]
+then
+CURDIR=$2
+shift
+else
+SRCFILES="$SRCFILES $1"
+fi
 shift
-mkdir tmpbuilddirectory
+done
+
+BUILDDIR="$CURDIR/tmpbuilddirectory"
+
+cd $1
+cd $CURDIR
+shift
+
+mkdir $BUILDDIR
+
+if $CHECKFLAG #Generate structure files for repair tool
+then
+JAVAOPTS="$JAVAOPTS -struct structfile"
+fi
+
+# Build bristlecone/java sources
+
+java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
+$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
+$JAVAOPTS $SRCFILES
+
+# Build all of the consistency specs
+
+if $CHECKFLAG # CHECKFLAG
+then
+cd $SPECDIR
+mkdir $BUILDDIR/specdir
+cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
+
+echo > $BUILDDIR/specs
+
+# compile specs into C code
+for i in * # iterate over all directories
+do
+if [[ "$i" != "CVS" ]] # CVSDIR CHECK
+then
+cd $SPECDIR/$i
+cat $BUILDDIR/structfile.struct $i.label > $i.struct
+java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
+cp size.[c,h] $BUILDDIR/specdir
+cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
+echo $i >> $BUILDDIR/specs
+fi # CVSDIR CHECK
+done # iterate over all directories
+
+#compile C code
+
+cd $BUILDDIR/specdir
+./buildrobust
+echo > $BUILDDIR/checkers.h
+for i in `cat $BUILDDIR/specs`
+do
+gcc -O0 -g -c $i\_aux.c
+echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
+done
+fi # CHECKFLAG
+
+#build and link everything
+
+cd $CURDIR 
+
+
+INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
+-I$BUILDDIR"
+
+FILES="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c \
+$ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c \
+$ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c \
+$ROBUSTROOT/Runtime/GenericHashtable.c"
+
+if $RECOVERFLAG
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
+FILES="$FILES $ROBUSTROOT/Runtime/socket.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c "
+fi
+
+if $CHECKFLAG
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
+INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
+fi
+
+gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
+tmpbuilddirectory/methods.c $FILES -o $MAINFILE.bin
+exit
 
-java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary $ROBUSTROOT/ClassLibrary/ -dir tmpbuilddirectory -precise -mainclass $MAINFILE $@
 
-gcc -I$ROBUSTROOT/Runtime -Itmpbuilddirectory -DPRECISE_GC -O0 -g tmpbuilddirectory/methods.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/option.c -o $MAINFILE.bin
diff --git a/Robust/src/buildscriptrepair b/Robust/src/buildscriptrepair
deleted file mode 100755 (executable)
index 6cb321d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-# arguments are:
-# 1 Name of executable
-# 2 Directory containing specs
-# 3-n List of class files to compile
-
-ROBUSTROOT=~/research/Robust/src
-REPAIRROOT=~/research/Repair/RepairCompiler/
-CURDIR=`pwd`
-BUILDDIR=$CURDIR/tmpbuilddirectory
-MAINFILE=$1
-shift
-
-cd $1
-SPECDIR=`pwd`
-cd $CURDIR
-shift
-
-mkdir $BUILDDIR
-java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
-$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise -struct $MAINFILE -conscheck \
--struct structfile -task $@
-
-# Build all of the consistency specs
-
-cd $SPECDIR
-mkdir $BUILDDIR/specdir
-cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
-
-echo > $BUILDDIR/specs
-
-# compile specs into C code
-for i in *
-do
-if [ "$i" != "CVS" ]
-then
-cd $SPECDIR/$i
-cat $BUILDDIR/structfile.struct $i.label > $i.struct
-java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
-ls
-cp size.[c,h] $BUILDDIR/specdir
-cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
-echo $i >> $BUILDDIR/specs
-fi
-done
-
-#compile C code
-
-cd $BUILDDIR/specdir
-./buildrobust
-echo > $BUILDDIR/checkers.h
-for i in `cat $BUILDDIR/specs`
-do
-gcc -O0 -g -c $i\_aux.c
-echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
-done
-
-#build and link everything
-
-cd $CURDIR 
-gcc -I$ROBUSTROOT/Runtime -I. -I$BUILDDIR/specdir \
--IRuntime/include -I$BUILDDIR -O0 -DPRECISE_GC -DCONSCHECK \
--LRuntime/lib/ -lgc -DTASK -g tmpbuilddirectory/methods.c \
-tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c \
-$ROBUSTROOT/Runtime/file.c \
-$ROBUSTROOT/Runtime/socket.c \
-$ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c \
-$ROBUSTROOT/Runtime/checkpoint.c \
-$ROBUSTROOT/Runtime/option.c \
-$ROBUSTROOT/Runtime/garbage.c \
-$ROBUSTROOT/Runtime/GenericHashtable.c $BUILDDIR/specdir/*.o -o \
-$MAINFILE.bin
index 85dcbb4462f8aa1c45d20aa54a9c13e03d1cba75..c333f5adb4176aa6e64a626e0ae00f6f2783e37a 100755 (executable)
@@ -6,4 +6,4 @@ mkdir tmpbuilddirectory
 
 java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary $ROBUSTROOT/ClassLibrary/ -dir tmpbuilddirectory -precise -struct $MAINFILE -task $@
 
-gcc -DPRECISE_GC -I$ROBUSTROOT/Runtime -I. -IRuntime/include -Itmpbuilddirectory -O0 -LRuntime/lib/ -DTASK -DDEBUG -g tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/socket.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c -o $MAINFILE.bin
\ No newline at end of file
+gcc -DPRECISE_GC -I$ROBUSTROOT/Runtime -I. -IRuntime/include -Itmpbuilddirectory -O9 -g -LRuntime/lib/ -DTASK -DDEBUG tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/socket.c $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c -o $MAINFILE.bin
\ No newline at end of file