diff options
| author | Léo Lam <leo@leolam.fr> | 2020-11-01 14:55:34 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2020-11-01 15:43:22 +0100 |
| commit | d0deedac4c67170ecbae45afaca0d67a8aabd577 (patch) | |
| tree | 23e1db6b8dac6bf9cf0d7f979ae5898b6a48a349 /tools/progress.py | |
| parent | 9aacce607d74d34d0a8ced7946b5154baebe5a5c (diff) | |
Compare non-matching functions against expected output
This makes it possible to catch regressions for non-matching functions,
especially those that only have minor issues.
This also reclassifies some minor non-matchings as major non-matchings
whenever it's really not obvious to see that they are equivalent.
Diffstat (limited to 'tools/progress.py')
| -rwxr-xr-x | tools/progress.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/progress.py b/tools/progress.py index f18819ca..976f94ab 100755 --- a/tools/progress.py +++ b/tools/progress.py @@ -3,6 +3,7 @@ import argparse from collections import defaultdict from colorama import Back, Fore, Style import enum +from pathlib import Path import utils from utils import FunctionStatus import typing as tp @@ -14,6 +15,8 @@ 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() @@ -31,6 +34,15 @@ counts: tp.DefaultDict[FunctionStatus, int] = defaultdict(int) ai_counts: tp.DefaultDict[AIClassType, int] = defaultdict(int) ai_counts_done: tp.DefaultDict[AIClassType, 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 @@ -57,10 +69,10 @@ for info in utils.get_functions(): code_size[info.status] += info.size if info.status == FunctionStatus.NonMatching: - if args.print_nm: + if args.print_nm and not should_hide_nonmatching(info.decomp_name): print(f"{Fore.RED}NM{Fore.RESET} {utils.format_symbol_name(info.decomp_name)}") elif info.status == FunctionStatus.Equivalent: - if args.print_eq: + if args.print_eq and not should_hide_nonmatching(info.decomp_name): print(f"{Fore.YELLOW}EQ{Fore.RESET} {utils.format_symbol_name(info.decomp_name)}") elif info.status == FunctionStatus.Matching: if args.print_ok: |
