Files
jak-project/third-party/capstone/bindings/stdout_cmp.py
T
Tyler Wilding bfc4c18ada goalc: replicate tests for the majority of ARM64 non-simd cases (#4377)
- Adds `capstone` as a disassembling library that could eventually
replace Zydis (for now left that alone)
- Replicates all of the existing x86 tests to ARM64, fixed a bunch of
underlying issues along the way
- There are a very small handful of tests remaining that need to be
enabled / fixed
2026-08-16 15:34:37 -04:00

31 lines
851 B
Python
Vendored
Generated

#!/usr/bin/env python3
import argparse
import difflib
import re
import subprocess
import sys
def stdout_cmp(f1, f2):
def lines_run(xs):
out = subprocess.run(xs, stdout=subprocess.PIPE, check=True).stdout.decode()
lines = out.splitlines(keepends=True)
return out, [re.sub(r'([\t ])', '', ln) for ln in lines]
out1, lns1 = lines_run(f1)
out2, lns2 = lines_run(f2)
dif = list(difflib.unified_diff(lns1, lns2))
return len(dif) == 0, dif
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Comparing the standard output of two threads')
parser.add_argument("-f1", nargs='+')
parser.add_argument("-f2", nargs='+')
argv = parser.parse_args(sys.argv[1:])
res, dif = stdout_cmp(argv.f1, argv.f2)
if not res:
print('\n'.join(dif))
exit(1)
exit(0)