In this note
This repo is an autograder written in shell. It covers the loop a university assignment system needs: create an assignment, take submissions, summarize them, run tests, and produce a mark.
The constraint shapes the design. All state lives in the filesystem, and dash is the only language available.
Assignment and Submission Flow
The add script checks the assignment name, the solution file, the autotest spec, and the automarking spec before it writes anything. What passes goes under a hidden project directory.
The submit script checks that the assignment exists, that the student zID is in the expected format, and that the submitted file is there. It then creates a folder per student and records the timestamp and file size.
Marking Flow
The marking script reads the automarking spec and runs the student's latest submission against the reference solution. It captures stdout, stderr, and the exit status separately, then compares.
Comparison has switches for blank lines, case, digits, and whitespace. They matter because byte-for-byte equality is the wrong test for most student output: a trailing newline or a capitalized word is rarely what the assignment was asking for.
Design Constraints
Dash keeps the code close to POSIX. That shows up in the places that are easy to get wrong: quoting, path validation, exit codes, and temporary output files. An unquoted variable is one space away from a broken path.
Knowledge Points
- Shell can model a real system when the data already looks like files and folders.
- Every CLI argument is a potential path or command input, so validation is not optional.
- An autograder has to keep stdout, stderr, and exit status apart. Merging them loses the difference between wrong output and a crash.
- Diff options make marking fairer for differences that do not matter.
- File-backed state is easy to inspect. It stays that way only with consistent naming and cleanup rules.
- POSIX shell pushes toward small commands and explicit control flow.
- A CLI should fail loudly and consistently when inputs are malformed.
Takeaway
Most of the behavior here comes from the directory layout and the exit codes, not from a framework. Writing it in dash made the boundaries obvious, because nothing else was validating for me.