diff(f1, f2)- Checks two files against each other; returns a boolean, True if the two files are different
require(paths)- Asserts that all paths passed into the function exist, raises an Error otherwise
hash(filename)- Returns the SHA-256 hash of the file
spawn(cmd, env=None)- Runs the command
cmdwith environment variables specified byenv, returns aChild
- Runs the command
add(cmd, paths)- Includes each of paths in checks directory
append_code(filename, codefile)- Appends the contents of
filenameto the end ofcodefile
- Appends the contents of
replace_fn(old_fn, new_fn, filename)- Replaces C function calls to
old_fnwith function calls tonew_fnin assembly filefilename
- Replaces C function calls to
stdin(line, prompt=True, timeout=3)- Passes in the
lineof input (or passesEOFiflineisEOF) - If prompt is
True, asserts that some textual prompt should be displayed first before passing instdin, and will wait up totimeoutseconds for the prompt
- Passes in the
stdout(output=None, str_output=None, timeout=3)- If output is
None, waitstimeoutseconds for program to terminate, and then returns the output (stdoutandstderr) - Otherwise, asserts that the program’s output will match the regex output
- If output is a file, rather than a regex, then the method asserts that the output matches the file exactly
str_outputis the human-friendly version of the output regex which will be displayed in error messages to the student
- If output is
reject(timeout=3)- Asserts that the student’s program will reject the previously provided input; in other words, asserts that the program provides a textual prompt (within
timeoutseconds) and then waits forstdin
- Asserts that the student’s program will reject the previously provided input; in other words, asserts that the program provides a textual prompt (within
exit(code=None, timeout=3)- waits
timeoutseconds for the program to terminate - If code is
None, returns the exit code - If code isn’t
None, asserts that the program exits with code code
- waits
wait(timeout=3)- Waits
timeoutseconds for program to terminate, raises an error if it doesn’t
- Waits
kill()- Terminates the process
__init__(rationale=None, helpers=None, result=Checks.FAIL)- When raised, the check ends with the
result rationaleis the reason why the check failed (and should be either astror aMismatch)helpersis a line of advice for how the student might be able to fix their problemresultcan bePASS,FAIL, orSKIP
- When raised, the check ends with the
__init__(expected, actual)- Represents a type of
rationalethat can be passed to anError. Used to indicate that we expected outputexpected, but got outputactual
- Represents a type of
__init__(filename)- Represents a file whose name is
filename
- Represents a file whose name is
read()- Returns the contents of the file
@check(dependency)- Defines a check to run: will only run if dependency passes, and will use its side-effects
@valgrind- Checks for memory errors during check