mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-14 22:14:35 +00:00
697347e402
This function was not aware of --leaf-changes-only mode. - Stats counters for changed variables and types have different names in the different modes. - Net leaf type changes were not included in leaf mode. For some inputs, this resulted in abidiff producing an empty report but returning a non-zero exit status in --leaf-changes-only mode. For other inputs the combination of both issues still resulted in the correct return code. This included the following test-abidiff-exit test cases: - test-leaf-peeling - test-leaf2 - test-no-stray-comma This patch makes corpus_diff::has_net_changes mirror emit_diff_stats, modulo flags like --non-reachable-types which if absent can still result in discrepancies between output and return code. To achieve this in a more maintainable way, the patch introduces a new interface reporter_base::diff_has_net_changes. That interface is implemented by all current reporters. Each reporter focuses on its own particularities to provide the required behavious. Then corpus_diff:has_net_changes just has to invoke reporter_base::diff_has_net_changes on the reporter that is currently in used. The tests below verify that the exit code is zero when all the changes between the test files are suppressed. * include/abg-reporter.h ({reporter_base, default_reporter, leaf_reporter}::diff_has_net_changes): Add new virtual function. This breaks binary compatibility but should conserve source compatibility. * src/abg-default-reporter.cc (default_reporter::diff_has_net_changes): Define new member function. * src/abg-leaf-reporter.cc (leaf_reporter::diff_has_net_changes): Likewise. * src/abg-comparison.cc (corpus_diff::has_net_changes): Invoke reporter_base::diff_has_net_changes on the current reporter, rather than trying to handle all the different kinds of reporters here. (corpus_diff::priv::apply_filters_and_compute_diff_stats): Add a TODO to possibly delegate the implementation of this function to the reporters. * tests/data/Makefile.am: Add new test case files. * tests/data/test-abidiff-exit/test-net-change-report0.txt: Normal mode, nothing suppressed. * tests/data/test-abidiff-exit/test-net-change-report1.txt: Normal mode, everything suppressed. * tests/data/test-abidiff-exit/test-net-change-report2.txt: Leaf mode, nothing suppressed. * tests/data/test-abidiff-exit/test-net-change-report3.txt: Leaf mode, everything suppressions. * tests/data/test-abidiff-exit/test-net-change-v0.c: Test file * tests/data/test-abidiff-exit/test-net-change-v0.o: Test file * tests/data/test-abidiff-exit/test-net-change-v1.c: Test file * tests/data/test-abidiff-exit/test-net-change-v1.o: Test file * tests/data/test-abidiff-exit/test-net-change.abignore: This suppresses changes for all variables, functions and types in the test files, except for the 'victim' function. * tests/test-abidiff-exit.cc: Run new test cases. Reviewed-by: Matthias Maennich <maennich@google.com> Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
data | ||
lib | ||
.gitignore | ||
Makefile.am | ||
mockfedabipkgdiff.in | ||
print-diff-tree.cc | ||
runtestcanonicalizetypes.sh.in | ||
runtestdefaultsupprs.py.in | ||
runtestdefaultsupprspy3.sh.in | ||
runtestfedabipkgdiff.py.in | ||
runtestfedabipkgdiffpy3.sh.in | ||
test-abicompat.cc | ||
test-abidiff-exit.cc | ||
test-abidiff.cc | ||
test-alt-dwarf-file.cc | ||
test-annotate.cc | ||
test-core-diff.cc | ||
test-cxx-compat.cc | ||
test-diff2.cc | ||
test-diff-dwarf-abixml.cc | ||
test-diff-dwarf.cc | ||
test-diff-filter.cc | ||
test-diff-pkg.cc | ||
test-diff-suppr.cc | ||
test-dot.cc | ||
test-elf-helpers.cc | ||
test-ini.cc | ||
test-ir-walker.cc | ||
test-kmi-whitelist.cc | ||
test-lookup-syms.cc | ||
test-read-dwarf.cc | ||
test-read-write.cc | ||
test-svg.cc | ||
test-symtab.cc | ||
test-tools-utils.cc | ||
test-types-stability.cc | ||
test-utils.cc | ||
test-utils.h | ||
test-valgrind-suppressions.supp | ||
test-write-read-archive.cc | ||
update-test-output.py |