libabigail/tests
Dodji Seketeli 059c86ec0b Bug 20476 - Compare virtual member functions when comparing classes
There are cases where a virtual member function doesn't have an
implementation that is defined and publicly exported.  This is the
cases for virtual pure classes.

Even in those cases, users might want to detect vtable changes on
virtual member pure classes (interfaces).

Now that, for C++ binaries, all the partial representations of a class
are merged into one class (in a given binary), we can envision to
compare virtual member functions of classes as part of comparing two
classes.

This is what this patch does.  While comparing two classes, the
virtual member functions are compared too.

Note that as there can be several virtual member functions that have
the same vtable offset (think about a virtual destructor that might
have several generated functions that 'conceptually' share the same
vtable offset), comparing the virtual functions can be a little bit
non-trivial.

The approach taken is to check that in the first set of virtual
functions, each virtual function actually matches at least one virtual
function in the second set.  And the match is a "loose" one.  That is,
it doesn't take into account the symbol name or the mangled name.

The patch also fixes the "less than" operator used to sort virtual
member functions.

There is also a buglet in the way we compute the highest vtable offset
number today.  This patch provides a new function named
class_decl::get_biggest_vtable_offset that is used in the change reports.

The patch also fixes a related bug in where we were forgetting to
report about added and removed virtual member functions without an
associated elf symbol.  This patch fixes that.

	* include/abg-ir.h (class_decl::get_biggest_vtable_offset):
	Declare new member function.
	* src/abg-ir.cc (virtual_member_function_less_than::operator()):
	Either compare the symbol id strings if the functions have
	symbols or just compare their pretty representations.
	(class_decl::get_biggest_vtable_offset): Define new member
	function.
	(methods_equal_modulo_elf_symbol)
	(method_matches_at_least_one_in_vector): New static methods.
	(equals): In the overload for classes, compare the virtual member
	functions while comparing classes.
	* src/abg-comparison.cc (represent): In the overload for
	method_decl_sptr, fix the way we compute the highest vtable offset
	number for a give class_decl.
	(class_decl::ensure_lookup_tables_populated): Don't forget added
	and removed virtual member functions in the report for changed
	classes.
	* tests/data/test-diff-dwarf/libtest41-PR20476-hidden-old.so: New
	test binary input file.
	* tests/data/test-diff-dwarf/libtest41-PR20476-hidden-new.so: Likewise.
	* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt:
	New reference output.
	* tests/data/Makefile.am: Add the new test material above to the
	source distribution.
	* tests/test-diff-dwarf.cc (in_out_spec): Add the new tests
	here.
	* tests/data/test-annotate/test10-pr18818-gcc.so.abi: Adjust.
	* tests/data/test-annotate/test11-pr18828.so.abi: Adjust.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
	* tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Adjust.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Adjust.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Adjust.
2017-02-14 12:49:47 +01:00
..
data Bug 20476 - Compare virtual member functions when comparing classes 2017-02-14 12:49:47 +01:00
Makefile.am Bug 20970 - Add a --annotate option to abidw 2017-01-24 15:41:37 +01:00
mockfedabipkgdiff.in Make fedabipkgdiff consistent with Libabigail's other tests 2016-07-15 19:41:08 +02:00
print-diff-tree.cc Introduce the concept of environment 2015-09-07 23:35:29 +02:00
runtestcanonicalizetypes.sh.in Bug 20180 - Support system-wide suppression specifications 2016-05-30 18:39:49 +02:00
runtestdefaultsupprs.py.in Fix python interpreter path for el6 2016-06-28 09:12:40 +02:00
runtestfedabipkgdiff.py.in Bug 20380 - Compare two local RPMs 2016-12-12 15:21:10 +01:00
test-abicompat.cc Implement a [suppress_file] suppression directive 2016-05-08 12:39:26 +02:00
test-abidiff-exit.cc Bug 20180 - Support system-wide suppression specifications 2016-05-30 18:39:49 +02:00
test-abidiff.cc Update copyright notice for abg-fwd.h, abg-ir.h and test-abidiff.cc 2017-01-16 15:36:20 +01:00
test-alt-dwarf-file.cc Use worker threads pattern to speed up some tests 2016-01-18 18:23:18 +01:00
test-annotate.cc Bug 20970 - Add a --annotate option to abidw 2017-01-24 15:41:37 +01:00
test-core-diff.cc Use worker threads pattern to speed up some tests 2016-01-18 18:23:18 +01:00
test-diff2.cc Update copyright years 2015-01-07 17:52:10 +01:00
test-diff-dwarf-abixml.cc Bug 20180 - Support system-wide suppression specifications 2016-05-30 18:39:49 +02:00
test-diff-dwarf.cc Bug 20476 - Compare virtual member functions when comparing classes 2017-02-14 12:49:47 +01:00
test-diff-filter.cc Bug 18754 - Add the "--no-added-syms" option to abidiff 2017-01-05 13:44:25 +01:00
test-diff-pkg.cc Fix test-diff-pkg after commit 2dcc606 2017-01-20 15:47:16 +01:00
test-diff-suppr.cc Bug 21058 - abipkgdiff wrongly drops non-public types 2017-01-18 10:14:02 +01:00
test-dot.cc Correct DOT merge. 2013-07-23 23:13:55 +02:00
test-ir-walker.cc Introduce the concept of environment 2015-09-07 23:35:29 +02:00
test-lookup-syms.cc Use worker threads pattern to speed up some tests 2016-01-18 18:23:18 +01:00
test-read-dwarf.cc Drop suppressed ABI artifacts from the IR 2016-09-21 18:35:08 +02:00
test-read-write.cc Drop suppressed ABI artifacts from the IR 2016-09-21 18:35:08 +02:00
test-svg.cc Add svg generation. 2013-07-23 23:13:54 +02:00
test-types-stability.cc Bug 19204 - libabigail aborts on DWARF referencing non-existing DIE 2016-01-21 10:48:32 +01:00
test-utils.cc Use worker threads pattern to speed up some tests 2016-01-18 18:23:18 +01:00
test-utils.h Use worker threads pattern to speed up some tests 2016-01-18 18:23:18 +01:00
test-valgrind-suppressions.supp Support running "make check-valgrind" 2016-05-22 23:20:12 +02:00
test-write-read-archive.cc Fix archive writing support 2015-04-24 19:59:19 +02:00
update-test-output.py Rename tests/update-test-read-dwarf-output.py 2016-12-02 12:59:32 +01:00