Remove expected/

The intention was to catch functional regressions in non-matching
functions but this doesn't actually work well because referenced
code and data may have moved after a function was dumped, in which
case the reference checker is unable to verify that function calls
and data references are still correct.

Considering this increases the amount of complexity in the checker
and makes the workflow more complicated for contributors, let's just
drop this mechanism. It isn't worth it.

Putting binary files in the repo is also pretty meh.
This commit is contained in:
Léo Lam 2021-07-30 19:59:20 +02:00
parent ea030c356c
commit 2204f46b0b
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
70 changed files with 2 additions and 45 deletions

View File

@ -1 +0,0 @@
в▓Ч

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,29 +0,0 @@
#!/usr/bin/env python3
import argparse
import util.elf
from util import utils
def dump_fn(name: str) -> None:
expected_dir = utils.get_repo_root() / "expected"
try:
fn = util.elf.get_fn_from_my_elf(name)
path = expected_dir / f"{name}.bin"
path.parent.mkdir(exist_ok=True)
path.write_bytes(fn.data)
except KeyError:
utils.fail("could not find function")
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("function_name", help="Name of the function to dump")
args = parser.parse_args()
dump_fn(args.function_name)
if __name__ == "__main__":
main()

View File

@ -2,8 +2,6 @@
import argparse
from collections import defaultdict
from colorama import Back, Fore, Style
import enum
from pathlib import Path
from util import utils
from util.utils import FunctionStatus
import typing as tp
@ -17,8 +15,6 @@ parser.add_argument("--print-eq", "-e", action="store_true",
help="Print non-matching functions with minor issues")
parser.add_argument("--print-ok", "-m", action="store_true",
help="Print matching functions")
parser.add_argument("--hide-nonmatchings-with-dumps", "-H", help="Hide non-matching functions that have expected "
"output dumps", action="store_true")
args = parser.parse_args()
code_size_total = 0
@ -26,15 +22,6 @@ num_total = 0
code_size: tp.DefaultDict[FunctionStatus, int] = defaultdict(int)
counts: tp.DefaultDict[FunctionStatus, int] = defaultdict(int)
nonmatching_fns_with_dump = {p.stem for p in (Path(__file__).parent.parent / "expected").glob("*.bin")}
def should_hide_nonmatching(name: str) -> bool:
if not args.hide_nonmatchings_with_dumps:
return False
return name in nonmatching_fns_with_dump
for info in utils.get_functions():
code_size_total += info.size
num_total += 1
@ -47,10 +34,10 @@ for info in utils.get_functions():
if not args.csv:
if info.status == FunctionStatus.NonMatching:
if args.print_nm and not should_hide_nonmatching(info.decomp_name):
if args.print_nm:
print(f"{Fore.RED}NM{Fore.RESET} {utils.format_symbol_name(info.decomp_name)}")
elif info.status == FunctionStatus.Equivalent:
if args.print_eq and not should_hide_nonmatching(info.decomp_name):
if args.print_eq:
print(f"{Fore.YELLOW}EQ{Fore.RESET} {utils.format_symbol_name(info.decomp_name)}")
elif info.status == FunctionStatus.Matching:
if args.print_ok: