|
|
@ -1,10 +1,23 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
# change working dir to where this script resides in |
|
|
|
pushd `dirname "$0"` > /dev/null |
|
|
|
|
|
|
|
if [ -n "$1" ]; then |
|
|
|
RESULT_SAVETO=`realpath $1` |
|
|
|
fi |
|
|
|
BASE_COMMIT=95a80f598fc57c60aed3737c60ee437d94eb8540 |
|
|
|
if [ -n "$2" ] && git log $2 > /dev/null 2>&1; then |
|
|
|
BASE_COMMIT=$2 |
|
|
|
elif ! git log $BASE_COMMIT > /dev/null 2>&1; then |
|
|
|
echo "No valid base commit found." |
|
|
|
exit 0 |
|
|
|
fi |
|
|
|
LABS=`git diff $BASE_COMMIT --stat | grep -o "lab[0-9]" | uniq` |
|
|
|
COMMIT=`git rev-parse HEAD` |
|
|
|
|
|
|
|
if [ "$LABS" = "" ]; then |
|
|
|
echo "No solutions provided. Skip this time." |
|
|
|
echo "No updated lab found. Skip." |
|
|
|
exit 0 |
|
|
|
fi |
|
|
|
|
|
|
@ -19,6 +32,14 @@ for lab in $LABS; do |
|
|
|
if ! make grade > .score 2>&1; then |
|
|
|
failed=`echo $lab | grep -o [0-9]` |
|
|
|
fi |
|
|
|
if [ -n "$RESULT_SAVETO" ]; then |
|
|
|
mkdir -p $RESULT_SAVETO/$COMMIT/$lab |
|
|
|
mv .score .score_orig |
|
|
|
../tools/split_score_log.py .score_orig > .score |
|
|
|
for i in .*.log .*.error; do |
|
|
|
cp $i $RESULT_SAVETO/$COMMIT/$lab/${i#.} |
|
|
|
done |
|
|
|
fi |
|
|
|
score=`egrep -o "Score: [0-9]+/[0-9]+" .score` |
|
|
|
echo "$lab $score" >> $summary |
|
|
|
make clean > /dev/null |
|
|
@ -35,7 +56,10 @@ echo |
|
|
|
for lab in $LABS; do |
|
|
|
echo "================================ $lab ===============================" |
|
|
|
cat $lab/.score |
|
|
|
rm $lab/.score |
|
|
|
done |
|
|
|
|
|
|
|
find . -name '.*' -delete |
|
|
|
|
|
|
|
popd > /dev/null |
|
|
|
|
|
|
|
exit $failed |