Add test for loading JSON dump

- Add a test that compares protobuf and JSON dumps.
- Add input-format=Json to header-abi-linker and diff.

Bug: 112877706
Test: ./test.py
Change-Id: Ic9be304b565a2ac58ed76e1a0fcc96530395b750
This commit is contained in:
Hsin-Yi Chen
2018-09-07 19:24:32 +08:00
parent 868cdf5cb2
commit 4b9b242efe
6 changed files with 34 additions and 18 deletions

View File

@@ -93,11 +93,12 @@ def run_header_abi_dumper(input_path, remove_absolute_paths, cflags=[],
return f.read()
def run_header_abi_dumper_on_file(input_path, output_path,
export_include_dirs = [], cflags =[]):
export_include_dirs=[], cflags=[], flags=[]):
input_name, input_ext = os.path.splitext(input_path)
cmd = ['header-abi-dumper', '-o', output_path, input_path,]
for dir in export_include_dirs:
cmd += ['-I', dir]
cmd += flags
cmd += ['--']
cmd += cflags
if input_ext == '.cpp' or input_ext == '.cc' or input_ext == '.h':
@@ -113,13 +114,12 @@ def run_header_abi_dumper_on_file(input_path, output_path,
subprocess.check_call(cmd)
def run_header_abi_linker(output_path, inputs, version_script, api, arch,
output_format=None):
flags=[]):
"""Link inputs, taking version_script into account"""
with tempfile.TemporaryDirectory() as tmp:
cmd = ['header-abi-linker', '-o', output_path, '-v', version_script,
'-api', api, '-arch', arch]
if output_format:
cmd += ['-output-format', output_format]
cmd += flags
cmd += inputs
subprocess.check_call(cmd)
with open(output_path, 'r') as f: