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.
diff --git a/scripts/abi_check.py b/scripts/abi_check.py
index e45cd9a..14e38fb 100755
--- a/scripts/abi_check.py
+++ b/scripts/abi_check.py
@@ -29,7 +29,7 @@
"""API and ABI checker."""
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.
report_dir: directory for output files
@@ -38,6 +38,7 @@
new_repo: repository for git revision to check
new_rev: git revision to check
keep_all_reports: if false, delete old reports
+ skip_file: path to file containing symbols and types to skip
"""
self.repo_path = "."
self.log = None
@@ -49,6 +50,7 @@
self.old_rev = old_rev
self.new_repo = new_repo
self.new_rev = new_rev
+ self.skip_file = skip_file
self.mbedtls_modules = ["libmbedcrypto", "libmbedtls", "libmbedx509"]
self.old_dumps = {}
self.new_dumps = {}
@@ -216,6 +218,9 @@
"-strict",
"-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_command,
stdout=subprocess.PIPE,
@@ -292,6 +297,10 @@
"Can include repository before revision"),
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()
if len(abi_args.old_rev) == 1:
old_repo = None
@@ -311,7 +320,8 @@
raise Exception("Too many arguments passed for new version")
abi_check = AbiChecker(
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()
sys.exit(return_code)