Skip to content
Snippets Groups Projects
Commit e6b084e1 authored by Pavel Zhukov's avatar Pavel Zhukov
Browse files

abicheck: Add option to continue on errors


Signed-off-by: default avatarPavel Zhukov <pavel.zhukov@huawei.com>
parent 750713a2
No related branches found
No related tags found
1 merge request!5abicheck: Add option to not exit on errors
......@@ -21,6 +21,8 @@ The ABI check can be activated by appending the `abicheck` bbclass to the bbclas
The tool used for the ABI info serialization is [abidw](https://sourceware.org/libabigail/manual/abidw.html).
By default, the `abicheck` bbclass exits with an error if abidw exited with a non-zero exit code. Set `BINARY_AUDIT_WARN_ONLY` to "1" to warn out and continue instead.
## ABI compatibility
The serialized ABI representation will be integrated into the build history. Saving the build history will allow to compare the current build
......
......@@ -35,17 +35,17 @@ def binary_audit_gather_abixml(d):
kv = d.getVar("KERNEL_VERSION")
artifact_dir = d.getVar("IMG_DIR")
ltree = os.path.join(artifact_dir, "usr", "lib", "modules")
warn = d.getVar("BINARY_AUDIT_WARN_ONLY") == "1"
if kv and os.path.isdir(ltree):
# XXX This vmlinux lookup method is very vague
ptr = os.path.join(d.getVar("WORKDIR"), "..", "..", d.getVar("PREFERRED_PROVIDER_virtual/kernel"), "*", "*", "vmlinux")
vmlinux = glob.glob(ptr)[0]
whitelist = None
out, out_fn = abicheck.serialize_kernel_artifacts(abixml_dir, ltree, vmlinux, whitelist)
out, out_fn = abicheck.serialize_kernel_artifacts(abixml_dir, ltree, vmlinux, whitelist, warn)
with open(out_fn, "w") as f:
f.write(out)
f.close()
else:
for out, out_fn in abicheck.serialize_artifacts(abixml_dir, artifact_dir):
for out, out_fn in abicheck.serialize_artifacts(abixml_dir, artifact_dir, warn):
with open(out_fn, "w") as f:
f.write(out)
f.close()
......
......@@ -42,7 +42,7 @@ def serialize(fn):
return status, out, cmd
def serialize_kernel_artifacts(abixml_dir, tree, vmlinux=None, whitelist=None):
def serialize_kernel_artifacts(abixml_dir, tree, vmlinux=None, whitelist=None, warn=False):
cmd = ["abidw", "--no-corpus-path"]
cmd.extend(["--linux-tree", tree])
if vmlinux:
......@@ -53,6 +53,9 @@ def serialize_kernel_artifacts(abixml_dir, tree, vmlinux=None, whitelist=None):
util.note(" ".join(cmd))
ret, out = _serialize(cmd)
if not 0 == ret:
if warn:
util.error(out if out else "abidw exited with non-zero code and empty output")
return
util.error(out)
return out, None
if not out:
......@@ -86,7 +89,7 @@ def compare(ref, cur, suppr=[]):
return process.returncode, out, cmd
def serialize_artifacts(adir, id):
def serialize_artifacts(adir, id, warn=False):
''' Recursively serialize binary artifacts starting at the given image directory(id), yields serialized output and filename
Parameters:
adir (str): path to abixml directory
......@@ -106,6 +109,9 @@ def serialize_artifacts(adir, id):
ret, out, cmd = serialize(fn)
util.note(" ".join(cmd))
if not 0 == ret:
if warn:
util.warn(out if out else "abidw exited with non-zero code and empty output")
continue
util.error(out)
return
if not out:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment