autograde-ocaml is a tool to help grading (offline) OCaml assignments, partly relying on OCamlPro's learn-ocaml codebase.
It consists of a Bash script (autograde-ocaml.bash) that calls a specific version of learn-ocaml's CLI tool (learnocaml-grader.byte), fed on dedicated automated tests (provided by the teacher).
For reporting bugs: feel free to create a GitHub issue.
- Install Docker and
xmllint
(packagelibxml2-utils
) - Clone this repo and inspect the
autograde-ocaml.bash
script. - Write the teacher's solution (solution.ml) and ad-hoc grader (test.ml).
- Put {prelude.ml,prepare.ml,solution.ml,test.ml,template.ml} in the same folder (prof).
- Put all submissions in the same folder or in subdirs of the same folder (submissions). E.g.:__
mkdir sync2
find sync -name save.json -exec bash -c 'dir="$1"; dir=${dir%/save.json}; tok=${dir#sync/}; tok=${tok//\//-}; rsync -av "$dir/" "sync2/$tok"' bash '{}' \;
- Run autograde-ocaml.bash:
.../autograde-ocaml.bash -f prof
.../autograde-ocaml.bash -f prof -l -m 60 -x 60s -k -- submissions/*/*.ml
rsync -av .../pfitaxel-exam-repository/src/easy-check /tmp/
.../autograde-ocaml.bash -f prof -e -l -m 60 -x 30s -k $(find sync2 -name "tpn.ml")
- Address the failing submissions (compilation error, looping recursion, ...).
In case the student only clicked on Sync, not Grade:
cd TOKEN
jq -r '"(* FROM save.json *)\n" + ."exercises-editors"."ue-tpn"[1]' save.json > ue-tpn.ml
- Collect the
*.csv
:
find . -name "*.csv" -print0 | xargs --null -n 1 bash -c 'printf "%s," "${1%/*.csv}"; cat "$1"; echo' bash > res.txt
(The step 3 above will typically be the most time-consuming task.)
-
get_note
: Ensurexmllint --html --xpath …
always prints sth (dflt: 0) -
error.org
: Ensure it's nonempty/gathers compilation errors from docker-run.