crashtest.hxsmith.pipeline
Evaluate one program: compile, run, decompile, recompile, run, compare.
Each stage is a small function returning data, so a stage can be replaced or
reused. evaluate strings them together and feeds quality.classify. It is
meant to run in a throwaway worker process (python -m crashtest.hxsmith.pipeline <workdir>, which reads <workdir>/job.json): a decompiler hang or memory blowup
is then just a CRASH verdict.
class Result
The outcome for one program: a verdict, or why the program was unusable as a test.
name: str
class_name: str
features: Tuple[str, ...]
features = ()
verdict: Optional[Verdict]
verdict = None
invalid: Optional[str]
invalid = None
elapsed: float
elapsed = 0.0
artifacts: Optional[str]
artifacts = None
to_json
def to_json() -> dict
from_json
classmethod
@classmethod
def from_json(data: dict) -> 'Result'
init
def __init__(name: str, class_name: str, features: Tuple[str, ...] = (), verdict: Optional[Verdict] = None, invalid: Optional[str] = None, elapsed: float = 0.0, artifacts: Optional[str] = None) -> None
build_original
def build_original(job: Job, directory: Path) -> Tuple[Path, Optional[str]]
Write the job's sources into directory and compile them for HashLink.
check_original
def check_original(program: Path) -> Optional[str]
Why the original cannot serve as an oracle: it must run, finish, and repeat itself.
decompile
def decompile(program: Path) -> Tuple[Dict[str, str], Optional[str]]
Export the bytecode image as a Haxe project; the error is where the decompiler fell over.
evaluate
def evaluate(job: Job, directory: Path) -> Result
Run every stage in directory and return the verdict. Never raises for a bad program.
main
def main(argv: List[str]) -> int
Worker entry: evaluate <workdir>/job.json, write <workdir>/result.json.
recompile
def recompile(files: Dict[str, str], directory: Path) -> Tuple[Path, Optional[str]]