Commit f256dfff authored by Dr. Martin Goik's avatar Dr. Martin Goik

Using single zips rather than ensembles

parent 436c4df6
#!/bin/bash #!/bin/bash
# TODO: devine marker string variable
# TODO: show non-compiling projects in logfile
#rm -rf Unpack
# The original examination project skeleton # The original examination project skeleton
PROJECTREF=~/GoikLectures/Klausuren/Sd1/2017Summer/Exam PROJECTREF=~/GoikLectures/Klausuren/Sd1/2019summer/Exam
# Representative of archive integrity # File representative of archive integrity
SRCREPRESENT=src/main/java/de/hdm_stuttgart/mi/sd1/aufgabe1/HandyAbrechnung.java SRCREPRESENT=src/main/java/de/hdm_stuttgart/mi/sd1/task2/ChangeAmount.java
# The executable jar archive containing unit tests # The executable jar archive containing unit tests
TESTJAR=sd1_2017sommer_exam-0.9-fat-tests.jar TESTJAR=sd1_2019summer_exam-0.9-fat-tests.jar
# Strings like e.g. "Aufgabe 2" referencing "Aufgabe 2: (30/50)" # Strings like e.g. "Aufgabe 2" referencing "Aufgabe 2: (30/50)"
declare -a MARKERS=("Aufgabe 1" "Aufgabe 2") declare -a MARKERS=("Aufgabe 1" "Aufgabe 2")
# No changes beyond this line # Hands off beyond this line
#-------------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------------
mkdir -p Unpack zip=$1
fbname=$(basename "$zip" .zip)
rm -rf ~/results.log /tmp/Reference rm -rf ~/results.log /tmp/Reference
cp -r $PROJECTREF /tmp/Reference cp -r $PROJECTREF /tmp/Reference
pushd /tmp/Reference pushd /tmp/Reference
mvn -T4 clean; mvn -T4 clean > /dev/null 2>&1
rm -rf src/main/java rm -rf src/main/java
popd popd
for zip in $( ls *.zip); do mkdir Unpack;pushd Unpack
fbname=$(basename "$zip" .zip) unzip ../$fbname.zip > /dev/null
echo $fbname pomFileCount=`find . -name pom.xml|wc -l`
mkdir Unpack;pushd Unpack if [[ 1 = $pomFileCount ]]; then
unzip ../$fbname.zip projectDir=`find . -name pom.xml`
pomFileCount=`find . -name pom.xml|wc -l` projectDir=${projectDir%/*}
if [[ 1 = $pomFileCount ]]; then echo "Found project $projectDir"
projectDir=`find . -name pom.xml`
projectDir=${projectDir%/*}
echo "Found project $projectDir"
if [ -f $projectDir/$SRCREPRESENT ]; then if [ -f "${projectDir}"/$SRCREPRESENT ]; then
echo "Found $projectDir/$SRCREPRESENT" echo "Found $projectDir/$SRCREPRESENT"
cp -r /tmp/Reference . cp -r /tmp/Reference .
cp -r $projectDir/src/main/java Reference/src/main cp -r "$projectDir"/src/main/java Reference/src/main
pushd Reference pushd Reference
mvn -T4 compile test-compile mvn -T4 compile test-compile > /dev/null 2>&1
if [ $? -eq 0 ] ; then if [ $? -eq 0 ] ; then
mvn -T4 -Dmaven.test.skip=true package mvn -T4 -Dmaven.test.skip=true package > /dev/null 2>&1
result="" result=""
for mark in "${MARKERS[@]}"; do for mark in "${MARKERS[@]}"; do
result+=`java -jar target/$TESTJAR | grep "$mark"|sed 's/^[ ]*//'` result+=`java -jar target/$TESTJAR | grep "$mark"|sed 's/^[ ]*//'`
result+=" " result+=" "
done done
else else
result="$projectDir does not compile" echo "$projectDir does not compile"
fi exit 1;
popd fi
echo "$fbname $result" >> ~/results.log popd
echo "$fbname $result" >> ~/results.log
#Cleanup user project
pushd $projectDir #Cleanup user project
rm -rf *.iml .idea A1.log pushd "$projectDir"
mvn clean rm -rf *.iml .idea A1.log
popd mvn clean > /dev/null 2>&1
rm ../$fbname.zip popd
zip -r ../$fbname.zip $projectDir rm ../"$fbname".zip
else zip -r ../"$fbname".zip "$projectDir" > /dev/null 2>&1
echo "$fbname : $SRCREPRESENT not found" >> ~/results.log
fi
else else
echo "$fbname : Found more than one directory component" >> ~/results.log echo "$fbname : ${projectDir}/$SRCREPRESENT not found"
exit 1
fi fi
popd # return from Unpack else
rm -rf Unpack echo "$fbname : Found more than one directory component" >> ~/results.log
done exit 1
fi
popd # return from Unpack
rm -rf Unpack
echo "---------------------------------------"
cat ~/results.log
echo "+++++++++++++++++++++++++++++++++++++++"
uid=`echo $1| sed -e s/.zip//`
grep $uid ~/bonusprojekte.csv
echo "---------------------------------------"
echo Results at ~/results.log
#end #end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment