aboutsummaryrefslogtreecommitdiff
path: root/skel/run.sh
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@debian.org>2018-09-13 13:09:35 -0400
committerRyan Kavanagh <rak@debian.org>2018-09-13 13:49:07 -0400
commit5e78c729407999bd26af4d446edf0edf7d0af94e (patch)
tree8e44695c03bd8974e4a9b0831272e845ffa940ad /skel/run.sh
Import autograder from 15-317 f17
Diffstat (limited to 'skel/run.sh')
-rwxr-xr-xskel/run.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/skel/run.sh b/skel/run.sh
new file mode 100755
index 0000000..ff313b2
--- /dev/null
+++ b/skel/run.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+abort () {
+ if [ "x$1" != "x" ]; then
+ echo "$1"
+ fi
+ printf "\n\n{\"scores\": {}}"
+ exit 0
+}
+
+tar -mxf autograde.tar || \
+ abort "Failed to extract autograder."
+
+[ -d handin ] || mkdir handin
+
+[ -f handin.tar ] || \
+ abort "Submission is expected to be at handin.tar. This file does not exist!"
+
+tar -xf handin.tar -C handin || \
+ abort "Failed to extract submission."
+
+ml-build sources.cm Main.main grader || \
+ abort "Failed to compile autograder. Please contact course staff."
+
+sml @SMLload grader.* || \
+ abort "SML autograder exited with error. Please contact course staff."