aboutsummaryrefslogtreecommitdiff
path: root/examples/tutch/run.sh
blob: ff313b2c1636a1cfebc8d1e5a2f5252e1c779e6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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."