The project uses a centralized grading script (grade.sh) located in the root directory to grade lab2 and later labs.
As of April 20, 2026, the grade.sh script has been modified to automatically generate missing expected output files (taskN.out) from standard teacher implementations when grading a lab. This eliminates the need for individual grade.sh scripts in lab2 and later directories and ensures consistency.
-
Teacher Implementations: Each lab should have a
submissions/teacher/directory containing standard implementation scripts (task1.shtotaskN.sh). -
Input Files: Test cases are stored in
labN/test_cases/taskN.in. -
Expected Outputs: If
taskN.outfiles are missing, the script will:- Check for the corresponding teacher script and input file.
- Execute the teacher script with the input to generate the expected output.
- Save the output to
taskN.out.
-
Grading Process:
- The script compares student submissions against the expected outputs while ignoring extra blank lines and whitespace-only formatting differences.
- Uses binary (pass/fail) task scoring for the shared lab2+ workflow.
- Results are saved to
labN/results/as CSV files.
# Grade a specific lab
./grade.sh lab3
# Grade a specific lab and print mismatched output diffs
./grade.sh --debug-diff lab3
# Grade all shared-grader labs
./grade.sh
# Use a specific ID file
./grade.sh lab3 id/5.csv- Consistency: Single grading script for all labs.
- Content-Based Comparison: Extra spaces and blank lines do not change the grade.
- Debugging Support:
--debug-diffprints a unified diff when student output does not match the teacher output. - Automation: No manual generation of expected outputs required.
- Error Prevention: Handles missing
.outfiles gracefully by generating them from standards. - Maintainability: Removes duplication of grading logic across labs.
Lab1 remains outside this shared workflow and keeps its own lab-specific grading script.