aboutsummaryrefslogtreecommitdiff
path: root/examples/sml/run.sh
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@debian.org>2018-09-13 16:29:29 -0400
committerRyan Kavanagh <rak@debian.org>2018-09-13 17:14:23 -0400
commitac1fe7d7abba32ef0c83ca1a22092bab9de5f171 (patch)
treeb49c343d9f135205bb5ca40db678dcadefcfbd80 /examples/sml/run.sh
parentrun.sh should not extract autograde.tar (diff)
SML example importHEADmaster
Diffstat (limited to 'examples/sml/run.sh')
-rwxr-xr-xexamples/sml/run.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/sml/run.sh b/examples/sml/run.sh
new file mode 100755
index 0000000..fcaea5d
--- /dev/null
+++ b/examples/sml/run.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+abort () {
+ if [ "x$1" != "x" ]; then
+ echo "$1"
+ fi
+ printf "\n\n{\"scores\": {}}"
+ exit 0
+}
+
+[ -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."