capstone/bindings/stdout_cmp.py
billow 21f7bc85f9
Xtensa Support (#2380)
* Fix leaks

* Remove unnecessary new lines

* Add checks for actual buffer length before attempting reading it.

* Xtensa: add xtensa support

* Xtensa fixes

- fix MCExpr
- fix Xtensa_add_cs_detail
- add `add_cs_detail`
- add `MCExpr *MCOperand_getExpr(const MCOperand *MC)` `void printExpr(const MCExpr *E, SStream *O)`

autosync fix

- fix StreamOperation.py
- replace `report_fatal_error` with `CS_ASSERT`
- fix patch StreamOperation.py
- replace `assert` with `CS_ASSERT`
- fix AddCSDetail.py
- fix QualifiedIdentifier

* Xtensa fix

* Xtensa fix .py

* add Xtensa to the fuzzer

* Xtensa `LITBASE`: add a basic implementation

* Xtensa `LITBASE`: add a integration test

* Xtensa: fix cs_v6_release_guide.md

* Xtensa: fix `XTENSA_OP_GROUP_MEMOPERAND`

* Xtensa: fix

* Xtensa: fix Targets.py

* Use isUint and isInt all over Xtensa

* Add documentation about LITBASE functionality

* Fix typo

* Replace hard with Capstone assert

* Xtensa: fix arch_config.json

* Xtensa: fix

---------

Co-authored-by: Rot127 <unisono@quyllur.org>
2024-09-30 11:35:51 +08:00

31 lines
851 B
Python

#!/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)