A test runner for CMPUT 415 Compiler Design that services both student testing and automated grading.
Requirements: Python ≥ 3.8
git clone https://github.com/cmput415/Dragon-Runner.git
cd Dragon-Runner
pip install .Some newer versions of python prevent system-wide package installations by default. To get around this use a virtual environment or --break-system-packages. If dragon-runneris not found in your $PATH after install, ensure ~/.local/bin is added.
# Run tests normally
dragon-runner config.json
# Run in tournament mode (for grading)
dragon-runner tournament config.json
# Check for memory leaks (see Valgrind Config in `/tests`)
dragon-runner memcheck valgrindConfig.json
# Start HTTP server for explorer
dragon-runner serve /path/to/configsDragon-Runner uses JSON configuration files to define test packages, executables, and toolchains.
{
"testDir": "../packages/CPackage",
"testedExecutablePaths": {
"gcc": "/usr/bin/gcc"
},
"toolchains": {
"compile-and-run": [
{
"stepName": "compile",
"executablePath": "$EXE",
"arguments": ["$INPUT", "-o", "$OUTPUT"],
"output": "/tmp/test.o",
"allowError": true
},
{
"stepName": "run",
"executablePath": "$INPUT",
"arguments": [],
"usesInStr": true,
"allowError": true
}
]
}
}| Property | Description | Required |
|---|---|---|
testDir |
Path to directory containing test packages | ✓ |
testedExecutablePaths |
Map of executable IDs to file paths | ✓ |
toolchains |
Map of toolchain names to step lists | ✓ |
runtimes |
Map of runtime libraries (optional) | |
solutionExecutable |
Reference solution ID (optional) |
| Property | Description | Required |
|---|---|---|
stepName |
Human-readable step name | ✓ |
executablePath |
Path to executable (use $EXE, $INPUT) |
✓ |
arguments |
Command arguments list | ✓ |
output |
Output file path (optional) | |
allowError |
Allow non-zero exit codes (optional) | |
usesInStr |
Use test input stream as stdin (optional) | |
usesRuntime |
Load runtime library (optional) |
$EXE- Path to the tested executable$INPUT- Input file (testfile for first step, previous output for others)$OUTPUT- Output file for next step$RT_PATH- Runtime library directory$RT_LIB- Runtime library name
Tests support inline directives using comment syntax:
// INPUT: hello world
// CHECK: HELLO WORLD
int main() {
// Your test code here
return 0;
}INPUT:- Single line of stdin (no newline)INPUT_FILE:- Path to input fileCHECK:- Expected stdout (no newline)CHECK_FILE:- Path to expected output file
Multiple INPUT: and CHECK: directives are supported. INPUT: and INPUT_FILE: cannot be used together.
dragon-runner [mode] config.json [options...]regular(default) - Standard test executiontournament- Cross-product testing for gradingperf- Performance benchmarkingmemcheck- Memory leak detectionserve- HTTP server modescript- Run grading scripts
| Option | Description |
|---|---|
--timeout SECONDS |
Test timeout (default: 2.0) |
--fail-log FILE |
Log failures to file |
--verify |
Verify package exists for CCID |
--debug-package PATH |
Test single package |
-t, --time |
Show execution times |
-v, --verbosity |
Increase output verbosity (repeat for more) |
-s, --show-testcase |
Display test file contents |
-o, --output FILE |
Output file for results |
# Basic testing with timing
dragon-runner -t config.json
# Verbose tournament mode
dragon-runner tournament -vv config.json
# Performance testing with 5-second timeout
dragon-runner perf --timeout 5.0 config.json
# Serve configs on port 8080
dragon-runner serve --port 8080 /path/to/configs
# Run grading script
dragon-runner script build.py /path/to/submissions build.log 4Contributions welcome! Please file issues for bugs or feature requests, and feel free to submit pull requests.