abixml-reader: Support SONAME related properties on file suppression
authorDodji Seketeli <dodji@redhat.com>
Fri, 21 Feb 2020 11:32:42 +0000 (12:32 +0100)
committerDodji Seketeli <dodji@redhat.com>
Fri, 21 Feb 2020 15:01:26 +0000 (16:01 +0100)
commit6a0e7e120b18c51ce7cc2d273697b7440e1ac99e
tree0a8bd36456b284549c717f164a9b65d7e9cd17fc
parentf5fd6931f63e01e565c02da1d116f508113ebb57
abixml-reader: Support SONAME related properties on file suppression

When comparing binary files (using abidiff for instance) libabigail
can interpret the [suppress_file] section of a suppression
specification.  If the suppression specification matches either of the
compared files, no comparison is performed.

At the moment, that doesn't work when comparing abixml files.

Thus, this patch implements that feature for abixml files.

With this patch, one can now write a suppression specification like
this:

  [suppress_file]
    soname_regexp = <some-regexp>

or

  [suppress_file]
    file_name_regexp = <some-regexp>

If either abixml file has a soname matched by such a regexp, then no
comparison is performed.

* doc/manuals/libabigail-concepts.rst: Update the documentation to
mention soname_regexp and soname_not_regexp is supported in the
[suppress_file] section.
* include/abg-suppression.h (suppression_matches_soname)
(suppression_matches_soname_or_filename): Declare new functions.
Make them be friends of class suppression_base.
* src/abg-reader.cc
(read_context::corpus_is_suppressed_by_soname_or_filename): Define
new member function.
(read_corpus_from_input): Apply file suppression.
* src/abg-suppression.cc (read_file_suppression): Support
"soname_regexp" and "soname_not_regexp" in the [suppress_file]
section.
(suppression_matches_soname)
(suppression_matches_soname_or_filename): Define new functions.
* tests/data/test-diff-suppr/libtest48-soname-abixml-report-{1,2}.txt:
New test reference output files.
Likewise.
* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt:
New test suppression file.
* tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-{2,3,4}.txt::
Likewise.
* tests/data/test-diff-suppr/libtest48-soname-abixml-v{0,1}.so: New
test binary input files.
* tests/data/test-diff-suppr/libtest48-soname-abixml-v{0,1}.so.abi:
New abixml for the binary input files above.
* tests/data/test-diff-suppr/test48-soname-abixml-v{0,1}.c: Source
code of the binary input files above.
* tests/data/Makefile.am: Add the above test material to source
distribution.
* tests/test-diff-suppr.cc (in_out_specs): Add the test input
above to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
18 files changed:
doc/manuals/libabigail-concepts.rst
include/abg-suppression.h
src/abg-reader.cc
src/abg-suppression.cc
tests/data/Makefile.am
tests/data/test-diff-suppr/libtest48-soname-abixml-report-1.txt [new file with mode: 0644]
tests/data/test-diff-suppr/libtest48-soname-abixml-report-2.txt [new file with mode: 0644]
tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-2.txt [new file with mode: 0644]
tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-3.txt [new file with mode: 0644]
tests/data/test-diff-suppr/libtest48-soname-abixml-suppr-4.txt [new file with mode: 0644]
tests/data/test-diff-suppr/libtest48-soname-abixml-suppr.txt [new file with mode: 0644]
tests/data/test-diff-suppr/libtest48-soname-abixml-v0.so [new file with mode: 0755]
tests/data/test-diff-suppr/libtest48-soname-abixml-v0.so.abi [new file with mode: 0644]
tests/data/test-diff-suppr/libtest48-soname-abixml-v1.so [new file with mode: 0755]
tests/data/test-diff-suppr/libtest48-soname-abixml-v1.so.abi [new file with mode: 0644]
tests/data/test-diff-suppr/test48-soname-abixml-v0.c [new file with mode: 0644]
tests/data/test-diff-suppr/test48-soname-abixml-v1.c [new file with mode: 0644]
tests/test-diff-suppr.cc