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
cmd
with 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
filename
to the end ofcodefile
- Appends the contents of
replace_fn(old_fn, new_fn, filename)
- Replaces C function calls to
old_fn
with function calls tonew_fn
in assembly filefilename
- Replaces C function calls to
stdin(line, prompt=True, timeout=3)
- Passes in the
line
of input (or passesEOF
ifline
isEOF
) - If prompt is
True
, asserts that some textual prompt should be displayed first before passing instdin
, and will wait up totimeout
seconds for the prompt
- Passes in the
stdout(output=None, str_output=None, timeout=3)
- If output is
None
, waitstimeout
seconds for program to terminate, and then returns the output (stdout
andstderr
) - 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_output
is 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
timeout
seconds) 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
timeout
seconds 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
timeout
seconds 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
rationale
is the reason why the check failed (and should be either astr
or aMismatch
)helpers
is a line of advice for how the student might be able to fix their problemresult
can bePASS
,FAIL
, orSKIP
- When raised, the check ends with the
__init__(expected, actual)
- Represents a type of
rationale
that 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