Add option to skip identifiers in ABI checks
By default abi-compliance-checker will check the entire ABI/API. There are internal identifiers that we do not promise compatibility for, so we want the ability to skip them when checking the ABI/API.
This commit is contained in:
parent
da84e3215e
commit
c2883a29bc
1 changed files with 12 additions and 2 deletions
|
@ -29,7 +29,7 @@ class AbiChecker(object):
|
||||||
"""API and ABI checker."""
|
"""API and ABI checker."""
|
||||||
|
|
||||||
def __init__(self, report_dir, old_repo, old_rev, new_repo, new_rev,
|
def __init__(self, report_dir, old_repo, old_rev, new_repo, new_rev,
|
||||||
keep_all_reports):
|
keep_all_reports, skip_file=None):
|
||||||
"""Instantiate the API/ABI checker.
|
"""Instantiate the API/ABI checker.
|
||||||
|
|
||||||
report_dir: directory for output files
|
report_dir: directory for output files
|
||||||
|
@ -38,6 +38,7 @@ class AbiChecker(object):
|
||||||
new_repo: repository for git revision to check
|
new_repo: repository for git revision to check
|
||||||
new_rev: git revision to check
|
new_rev: git revision to check
|
||||||
keep_all_reports: if false, delete old reports
|
keep_all_reports: if false, delete old reports
|
||||||
|
skip_file: path to file containing symbols and types to skip
|
||||||
"""
|
"""
|
||||||
self.repo_path = "."
|
self.repo_path = "."
|
||||||
self.log = None
|
self.log = None
|
||||||
|
@ -49,6 +50,7 @@ class AbiChecker(object):
|
||||||
self.old_rev = old_rev
|
self.old_rev = old_rev
|
||||||
self.new_repo = new_repo
|
self.new_repo = new_repo
|
||||||
self.new_rev = new_rev
|
self.new_rev = new_rev
|
||||||
|
self.skip_file = skip_file
|
||||||
self.mbedtls_modules = ["libmbedcrypto", "libmbedtls", "libmbedx509"]
|
self.mbedtls_modules = ["libmbedcrypto", "libmbedtls", "libmbedx509"]
|
||||||
self.old_dumps = {}
|
self.old_dumps = {}
|
||||||
self.new_dumps = {}
|
self.new_dumps = {}
|
||||||
|
@ -216,6 +218,9 @@ class AbiChecker(object):
|
||||||
"-strict",
|
"-strict",
|
||||||
"-report-path", output_path
|
"-report-path", output_path
|
||||||
]
|
]
|
||||||
|
if self.skip_file:
|
||||||
|
abi_compliance_command += ["-skip-symbols", self.skip_file,
|
||||||
|
"-skip-types", self.skip_file]
|
||||||
abi_compliance_process = subprocess.Popen(
|
abi_compliance_process = subprocess.Popen(
|
||||||
abi_compliance_command,
|
abi_compliance_command,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
@ -292,6 +297,10 @@ def run_main():
|
||||||
"Can include repository before revision"),
|
"Can include repository before revision"),
|
||||||
required=True, nargs="+"
|
required=True, nargs="+"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-s", "--skip-file", type=str,
|
||||||
|
help="path to file containing symbols and types to skip"
|
||||||
|
)
|
||||||
abi_args = parser.parse_args()
|
abi_args = parser.parse_args()
|
||||||
if len(abi_args.old_rev) == 1:
|
if len(abi_args.old_rev) == 1:
|
||||||
old_repo = None
|
old_repo = None
|
||||||
|
@ -311,7 +320,8 @@ def run_main():
|
||||||
raise Exception("Too many arguments passed for new version")
|
raise Exception("Too many arguments passed for new version")
|
||||||
abi_check = AbiChecker(
|
abi_check = AbiChecker(
|
||||||
abi_args.report_dir, old_repo, old_rev,
|
abi_args.report_dir, old_repo, old_rev,
|
||||||
new_repo, new_rev, abi_args.keep_all_reports
|
new_repo, new_rev, abi_args.keep_all_reports,
|
||||||
|
abi_args.skip_file
|
||||||
)
|
)
|
||||||
return_code = abi_check.check_for_abi_changes()
|
return_code = abi_check.check_for_abi_changes()
|
||||||
sys.exit(return_code)
|
sys.exit(return_code)
|
||||||
|
|
Loading…
Reference in a new issue