From 547ea670d895bb61273aded469058e4b52099d7a Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Tue, 3 Oct 2017 22:31:22 +0200 Subject: [PATCH] Better automated evaluation --- AuswertungKlausur/noten.sh | 54 ++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/AuswertungKlausur/noten.sh b/AuswertungKlausur/noten.sh index 8a8c31147..2a21cf919 100755 --- a/AuswertungKlausur/noten.sh +++ b/AuswertungKlausur/noten.sh @@ -3,8 +3,30 @@ # TODO: devine marker string variable # TODO: show non-compiling projects in logfile #rm -rf Unpack + +# The original examination project skeleton +PROJECTREF=~/workspace/GoikLectures/Klausuren/Sd1/2017Summer/Exam + +# Representative of archive integrity +SRCREPRESENT=src/main/java/de/hdm_stuttgart/mi/sd1/aufgabe1/HandyAbrechnung.java + +# The executable jar archive containing unit tests +TESTJAR=sd1_2017sommer_exam-0.9-fat-tests.jar + +# Strings like e.g. "Aufgabe 2" referencing "Aufgabe 2: (30/50)" +declare -a MARKERS=("Aufgabe 1" "Aufgabe 2") + + +# No changes beyond this line +#-------------------------------------------------------------------------------------------- + mkdir -p Unpack -rm -f ~/results.log +rm -rf ~/results.log /tmp/Reference +cp -r $PROJECTREF /tmp/Reference +pushd /tmp/Reference + mvn eclipse:clean clean; + rm -rf src/main/java +popd for zip in $( ls *.zip); do fbname=$(basename "$zip" .zip) @@ -18,21 +40,31 @@ for zip in $( ls *.zip); do if [[ 1 = $nodeCount && 1 = $dirCount ]]; then echo "Found exactly one directory component" mv * project - if [ -f project/pom.xml ]; then - echo "found pom.xml" - tar zxf ~/goiksolution.tgz - mv project/src/main/java/de/hdm_stuttgart/sw1 GoikSolution/src/main/java/de/hdm_stuttgart - cd GoikSolution; - mvn compile - reachedPoints=`mvn exec:java -Dexec.mainClass="de.hdm_stuttgart.eval.ShowReachedPoints"|grep Test_Helper` - echo "$fbname $reachedPoints" >> ~/results.log + if [ -f project/$SRCREPRESENT ]; then + echo "found HandyAbrechnung.java" + cp -r /tmp/Reference . + mv project/src/main/java Reference/src/main + pushd Reference + mvn compile test-compile + if [ $? -eq 0 ] ; then + mvn -Dmaven.test.skip=true package + result="" + for mark in "${MARKERS[@]}"; do + result+=`java -jar target/$TESTJAR | grep "$mark"|sed 's/^[ ]*//'` + result+=" " + done + else + result="Project does not compile" + fi + popd + echo "$fbname $result" >> ~/results.log else - echo "$fbname : No pom.xml found in project" >> ~/results.log + echo "$fbname : $SRCREPRESENT not found" >> ~/results.log fi else echo "$fbname : Found more than one directory component" >> ~/results.log fi - popd + popd # return from Unpack rm -rf Unpack done -- GitLab