Bug 24552 - abidiff fails comparing a corpus against a corpus group
authorDodji Seketeli <dodji@redhat.com>
Thu, 16 May 2019 15:23:40 +0000 (17:23 +0200)
committerDodji Seketeli <dodji@redhat.com>
Thu, 16 May 2019 16:10:08 +0000 (18:10 +0200)
commitf754d8111656b2ebb480952035ecd0746d3c2287
tree6185faf4d5f98e5d41ed1cf4b7bf64ba69859b1d
parentf15b1ea634b3b5533bf65fa3b66f60189ac7b572
Bug 24552 - abidiff fails comparing a corpus against a corpus group

In this problem report, the issue is that when comparing two corpus
groups, especially when looking up function/variable symbols, the
get_fun_symbol_map() and get_var_symbol_map() member functions used
are corpus::get_{fun,var}_symbol_map, rather than
corpus_group::get_{fun, var}_symbol_map.  Note that the type
corpus_group inherits from the type corpus.  That leads to unexpected
comparison results, especially for symbols.

This patch fixes this by making the corpus::get_{fun, var}_symbol_map
member function be virtual and by using it during the lookup of
function/variable symbols.  That way, the right symbol map gets used.

* include/abg-corpus.h (corpus{_group}::get_{fun,
var}_symbol_map): Make these member functions virtual.
* src/abg-corpus.cc (corpus::lookup_{function, variable}_symbol):
Use the virtual corpus::get_{fun, var}_symbol_map() member
function to get the symbols of the current corpus or corpus_group.
* tests/data/Makefile.am: Add the new test input material below to
source distribution.
* tests/data/test-abidiff/test-PR24552-report0.txt: New test input.
* tests/data/test-abidiff/test-PR24552-v0.abi: Likewise.
* tests/data/test-abidiff/test-PR24552-v1.abi: Likewise.
* tests/test-abidiff.cc (main): Support comparing corpus groups.
(specs): Add the new test inputs to the harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-corpus.h
src/abg-corpus.cc
tests/data/Makefile.am
tests/data/test-abidiff/test-PR24552-report0.txt [new file with mode: 0644]
tests/data/test-abidiff/test-PR24552-v0.abi [new file with mode: 0644]
tests/data/test-abidiff/test-PR24552-v1.abi [new file with mode: 0644]
tests/test-abidiff.cc