crashtest.models
Dataclass models.
class GitInfo
Represents information about the git branch and commit, or lack thereof.
is_release: bool
dirty: bool
branch: Optional[str]
branch = None
commit: Optional[str]
commit = None
github: Optional[str]
github = None
to_json
def to_json() -> dict
from_json
classmethod
@classmethod
def from_json(data: dict) -> GitInfo
init
def __init__(is_release: bool, dirty: bool, branch: Optional[str] = None, commit: Optional[str] = None, github: Optional[str] = None) -> None
class MethodComparison
Opcode-level comparison result for a single method.
name: str
similarity: float
original_count: int
recompiled_count: int
orig_disasm: str
orig_disasm = ''
recomp_disasm: str
recomp_disasm = ''
error: Optional[str]
error = None
orig_lines: List[int]
orig_lines = field(default_factory=list)
recomp_lines: List[int]
recomp_lines = field(default_factory=list)
to_json
def to_json() -> dict
from_json
classmethod
@classmethod
def from_json(data: dict) -> MethodComparison
init
def __init__(name: str, similarity: float, original_count: int, recompiled_count: int, orig_disasm: str = '', recomp_disasm: str = '', error: Optional[str] = None, orig_lines: List[int] = list(), recomp_lines: List[int] = list()) -> None
class OpcodeComparison
Opcode-level comparison between original and recompiled bytecode.
overall_similarity: float
methods: List[MethodComparison]
methods = field(default_factory=list)
recompile_error: Optional[str]
recompile_error = None
to_json
def to_json() -> dict
from_json
classmethod
@classmethod
def from_json(data: dict) -> OpcodeComparison
init
def __init__(overall_similarity: float, methods: List[MethodComparison] = list(), recompile_error: Optional[str] = None) -> None
class Run
Represents a complete test run with git+version info and multiple test cases.
git: GitInfo
context: TestContext
cases: List[TestCase]
id: str
timestamp: str
status: str
status_color: str
status_color = '#a6e3a1'
avg_similarity
def avg_similarity() -> Optional[float]
to_json
def to_json() -> dict
to_summary_json
def to_summary_json() -> dict
A small subset of to_json, without the (potentially huge) per-case
disassembly/decompiled text - for listing runs, not inspecting one.
from_json
classmethod
@classmethod
def from_json(data: dict) -> Run
init
def __init__(git: GitInfo, context: TestContext, cases: List[TestCase], id: str, timestamp: str, status: str, status_color: str = '#a6e3a1') -> None
class TestCase
Represents a test case.
original: TestFile
decompiled: TestFile
ir: TestFile
test_id: int
failed: bool
test_name: Optional[str]
test_name = None
error: Optional[str]
error = None
opcode_comparison: Optional[OpcodeComparison]
opcode_comparison = None
layers: Optional[Dict[str, Any]]
layers = None
to_json
def to_json() -> dict
from_json
classmethod
@classmethod
def from_json(data: dict) -> TestCase
init
def __init__(original: TestFile, decompiled: TestFile, ir: TestFile, test_id: int, failed: bool, test_name: Optional[str] = None, error: Optional[str] = None, opcode_comparison: Optional[OpcodeComparison] = None, layers: Optional[Dict[str, Any]] = None) -> None
class TestContext
Represents the context for a complete test suite run.
version: str
to_json
def to_json() -> dict
from_json
classmethod
@classmethod
def from_json(data: dict) -> TestContext
init
def __init__(version: str) -> None
class TestFile
Represents a file and its content.
name: str
content: str
to_json
def to_json() -> dict
from_json
classmethod
@classmethod
def from_json(data: dict) -> TestFile
init
def __init__(name: str, content: str) -> None
load_runs
def load_runs(path: str) -> List[Run]
Load test runs from a folder.
save_run
def save_run(run: Run, path: str) -> None
Save run to JSON file.
SIMILARITY_THRESHOLD
SIMILARITY_THRESHOLD = 0.9