gstreamer/subprojects/gstreamer-sharp/Tests/test_abi.py
Akkariin Meiko 27c4ec74a1 Update
2022-03-12 03:16:09 +08:00

29 lines
749 B
Python
Executable File

#!/usr/bin/env python3
import difflib
import sys
import shutil
import subprocess
reference_abi = subprocess.check_output(sys.argv[1]).decode().split("\n")
launcher = []
if shutil.which("mono"):
launcher = ["mono", "--debug"]
csharp_abi = subprocess.check_output(launcher + [sys.argv[2]]).decode().split("\n")
print("Comparing output of %s and %s" % (sys.argv[1], sys.argv[2]))
res = 0
for line in difflib.unified_diff(reference_abi, csharp_abi):
res = 1
print(line)
if res:
files = [(sys.argv[1] + ".res", reference_abi),
(sys.argv[2] + 'res', csharp_abi)]
for f, vals in files:
with open(f, "w") as _f:
print("Outputing results in " + f)
_f.write("\n".join(vals))
sys.exit(res)