2014-11-20 10:26:30 +00:00
|
|
|
SUBDIRS = data
|
2013-08-27 11:38:10 +00:00
|
|
|
|
2014-12-10 10:11:10 +00:00
|
|
|
ZIP_ARCHIVE_TESTS =
|
2014-11-19 08:17:13 +00:00
|
|
|
if ENABLE_ZIP_ARCHIVE
|
2014-12-10 10:11:10 +00:00
|
|
|
ZIP_ARCHIVE_TESTS += runtestwritereadarchive
|
|
|
|
if ENABLE_CXX11
|
|
|
|
ZIP_ARCHIVE_TESTS += runtestdot
|
|
|
|
endif
|
2014-08-31 08:34:11 +00:00
|
|
|
endif
|
|
|
|
|
2016-07-27 10:18:58 +00:00
|
|
|
AM_CXXFLAGS = $(VISIBILITY_FLAGS)
|
|
|
|
|
2014-12-10 10:11:10 +00:00
|
|
|
CXX11_TESTS =
|
2014-11-05 09:08:33 +00:00
|
|
|
if ENABLE_CXX11
|
2014-12-10 10:11:10 +00:00
|
|
|
CXX11_TESTS += runtestsvg
|
2019-07-05 09:10:37 +00:00
|
|
|
AM_CXXFLAGS += "-std=c++11"
|
2014-11-05 09:08:33 +00:00
|
|
|
endif
|
|
|
|
|
2016-05-16 11:10:59 +00:00
|
|
|
FEDABIPKGDIFF_TEST =
|
2018-03-30 08:38:23 +00:00
|
|
|
if ENABLE_FEDABIPKGDIFF
|
2018-03-25 07:34:59 +00:00
|
|
|
if ENABLE_RUNNING_TESTS_WITH_PY3
|
|
|
|
FEDABIPKGDIFF_TEST += runtestfedabipkgdiffpy3.sh
|
|
|
|
else
|
2016-05-16 11:10:59 +00:00
|
|
|
FEDABIPKGDIFF_TEST += runtestfedabipkgdiff.py
|
|
|
|
endif
|
2018-03-25 07:34:59 +00:00
|
|
|
endif
|
2016-05-16 11:10:59 +00:00
|
|
|
|
2013-10-03 00:05:53 +00:00
|
|
|
TESTS= \
|
2017-03-24 12:09:32 +00:00
|
|
|
$(FEDABIPKGDIFF_TEST) \
|
2015-09-02 13:33:27 +00:00
|
|
|
runtestreaddwarf \
|
2017-01-17 18:41:51 +00:00
|
|
|
runtestannotate \
|
2015-09-02 13:33:27 +00:00
|
|
|
runtestcanonicalizetypes.sh \
|
2016-01-18 12:00:51 +00:00
|
|
|
runtestdiffpkg \
|
2014-03-29 05:44:13 +00:00
|
|
|
runtestdifffilter \
|
2016-01-18 12:00:51 +00:00
|
|
|
$(ZIP_ARCHIVE_TESTS) \
|
Initial support for type suppressions
* include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY):
New enumerator.
(diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY,
VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for
these.
(diff::EVERYTHING_CATEGORY): Adjust.
(suppression_base, type_suppression): Declare new types.
(suppression_ptr, suppressions_type, type_suppression_sptr)
(type_suppressions_type): New typedefs.
(read_type_suppressions, read_suppressions): Declare new
functions.
(diff_context::{suppressions, add_suppression, add_suppressions}):
Declare new methods.
(diff::is_suppressed): Declare new member function.
(apply_suppressions): Declare new function & overloads.
* src/abg-comparison.cc (is_type_diff): Define new static
function.
({suppression_base, type_suppression}::priv): Define new types.
({suppression_base, type_suppression}::*): Define the methods of the new
suppression_base, type_suppressions types.
(read_type_suppression, read_type_suppressions, read_suppressions)
(read_type_suppressions): Define new static functions.
(diff_context::priv::supprssions_): New data member.
(diff_context::{suppressions, add_suppression, add_suppressions}):
New methods.
(diff::is_filtered_out): Consider that a diff node that is in the
SUPPRESSED_CATEGORY is filtered out.
(diff::is_suppressed): Define new member function.
(operator<<(ostream& o, diff_category c)): Support the
SUPPRESSED_CATEGORY category.
(corpus_diff::report): Apply suppressions before reporting
anything.
(category_propagation_visitor::visit_end): Do not propagate
SUPPRESSED_CATEGORY. This is just like what we do for
REDUNDANT_CATEGORY.
(struct suppression_categorization_visitor): New visitor.
(apply_suppressions): Define function & overloads.
* include/abg-ini.h (config::section::find_property): New method.
(config::section): Fix end of class comment.
* src/abg-ini.cc (config::section::find_property): Define new
method.
* tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New
test input files.
* tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code
for new test input.
* tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test
input files.
* tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code
for new test input files.
* tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise
* tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New
test input files.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise.
* tests/test-diff-suppr.cc: New test harness to run type suppression tests
using the input files above.
* tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input.
* tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise.
* tests/Makefile.am: Build the new runtestdiffsuppr test harness
from the test-diff-filter.cc file. Add the new test files to the
build system and source distribution.
* tools/bidiff.cc (options::suppressions): New data member.
(display_usage): Add a help string for the new
--suppressions command line switch.
(parse_command_line): Parse the --suppressions command line
switch.
(set_diff_context_from_opts): Read the suppressions provided by
the --suppression command line switch and stuff them into the diff
context.
2014-09-19 09:55:49 +00:00
|
|
|
runtestdiffsuppr \
|
2016-01-18 12:00:51 +00:00
|
|
|
runtestreadwrite \
|
|
|
|
runtestabidiff \
|
2015-11-09 14:39:17 +00:00
|
|
|
runtestdiffdwarfabixml \
|
Initial implementation of the abicompat tool
Given an application A that links to a shared library L of version V
denoted L(V) and a subsequent version of that library denoted L(V+P),
the 'abicompat' tool tells the user if L(V+P) is still ABI compatible
with L(V+P). And if it is not, abicompat gives a reports that shows
the differences between L(V) and L(V+P) that makes L(V+P)
ABI-incompatible with A.
The source code of this tool is in the tools/abicompat.cc source
file. To support this new tool, this commit changes the comparison
engine to optionally avoid showing added symbols that were not
referenced by any debug info. It changes the ABI corpus type to allow
the specification of a list of variables and functions symbols to keep
(and drop all other functions and variables which have other symbols
on the floor even before starting to compare the two libraries).
This is how the abicompat tool itself works. It basically compares
L(V) and L(V+P) but it only looks at their exported functions and
variables which symbols are undefined in application A. If the list
of exported and defined variables and functions of L(V) whose symbols
are undefined in A equals that of L(V+P) (including the sub-types of
these variables and functions) A is still compatible with L(V+P).
Otherwise, they might not be compatible depending on the kind of
differences that are found.
* include/abg-comparison.h
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Declare new accessors.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols,
apply_filters_and_suppressions_before_reporting}): Declare new
methods.
(corpus_diff::diff_stats): Declare this new type. Actually this
was previously corpus_diff::priv::diff_stats, which was a hidden
internal type.. We are moving it here, in the external API so
that client code can have more information about changes
statistics. Change all the previously publicly accessible data
members into accessor functions.
* src/abg-comparison.cc (class corpus_diff::diff_stats::priv): New
type.
(diff_context::priv::show_added_syms_unreferenced_by_di_): New
data member.
(diff_context::priv::priv): Adjust.
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Define this new method.
(corpus_diff::priv::emit_diff_stats): Do not show the diff stat
if the only changes is added function or variables symbols and if
we were instructed to not show added symbols.
(corpus_diff::priv::{diff_stats_, filters_and_suppr_applied_}):
New data members.
(corpus_diff::priv::priv): Initialize the
filters_and_suppr_applied_ data member.
(corpus_diff::priv::diff_stats): Move this type to
corpus_diff::diff_stats.
(corpus_diff::priv::{apply_filters_and_compute_diff_stats,
emit_diff_stats}): Adjust.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Define new member function.
(corpus_diff::report): Use the new
apply_filters_and_suppressions_before_reporting() function, rather
than applying the filters and suppressions by ourselves. Also
adjust to the use the accessors of the new corpus_diff::diff_stats
type.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols}): Define new accessors.
(corpus_diff::diff_stats::{diff_stats, num_func_removed,
num_func_added, num_func_changed, num_func_filtered_out,
net_num_func_changed, num_vars_removed, num_vars_added,
num_vars_changed, num_vars_filtered_out, net_num_vars_changed,
num_func_sym_removed, num_func_syms_added, num_var_syms_removed,
num_var_syms_added}): Define new member functions.
* include/abg-corpus.h (corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Declare new methods.
* src/abg-corpus.cc (corpus::priv::{sym_id_fns_to_keep,
sym_id_vars_to_keep}): Added data members.
(symtab_build_visitor_type::{unrefed_fun_symbols,
unrefed_var_symbols, sym_id_fns_to_keep, sym_id_vars_to_keep}):
Added new data members.
(symtab_build_visitor_type::symtab_build_visitor_type): Take two
additional parameters for the function and variable symbol ids to
keep.
(symtab_build_visitor_type::add_fn_to_wip_fns): Take the function
symbols to keep in account when building the exported symbol
table.
(symtab_build_visitor_type::add_var_to_wip_vars): Likewise, take
the variable symbols to keep in account when building the exported
symbol table.
(corpus::priv::build_public_decl_table): Adjust the initialization
of the visitor that walks the ABI artifacts to build the exported
symbol table to know take a list of function/variable symbols to
keep.
(corpus::priv::build_unreferenced_symbols_tables): Ensure that the
public table of functions/variables is built before doing the work
of this function. Also, if a list of variable/function symbols to
keep is given, drop all symbols that are not in that list on the
floor.
(corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Define new accessors.
* tools/abicompat.cc: New abicompat tool.
* doc/manuals/abicompat.rst: New documentation source for
abicompat.
* doc/manuals/libabigail-tools.rst: Add an entry for the abicompat
doc.
* tests/test-abicompat.cc: New test harness for the 'abicompat'
tool.
* tests/Makefile.am: Build the runtestabicompat test harness and
add it to the list of tests harnesses that are run by make check.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v0.so: New
test input.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v1.so: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app: Likewise.
* tests/data/test-abicompat/test0-fn-changed-0.suppr: Likewise
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp.h: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v0.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v1.cc: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v1.so: Likewise.
* tests/data/test-abicompat/test2-var-removed-app: Likewise.
* tests/data/test-abicompat/test2-var-removed-app.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test2-var-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-version-script-0 Likewise.:
* tests/data/test-abicompat/test3-fn-removed-version-script-1: Likewise.
* tests/data/Makefile.am: Add the new test inputs above to the
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-30 17:18:55 +00:00
|
|
|
runtestabicompat \
|
Bug 19139 - DWARF reader doesn't handle garbage in function names
In this bug, the DWARF debug info of the binary (generated by Intel's
ICC compiler) has interesting constructs like:
[ 6b5a0] subprogram
decl_line (data2) 787
decl_column (data1) 15
decl_file (data1) 46
declaration (flag)
accessibility (data1) public (1)
type (ref4) [ 6b56a]
prototyped (flag)
name (string) "ldiv"
MIPS_linkage_name (string) "ldiv"
[ 6b5b6] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë2"
[ 6b5bf] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë3"
Note the strings that make up the name of the formal parameters of the
function, near the end:
[ 6b5b6] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë2"
[ 6b5bf] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë3"
The strings "$Ë2" and $Ë3" (which are the names of the
parameters of the function) are garbage.
Libabigail's DWARF reader naively uses those strings as names for the
function parameters, in the type of the function.
Then, the abixml writer emits an XML document, with these strings as
property values, representing the name of the type of the function.
And of course, the XML later chokes when it tries to read that XML
document, saying that the property is not valid UTF-8.
This patch addresses the issue by dropping those garbage names on the
floor, for function type names. In that context, any string that is
not made of ASCII characters is considered as being garbage, for now.
The patch, in the abixml writer, also escapes function parameters
names so that they don't contain characters that are not allowed in
XML. The abixml reader already handles the un-escaping of the names
it reads, so I think there is nothing to do there.
Ultimately, I guess I should get the unicode value of the characters
of that string, encode the string into UTF-8 and use the result as the
name for the parameter. That would mean using UTF-8 strings for
function parameter names, and, for all declarations names. But that
is too much for worfk too little gain for now. The great majority of
the binaries we are dealing with are still using ASCII for declaration
names.
The patch also introduces a new test harness that runs "abidw
--abidiff" on a bunch of input binaries. This harness runs over the
binaries that were submitted in this bug report.
* include/abg-tools-utils.h (string_is_ascii): Declare new
function ...
* src/abg-tools-utils.cc (string_is_ascii): ... and define it.
* src/abg-writer.cc (write_function_type): Escape forbidden XML
characters in function type names.
* src/abg-dwarf-reader.cc (build_function_type): If a parameter
name is not ascii, drop it on the floor.
* tests/data/test-types-stability/pr19139-DomainNeighborMapInst.o:
New test input binary.
* tests/data/test-types-stability/pr19202-libmpi_gpfs.so.5.0:
Likewise.
* tests/data/Makefile.am: Add the new binaries above to the build
system.
* tests/test-types-stability.cc: New test harness.
* tests/Makefile.am: Add the new test harness to the build system.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-05 15:01:56 +00:00
|
|
|
runtesttypesstability \
|
2016-01-18 12:00:51 +00:00
|
|
|
runtestdiffdwarf \
|
|
|
|
runtestlookupsyms \
|
|
|
|
runtestaltdwarf \
|
|
|
|
runtestcorediff \
|
2016-02-10 20:31:53 +00:00
|
|
|
runtestabidiffexit \
|
2018-08-30 08:54:33 +00:00
|
|
|
runtestini \
|
Fully account for anonymous-ness of scopes when comparing decl names
When comparing internal decl names (as part of decl comparison), we
need to take into account the fact that a given decl might be
anonymous and that it might have anonymous scopes in its tree of
containing scopes.
For instance, "__anonymous_struct__1::foo" and
"__anonymous_struct__2::foo" are considered equivalent.
So are "__anonymous_struct__1::foo::__anonymous_struct__2::bar" and
"__anonymous_struct__10::foo::__anonymous_struct__11::bar".
But "__anonymous_struct__1::bar::__anonymous_struct__2::baz" and
"__anonymous_struct__10::foo::__anonymous_struct__11::bar" are not.
This patch introduces the function tools_utils::decl_names_equal that
compares fully qualified names by taking into account anonymous
component names.
That function is thus used in the equals() function overload for
decl_base types. Because tools_utils::decl_names_equal compares strings the
usual way (character by character) it's slower than comparing
instances of interned_string in a O(1) time. So the patch carefully
tries to use tools_utils::decl_names_equal sparringly; that is, it
uses it only when we are looking at decls that have some anonymous
scope. That way, we use the fast interned_string comparison most of
the time. By doing this, we barely see any performance degradation
while running abidw --noout on a full blown vmlinux binary.
* include/abg-ir.h (decl_base::{get_has_anonymous_parent,
set_has_anonymous_parent,
get_is_anonymous_or_has_anonymous_parent}): Declare new member
functions.
* src/abg-ir.cc (decl_base::priv::has_anonymous_parent_): Define
new data member.
(decl_base::priv): Initialize the new data member.
(decl_base::{get_has_anonymous_parent, set_has_anonymous_parent,
get_is_anonymous_or_has_anonymous_parent}): Define new member
functions.
(equals): In the overload for decl_base, use the new
decl_names_equal for decls that have anonymous scopes.
(scope_decl::add_member_decl): Propagate the
decl_base::has_anonymous_parent_ property.
* include/abg-tools-utils.h
(get_anonymous_struct_internal_name_prefix)
(get_anonymous_union_internal_name_prefix)
(get_anonymous_enum_internal_name_prefix, decl_names_equal):
Declare new functions.
* src/abg-comp-filter.cc (has_harmless_name_change): Handle the
case where the name change is actually from an anonymous name to
another one, using the new decl_names_equal function.
* src/abg-dwarf-reader.cc
(get_internal_anonymous_die_prefix_name): Renamed
get_internal_anonynous_die_base_name into this. Use the new
get_anonymous_{struct, union, enum}_internal_name_prefix functions
here.
(get_internal_anonymous_die_name, die_qualified_type_name)
(build_enum_type, add_or_update_class_type)
(add_or_update_union_type): Adjust.
* src/abg-tools-utils.cc (get_anonymous_struct_internal_name_prefix)
(get_anonymous_union_internal_name_prefix)
(get_anonymous_enum_internal_name_prefix, decl_names_equal):
Define new functions.
* tests/test-tools-utils.cc: New test file.
* tests/Makefile.am: Add new runtesttoolsutils test, built from
test-tools-utils.cc.
* tests/data/test-diff-dwarf/test46-rust-report-0.txt: Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-06-20 16:04:43 +00:00
|
|
|
runtesttoolsutils \
|
2017-03-24 12:09:32 +00:00
|
|
|
$(CXX11_TESTS)
|
2016-05-16 11:10:59 +00:00
|
|
|
|
2018-03-25 07:34:59 +00:00
|
|
|
if ENABLE_RUNNING_TESTS_WITH_PY3
|
|
|
|
TESTS += runtestdefaultsupprspy3.sh
|
2018-07-10 12:08:19 +00:00
|
|
|
else
|
|
|
|
TESTS += runtestdefaultsupprs.py
|
2018-03-25 07:34:59 +00:00
|
|
|
endif
|
2014-08-31 08:34:11 +00:00
|
|
|
|
2016-05-21 00:09:50 +00:00
|
|
|
EXTRA_DIST = \
|
|
|
|
runtestcanonicalizetypes.sh.in \
|
|
|
|
runtestfedabipkgdiff.py.in \
|
Make fedabipkgdiff consistent with Libabigail's other tests
In the libabigail project, almost all the tests for the tools follow a
similar pattern. The test contains a set of input files to compare.
The result of the comparison is thus compared to a set of reference
comparison result.
This approach is already documented in the CONTRIBUTING file.
There are several interesting properties with this scheme. First, it
capture the behaviour of the tools, including what is shown to the
user.
Second, it eases the job of a hacker who wants to add a new test for a
new behaviour of a given tool. The user just has to provide:
1/ A new reference output of the new use case of the tool (that is easily
constructed by using the tool itself and saving its output) and add an
entry to array of entries that describe what to compare
2/ A new set of inputs to the tool
And voila.
Unfortunately, fedabipkgdiff tests don't follow this scheme. That
make them surprising to hackers who read the source code of the
existing tests, at very least. Also, the fedabipkgdiff tests were
only unit tests. They were not testing the tool as used by users in
general.
This patch makes the fedabipkgdiff tests follow the general approach
of the tests of the other Libabigail tools.
The patch first craetes a program names tests/mockfedabipkgdiff. It's
a wrapper around tools/fedabipkgdiff. It overloads the Koji client of
fedabipkgdiff with a fake Koji client that gets the Fedora packages
locally, from tests/data/test-fedabipkgdiff/packages. In other words,
mockfedabipkgdiff is fedabipkgdiff without going to the network.
I believe that in the future, tests/mockfedabipkgdiff should be killed
when fedabipkgdiff is able to cache a local description of a local
partial view of a Koji repository, along with the build packages that
were already downloaded.
That way, calling fedabipkgdiff twice with the same set of option
should make the tool perform correctly without going to the netword on
the second invocation. We should be able to save the local partial
view of the Koji repository under e.g,
tests/data/test-fedabipkgdiff/local-koji and tell fedabipkgdiff to use
that, instead of using the network. But we are not there yet. So for
now, I am using mockfedabipkgdiff.
Then, tests/runtestfedabipkdiff.py.in has been re-written to use
tests/mockfedabipkgdiff and to look like what is described in
CONTRIBUTING as far as how Libabigail tools' tests are organized:
mockfedabipkgdiff is called to perform a comparison. The result of
the comparison is then compared (using GNU diff) to a reference
comparison result file.
Please note that tests/runtestfedabipkdiff.py is relatively fast for
the moment. But when it contains much more tests and start becoming
slow, then we'll need to change the code to run several comparisons in
parallel, just like we do today in tests/test-diff-filter.cc. At that
point, I believe I'll just re-write this in C++, just like
tests/test-diff-filter.cc because that will allow us to have true
concurrent code based on the abigail:workers API. For now, I am
keeping this in Python also because I think that keeps Chenxiong happy
;-)
To be sure that fedabipkgdiff (and its underlying abipkgdiff) are
really comparing all the packages they are supposed to compare and
also all the binaries in those packages, I have added a new
--show-identical-binaries to abipkgdiff and fedabipkgdiff. That
option shows the name of the binaries (and packages) that are
compared, *even if* the ABI of those binaries are identical. Because
otherwise, today, if two binaries (or packages) have the same ABI,
nothing is displayed.
For instance, here is the result of comparing a package against
itself, using this new --show-identical-binaries options:
dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ./build/tools/abipkgdiff --show-identical-binaries dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm
Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm:
================ changes of 'dbus-binding-tool'===============
No ABI change detected
================ end of changes of 'dbus-binding-tool'===============
================ changes of 'libdbus-glib-1.so.2.1.0'===============
No ABI change detected
================ end of changes of 'libdbus-glib-1.so.2.1.0'===============
dodji@adjoa:patches$
And here is what this command before that patch would do:
dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ../master/build/tools/abipkgdiff dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm
Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm:
dodji@adjoa:patches$
The rest of the patch is mostly new test inputs material and the
necessary adjustments following all the changes above.
* configure.ac: Do not require Python dependencies itertools,
unittest and StringIO anymore as they are not used anymore.
Require new module tempfile now. Generate new executable script
tests/mockfedabipkgdiff from tests/mockfedabipkgdiff.in.
* doc/manuals/abipkgdiff.rst: Add doc for new option
--show-identical-binaries to abipkgdiff
* doc/manuals/fedabipkgdiff.rst: Add doc for new options
--show-identical-binaries to fedabipkgdiff.
* tools/abipkgdiff.cc (options::show_identical_binaries): New data
member.
(options::options): Initialize new data member.
(display_usage): Add a new help string for the new
--show-identical-binaries option.
(parse_command_line): Parse the newq --show-identical-binaries
command line switch.
(pthread_routine_compare): When the comparison of two binaries is
empty, if --show-identical-binaries was provided, then emit some
output saying the comparison did yield the empty set.
* tools/fedabipkgdiff (DEFAULT_ABIPKGDIFF): Store the default path
to abipkgdiff in this new global variable. Naming this default
path is useful because it can then be cleanly overloaded when
using mock.patch.
(build_path_to_abipkgdiff): Return the new DEFAULT_ABIPKGDIFF
global variable.
(cmd): Parse the new --show-identical-binaries command line
switch.
* tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt:
New reference output.
* tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt:
Likewise.
* tests/mockfedabipkgdiff.in: New uninstalled script template.
* tests/runtestfedabipkgdiff.py.in (counter)
(temp_file_or_dir_prefix, UtilsTest, RPMTest, LocalRPMTest)
(RunAbipkgdiffTest, GetPackageLatestBuildTest, DownloadRPMTest)
(BrewListRPMsTest, AssertionHelper, MockGlobalConfig)
(BUILT_ABIPKGDIFF, CompareABIFromCommandLineTest): Remove these
classes, global variables and functions.
(FEDABIPKGDIFF, TEST_SRC_DIR, TEST_BUILD_DIR, INPUT_DIR)
(OUTPUT_DIR, FEDABIPKGDIFF_TEST_SPECS): New global variables.
(ensure_output_dir_created, run_fedabipkgdiff_tests, main): New
functions.
* tests/test-diff-pkg.cc (in_out_specs): Add
tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt
to the set of reference outputs to consider.
* tests/Makefile.am: Add non-installed script mockfedabipkgdiff to
source distribution. Also added
tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt,
tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt,
tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt,
tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt
and
tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt
to source distribution.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-06 09:51:13 +00:00
|
|
|
mockfedabipkgdiff.in \
|
2016-05-21 00:09:50 +00:00
|
|
|
test-valgrind-suppressions.supp
|
|
|
|
|
2018-03-25 07:34:59 +00:00
|
|
|
if ENABLE_RUNNING_TESTS_WITH_PY3
|
|
|
|
EXTRA_DIST += \
|
|
|
|
runtestfedabipkgdiffpy3.sh.in \
|
|
|
|
runtestdefaultsupprspy3.sh.in
|
|
|
|
endif
|
|
|
|
|
Canonicalize types either early or late after TU reading
While trying to diff two identical files (abidiff foo.so foo.so) it
appeared that canonicalizing types during e.g, the DWARF reading
process was leading to subtle errors because it's extremely hard to
know when a type is complete. That is, during the building of a class
type C, a pointer to C can be built before C is complete. Worse, even
after reading the DIE (from DWARF) of class C, there can be DIE seen
later in the translation unit that modifies type C. In these late
cases, one needs to wait -- not only until C is fully built, but also
sometimes, after the translation unit is fully built -- to
canonicalize C and then the pointer to C. This kind of things.
So now there are two possible points in time when canonicalization of
a type can happen. It can happen early, when the type is built. This
is the case for basic types and composite types for which all
sub-types are canonicalized already. It can happen late, right after
we've finished reading the debug info for the current translation
unit.
So this patch fixes the IR traversal and uses that to walk the
translation unit (or even types) after it's built. It does away with
the first attempt to perform early canonicalizing only.
The patch also handles type canonicalizing while reading xml-abi
format.
* include/abg-fwd.h (is_class_type)
(type_has_non_canonicalized_subtype): Declare new functions.
(is_member_type): Remove the overload that takes a decl_base_sptr.
It's superfluous. We just need the one that takes a
type_base_sptr.
* include/abg-ir.h (translation_unit::{is_constructed,
set_is_constructed}): Add new methods.
(class_decl::has_virtual_member_functions): Likewise.
(class decl_base): Makes it virtually inherit ir_traversable_base.
(class type_base): Make this virtually inherit traversable_base
too.
(type_base::canonicalize): Renamed enable_canonical_equality
into this.
(type_base::traverse): Declare new virtual method.
(canonicalize): Renamed enable_canonical_equality into this.
(scope_type_decl::traverse): Declare new virtual method.
(namespace_decl::get_pretty_representation): Declare new virtual
method.
(function_type::traverse): Likewise.
(class_decl::base_spec::traverse): Likewise.
(ir_node_visitor::visit): Remove the overloads and replace each of
them with a pair of ...
(ir_node_visitor::{visit_begin, visit_end}): ... of these.
* include/abg-traverse.h (traversable_base::visiting): New
method.
(traversable_base::visiting_): New data member.
(traversable_base::traversable_base): New constructor.
* src/abg-ir.cc ({scope_decl, type_decl, namespace_decl,
qualified_type_def, pointer_type_def, reference_type_def,
array_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, function_decl::parameter, class_decl,
class_decl::member_function_template,
class_decl::member_class_template, function_tdecl,
class_tdecl}::traverse): Fix this to properly set the
traversable_base::visiting_ flag and to reflect the new signatures
of the ir_node_visitor methods.
({type_base, scope_type_decl, function_type,
class_decl::base_spec}::traverse): New method.
(type_base::get_canonical_type_for): Handle the case of the type
already having a canonical type. Properly hash the type using the
dynamic type hasher. Look through declaration-only classes to
consider the definition of the class instead. Fix logic to have a
single pointer of return, to ease debugging.
(canonicalize): Renamed enable_canonical_equality into this.
(namespace_decl::get_pretty_representation): Define new method.
(ir_node_visitor::visit): Replace each of these overloads with a
pair of visit_begin/visit_end ones.
(translation_unit::priv::is_constructed_): New data member.
(translation_unit::priv::priv): Initialize it.
(translation_unit::{is_constructed, set_is_constructed}): Define
new methods.
(is_member_type(const decl_base_sptr)): Remove.
(is_class_type(decl_base *d)): Define new function.
(class_decl::has_virtual_member_functions): Define new method.
(equals(const class_decl&, const class_decl&, change_kind*)): If
the containing translation unit is not constructed yet, do not
take virtual member functions in account when comparing the
classes. This is because when reading from DWARF, there can be
DIEs that change the number of virtual member functions after the
DIE of the class. So one needs to start taking virtual members
into account only after the translation unit has been constructed.
(class non_canonicalized_subtype_detector): Define new type.
(type_has_non_canonicalized_subtype): Define new function.
* src/abg-corpus.cc (symtab_build_visitor_type::visit): Renamed
this into symtab_build_visitor_type::visit_end.
* src/abg-dwarf-reader.cc (die_type_map_type): New typedef.
(die_class_map_type): This is now a typedef on a map of
Dwarf_Off/class_decl_sptr.
(read_context::{die_type_map_, alternate_die_type_map_,
types_to_canonicalize_, alt_types_to_canonicalize_}): New data
members.
(read_context::{associate_die_to_decl,
associate_die_to_decl_primary}): Make these methods public.
(read_context::{associate_die_to_type,
lookup_type_from_die_offset, is_wip_class_die_offset,
types_to_canonicalize, schedule_type_for_canonicalization}):
Define new methods.
(build_type_decl, build_enum_type)
(build_class_type_and_add_to_ir, build_qualified_type)
(build_pointer_type_def, build_reference_type, build_array_type)
(build_typedef_type, build_function_decl): Do not canonicalize
types here.
(maybe_canonicalize_type): Define new function.
(build_ir_node_from_die): Take a new flag that says if the ir node
is a member type/function or not. Early-canonicalize base types.
Canonicalize composite types that have only canonicalized
sub-types. Schedule the other types for late canonicalizing. For
class types, early canonicalize those that are non-member types,
that are fully constructed and that have only canonicalized
sub-types. Adjust to the new signature of build_ir_node_from_die.
(get_scope_for_die, build_namespace_decl_and_add_to_ir)
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_array_type, build_typedef_type)
(build_var_decl, build_function_decl): Adjust for the new
signature of build_ir_node_from_die.
(build_translation_unit_and_add_to_ir): Likewise. Perform the
late canonicalizing of the types that have been scheduled for
that.
(build_class_type_and_add_to_ir): Return a class_decl_sptr, not a
decl_base_sptr. Adjust for the new signature of
build_ir_node_from_die. Early canonicalize member types that are
created and added to a given class, or schedule them for late
canonicalizing.
* src/abg-reader.cc (class read_context::{m_wip_classes_map,
m_types_to_canonicalize}): New data members.
(read_context::{clear_types_to_canonicalize,
clear_wip_classes_map, mark_class_as_wip, unmark_class_as_wip,
is_wip_class, maybe_canonicalize_type,
schedule_type_for_late_canonicalizing,
perform_late_type_canonicalizing}): Add new method definitions.
(read_context::clear_per_translation_unit_data): Call
read_context::clear_types_to_canonicalize().
(read_translation_unit_from_input): Call
read_context::perform_late_type_canonicalizing() at the end of the
function.
(build_function_decl): Fix the function type canonicalizing (per
translation) that was already in place. Do the canonicalizing of
these only when the type is fully built. Oops. This was really
brokend. Also, when the function type is constructed, consider it
for type canonicalizing.
(build_type_decl): Early canonicalize basic types.
(build_qualified_type_decl, build_pointer_type_def)
(build_pointer_type_def, build_reference_type_def)
(build_array_type_def, build_enum_type_decl, build_typedef_decl):
Handle the canonicalizing for these composite types: either early
or late.
(build_class_decl): Likewise. Also, mark this class a 'being
built' until it's fully built. This helps the canonicalizing code
to know that it should leave a class alone until it's fully built.
* tests/test-ir-walker.cc (struct name_printing_visitor): Adjust
to the visitor methods naming change.
* configure.ac: Generate the tests/runtestcanonicalizetypes.sh
testing script from tests/runtestcanonicalizetypes.sh.in.
* tests/runtestcanonicalizetypes.sh.in: Add the template for the
new runtestcanonicalizetypes.sh script that test for type
canonicalizing.
* tests/Makefile.am: Add the new runtestcanonicalizetypes.sh
regression testing script to the build system.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-02-13 19:20:57 +00:00
|
|
|
CLEANFILES = \
|
2016-05-21 01:02:19 +00:00
|
|
|
runtestcanonicalizetypes.output.txt \
|
|
|
|
runtestcanonicalizetypes.output.final.txt
|
2013-03-21 22:42:41 +00:00
|
|
|
|
Implement generic diff tree walking and port categorization over it
* include/abg-comp-filter.h (apply_filter): Declare new overload
that takes a corpus_diff_sptr ...
* src/abg-comp-filter.cc (apply_filter): ... and define it. On
the existing overload for diff_sptr, make sure to traverse all
diff nodes, even those that have already been traversed.
* include/abg-comparison.h (enum diff_category): Remove
NOT_REDUNDANT_CATEGORY, add REDUNDANT_CATEGORY.
(operator&=, +operator<<): Declare new operators for enum diff_category.
(diff_context::{forbid_traversing_a_node_twice,
traversing_a_node_twice_is_forbidden):
(diff_context::categorizing_redundancy): Remove this declaration.
(diff_context::maybe_apply_filters): Declare a new overload that
takes a corpus_diff_sptr. And a take a new flag that says if it
should visit all nodes including those that have already been
visited.
(diff::priv_): Make this data member protected.
(diff::{begin_traversing, is_traversing, end_traversing,
finish_diff_type, children_nodes, append_child_node,
get_pretty_representation, chain_into_hierarchy, traverse}):
Declare new member functions.
(distinct_diff::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Likewise.
(distinct_diff::traverse): Remove.
(pointer_diff::pointer_diff): Take the underlying type diff in
parameter.
(pointer_diff::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
(pointer_diff::traverse): Remove.
(reference_type_def::reference_type_def): Take the underlying type
diff in parameter.
({array_type_def, reference_type_def}::{finish_diff_type,
get_pretty_representation, chain_into_hierarchy}): Declare new
member functions.
({array_type_diff, reference_type_def}::traverse): Remove.
(qualified_type_diff::qualified_type_diff): Take the underlying
type diff in parameter.
({enum_diff, qualified_type_diff, class_diff}::{finish_diff_type,
get_pretty_representation, chain_into_hierarchy}): Declare new
member functions.
({enum_diff, qualified_type_diff, class_diff}::traverse): Remove.
(is_class_diff): Declare new function.
(base_diff::base_diff): Take the underlying type diff in
parameter.
({scope_diff, base_diff}::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
({scope_diff, base_diff}::traverse): Remove.
(function_decl_diff::function_decl_diff): Take the return type
diff as parameter.
({function_decl_diff, type_decl_diff}::{finish_diff_type,
get_pretty_representation, chain_into_hierarchy}): Declare new
member functions.
({function_decl_diff, type_decl_diff}::traverse): Remove.
(typedef_diff::typedef_diff): Take the underlying type diff as
parameter.
(typedef::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
({typedef, translation_unit_diff}::traverse): Remove member
function.
(corpus_diff::{finish_diff_type, children_nodes,
append_child_node, changed_variables, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
(class diff_node_visitor::{visit_begin, visit_end}): Declare new
member functions.
(propagate_categories, print_diff_tree, categorizing_redundancy)
(clear_redundancy_categorization, apply_filters): New functions
and function overloads.
* src/abg-comparison.cc (TRY_PRE_VISIT, TRY_PRE_VISIT_CLASS_DIFF)
(TRY_POST_VISIT, TRY_POST_VISIT_CLASS_DIFF)
(CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE)
(UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE)
(TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(ENSURE_DIFF_NODE_TRAVERSED_ONCE)
(ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): Remove these macros.
Hurrah.
(diff_context::priv::categorizing_redundancy_): Remove.
(diff_context::priv::forbid_traversing_a_node_twice_): Add new
data member.
(diff_context::priv::priv): Adjust.
(diff_context::{forbid_traversing_a_node_twice,
traversing_a_node_twice_is_forbidden}): Define new member
functions.
(diff_context::maybe_apply_filters): Once filters are applied (and
categories are set to the relevant diff tree nodes, run a pass
over the diff tree to propagate the categories to the relevant
diff tree parent nodes. Add an overload for corpus_diff_sptr.
(diff_context::categorizing_redundancy): Remove member function.
(diff_context::maybe_apply_filters): Define a new overload for
corpus_diff_sptr
(struct diff::priv::{finished_, traversing_, children_,
pretty_representation_}): New data members.
(diff::priv::priv): Adjust.
(diff::{begin_traversing, is_traversing, end_traversing,
finish_diff_type, children_nodes, append_child_node, traverse,
set_category, get_pretty_representation, chain_into_hierarchy}):
Define new member functions.
(diff::is_filtered_out): Do not refer to NOT_REDUNDANT_CATEGORY
anymore. Rather, use the new REDUNDANT_CATEGORY.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, type_decl_diff,
typedef_diff}::{get_pretty_representation, chain_into_hierarchy,
finish_diff_type}): Define new member functions.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, type_decl_diff,
typedef_diff, translation_unit_diff}::traverse): Remove member
functions.
(operator&=, operator<<): Define new operators for diff_category.
({function_decl_diff, typedef_diff}::priv::priv): Add a new
constructor.
(pointer_diff::{priv::priv, pointer_diff})
(reference_diff::{priv::priv, reference_diff})
(qualified_type_diff::{priv::priv, qualified_type_diff})
(enum_diff::{priv::priv, enum_diff}, base_diff::{priv::priv,
base_diff}, function_decl_diff::function_decl_diff): Take the
underlying type diff in parameter.
(compute_diff): Adjust the pointer_diff, reference_diff,
qualified_type_diff, base_diff, function_decl_diff overloads.
(class_diff::priv::{count_filtered_bases,
count_filtered_subtype_changed_dm, count_filtered_changed_dm,
count_filtered_changed_mem_fns, count_filtered_inserted_mem_fns,
count_filtered_deleted_mem_fns}): Adjust for the call to
diff_context::maybe_apply_filters.
(corpus_diff::priv::{finished_, pretty_representation_}): New data
member.
(corpus_diff::priv::priv): New constructor.
(corpus_diff::priv::clear_redundancy_categorization): Define new
member function.
(corpus_diff::priv::apply_filters_and_compute_diff_stats):
Adjust for call to diff_context::maybe_apply_filters. Also, call
clear_redundancy_categorization at the end.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes):
Revisit logic.
(corpus_diff::{chain_into_hierarchy, finish_diff_type,
children_nodes, append_child_node, changed_variables,
get_pretty_representation}): Define new member functions.
(corpus_diff::report): Categorize redundancy for every top level
function/variable diff.
(corpus_diff::traverse): Adjust to the new traversing interface.
(diff_node_visitor::{visit_begin, visit_end}): Define new member
functions.
(struct category_propagation_visitor, struct diff_node_printer)
(struct redundancy_marking_visitor, struct
redundancy_clearing_visitor): New diff tree node visitors.
(propagate_categories, print_diff_tree, categorize_redundancy)
(clear_redundancy_categorization, apply_filters): Define new
functions.
* tests/Makefile.am: Add the new tests/print-diff-tree.cc to the
source distribution. Build it into a tests/printdifftree binary.
* tools/abidiff.cc (print_diff_tree): Add debugging functions to
call from within the debugger. By default, this function and its
overloads are not compiled.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-10 11:15:40 +00:00
|
|
|
noinst_PROGRAMS= $(TESTS) testirwalker testdiff2 printdifftree
|
Make fedabipkgdiff consistent with Libabigail's other tests
In the libabigail project, almost all the tests for the tools follow a
similar pattern. The test contains a set of input files to compare.
The result of the comparison is thus compared to a set of reference
comparison result.
This approach is already documented in the CONTRIBUTING file.
There are several interesting properties with this scheme. First, it
capture the behaviour of the tools, including what is shown to the
user.
Second, it eases the job of a hacker who wants to add a new test for a
new behaviour of a given tool. The user just has to provide:
1/ A new reference output of the new use case of the tool (that is easily
constructed by using the tool itself and saving its output) and add an
entry to array of entries that describe what to compare
2/ A new set of inputs to the tool
And voila.
Unfortunately, fedabipkgdiff tests don't follow this scheme. That
make them surprising to hackers who read the source code of the
existing tests, at very least. Also, the fedabipkgdiff tests were
only unit tests. They were not testing the tool as used by users in
general.
This patch makes the fedabipkgdiff tests follow the general approach
of the tests of the other Libabigail tools.
The patch first craetes a program names tests/mockfedabipkgdiff. It's
a wrapper around tools/fedabipkgdiff. It overloads the Koji client of
fedabipkgdiff with a fake Koji client that gets the Fedora packages
locally, from tests/data/test-fedabipkgdiff/packages. In other words,
mockfedabipkgdiff is fedabipkgdiff without going to the network.
I believe that in the future, tests/mockfedabipkgdiff should be killed
when fedabipkgdiff is able to cache a local description of a local
partial view of a Koji repository, along with the build packages that
were already downloaded.
That way, calling fedabipkgdiff twice with the same set of option
should make the tool perform correctly without going to the netword on
the second invocation. We should be able to save the local partial
view of the Koji repository under e.g,
tests/data/test-fedabipkgdiff/local-koji and tell fedabipkgdiff to use
that, instead of using the network. But we are not there yet. So for
now, I am using mockfedabipkgdiff.
Then, tests/runtestfedabipkdiff.py.in has been re-written to use
tests/mockfedabipkgdiff and to look like what is described in
CONTRIBUTING as far as how Libabigail tools' tests are organized:
mockfedabipkgdiff is called to perform a comparison. The result of
the comparison is then compared (using GNU diff) to a reference
comparison result file.
Please note that tests/runtestfedabipkdiff.py is relatively fast for
the moment. But when it contains much more tests and start becoming
slow, then we'll need to change the code to run several comparisons in
parallel, just like we do today in tests/test-diff-filter.cc. At that
point, I believe I'll just re-write this in C++, just like
tests/test-diff-filter.cc because that will allow us to have true
concurrent code based on the abigail:workers API. For now, I am
keeping this in Python also because I think that keeps Chenxiong happy
;-)
To be sure that fedabipkgdiff (and its underlying abipkgdiff) are
really comparing all the packages they are supposed to compare and
also all the binaries in those packages, I have added a new
--show-identical-binaries to abipkgdiff and fedabipkgdiff. That
option shows the name of the binaries (and packages) that are
compared, *even if* the ABI of those binaries are identical. Because
otherwise, today, if two binaries (or packages) have the same ABI,
nothing is displayed.
For instance, here is the result of comparing a package against
itself, using this new --show-identical-binaries options:
dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ./build/tools/abipkgdiff --show-identical-binaries dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm
Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm:
================ changes of 'dbus-binding-tool'===============
No ABI change detected
================ end of changes of 'dbus-binding-tool'===============
================ changes of 'libdbus-glib-1.so.2.1.0'===============
No ABI change detected
================ end of changes of 'libdbus-glib-1.so.2.1.0'===============
dodji@adjoa:patches$
And here is what this command before that patch would do:
dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ../master/build/tools/abipkgdiff dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm
Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm:
dodji@adjoa:patches$
The rest of the patch is mostly new test inputs material and the
necessary adjustments following all the changes above.
* configure.ac: Do not require Python dependencies itertools,
unittest and StringIO anymore as they are not used anymore.
Require new module tempfile now. Generate new executable script
tests/mockfedabipkgdiff from tests/mockfedabipkgdiff.in.
* doc/manuals/abipkgdiff.rst: Add doc for new option
--show-identical-binaries to abipkgdiff
* doc/manuals/fedabipkgdiff.rst: Add doc for new options
--show-identical-binaries to fedabipkgdiff.
* tools/abipkgdiff.cc (options::show_identical_binaries): New data
member.
(options::options): Initialize new data member.
(display_usage): Add a new help string for the new
--show-identical-binaries option.
(parse_command_line): Parse the newq --show-identical-binaries
command line switch.
(pthread_routine_compare): When the comparison of two binaries is
empty, if --show-identical-binaries was provided, then emit some
output saying the comparison did yield the empty set.
* tools/fedabipkgdiff (DEFAULT_ABIPKGDIFF): Store the default path
to abipkgdiff in this new global variable. Naming this default
path is useful because it can then be cleanly overloaded when
using mock.patch.
(build_path_to_abipkgdiff): Return the new DEFAULT_ABIPKGDIFF
global variable.
(cmd): Parse the new --show-identical-binaries command line
switch.
* tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt:
New reference output.
* tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt:
Likewise.
* tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt:
Likewise.
* tests/mockfedabipkgdiff.in: New uninstalled script template.
* tests/runtestfedabipkgdiff.py.in (counter)
(temp_file_or_dir_prefix, UtilsTest, RPMTest, LocalRPMTest)
(RunAbipkgdiffTest, GetPackageLatestBuildTest, DownloadRPMTest)
(BrewListRPMsTest, AssertionHelper, MockGlobalConfig)
(BUILT_ABIPKGDIFF, CompareABIFromCommandLineTest): Remove these
classes, global variables and functions.
(FEDABIPKGDIFF, TEST_SRC_DIR, TEST_BUILD_DIR, INPUT_DIR)
(OUTPUT_DIR, FEDABIPKGDIFF_TEST_SPECS): New global variables.
(ensure_output_dir_created, run_fedabipkgdiff_tests, main): New
functions.
* tests/test-diff-pkg.cc (in_out_specs): Add
tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt
to the set of reference outputs to consider.
* tests/Makefile.am: Add non-installed script mockfedabipkgdiff to
source distribution. Also added
tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt,
tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt,
tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt,
tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt
and
tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt
to source distribution.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-06 09:51:13 +00:00
|
|
|
noinst_SCRIPTS = mockfedabipkgdiff
|
2013-03-21 22:42:41 +00:00
|
|
|
noinst_LTLIBRARIES = libtestutils.la
|
|
|
|
|
2013-08-27 13:18:59 +00:00
|
|
|
libtestutils_la_SOURCES= \
|
|
|
|
test-utils.h \
|
2013-05-03 13:28:10 +00:00
|
|
|
test-utils.cc
|
2013-03-21 22:42:41 +00:00
|
|
|
|
|
|
|
libtestutils_la_CXXFLAGS= \
|
2013-08-29 15:08:47 +00:00
|
|
|
-DABIGAIL_SRC_DIR=\"${abs_top_srcdir}\" \
|
|
|
|
-DABIGAIL_BUILD_DIR=\"${abs_top_builddir}\"
|
2013-03-21 22:42:41 +00:00
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestreadwrite_SOURCES=test-read-write.cc
|
2013-10-03 00:05:53 +00:00
|
|
|
runtestreadwrite_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
2013-03-21 22:42:41 +00:00
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestwritereadarchive_SOURCES=test-write-read-archive.cc
|
2015-01-13 10:02:10 +00:00
|
|
|
runtestwritereadarchive_LDADD= libtestutils.la $(top_builddir)/src/libabigail.la
|
2013-08-27 13:18:59 +00:00
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestreaddwarf_SOURCES=test-read-dwarf.cc
|
2014-01-07 14:34:42 +00:00
|
|
|
runtestreaddwarf_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
2015-10-06 12:35:14 +00:00
|
|
|
runtestreaddwarf_LDFLAGS=-pthread
|
2014-01-07 14:34:42 +00:00
|
|
|
|
2017-01-17 18:41:51 +00:00
|
|
|
runtestannotate_SOURCES=test-annotate.cc
|
|
|
|
runtestannotate_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestlookupsyms_SOURCES=test-lookup-syms.cc
|
2014-04-21 15:43:15 +00:00
|
|
|
runtestlookupsyms_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
Support alternate debug info sections
ABGBZ#17193
* include/abg-dwarf-reader.h (class read_context)
(typedef read_context_sptr, create_read_context)
(has_alt_debug_info): Declare these.
(read_corpus_from_elf): Declare new overload.
* src/abg-dwarf-reader.cc (find_alt_debug_info)
(is_die_attribute_resolved_through_gnu_ref_alt)
(build_primary_die_parent_relations_under)
(build_alternate_die_parent_relations_under):
Define new static functions.
(read_context::{alt_dwarf_,
alt_debug_info_path_, alternate_die_decl_map_,
alternate_die_parent_map_}): New data members.
(read_context::{alt_dwarf, alt_debug_info_path,
alternate_die_decl_map, associate_die_to_decl_primary,
associate_die_to_decl_alternate, associate_die_to_decl,
lookup_decl_from_die_offset_primary,
lookup_decl_from_die_offset_alternate,
lookup_decl_from_die_offset, alternate_die_parent_map}): New
member functions.
(read_context::load_debug_info): Painfully Get a handle on the
alternate debug info section too. We shouldn't have to do all
this work; we could use the new dwarf_getalt() function from
libdw, but we cannot as we want to support supports that predate
that api. When a version of elfutils gets released with that api
though, we should conditionally use that instead.
(build_ir_node_from_die, get_parent_die, get_scope_for_die)
(build_namespace_decl_and_add_to_ir)
(build_class_type_and_add_to_ir, build_qualified_type)
(build_pointer_type_def, build_reference_type, build_typedef_type)
(build_var_decl, build_function_decl): Take a new parameter that
tells if the input DIE is from alternate debug info. Adjust their
code accordingly.
(die_die_attribute): Take a new output parameter that tells if the
resolved DIE is from alternate debug info. Also take a new
parameter that tells if the input DIE is from alternate debug info
sections.
(build_die_parent_relations_under): Take the DIE -> parent map to
act upon. Also, add a new overload that takes a flag saying if
the DIE is from alternate debug info or not, and act upon that.
(build_die_parent_maps): Renamed build_die_parent_map into this
and make it build DIE -> parent DIE relationship for the alternate
debug info file as well.
(find_last_import_unit_point_before_die, ): Adjust to use the
information about if the relevant DIEs are in alternate debug info
or not.
(build_translation_unit_and_add_to_ir): Clear the alternate DIE ->
decl map, that is per TU just as the primary DIE -> decl map.
Adjust to use the information about if the relevant DIEs are in
alternate debug info or not.
(read_debug_info_into_corpus): Build the two DIE -> DIE parent
maps (one for the primary debug info and one for the alternate
debug info).
(create_read_context, has_alt_debug_info): Define new public entry
points.
(read_corpus_from_elf): New entry point overload that takes a
read_context.
* tools/bidw.cc (options::{check_alt_debug_info_path,
show_base_name_alt_debug_info_path}): New data members.
(display_usage): Update for the two new options
--check-alternate-debug-info and
check-alternate-debug-info-base-name.
(parse_command_line): Parse the two options above.
(main) Handle the two new options above.
* tests/Makefile.am: Build the new runtestaltdwarf test. Add the
new data/test-alt-dwarf-file/* files to the build system.
* tests/test-alt-dwarf-file.cc: New test driver.
* tests/data/test-alt-dwarf-file/test0-common.cc: New test input
files.
* tests/data/test-alt-dwarf-file/libtest0-common.so: Likewise.
* tests/data/test-alt-dwarf-file/test0.cc: Likewise.
* tests/data/test-alt-dwarf-file/libtest0.so: Likewise.
* tests/data/test-alt-dwarf-file/test0.h: Likewise.
* tests/data/test-alt-dwarf-file/test0-common-dwz.debug: Likewise.
* tests/data/test-alt-dwarf-file/test0-debug-dir/.build-id/16/7088580c513b439c9ed95fe6a8b29496495f26.debug:
Likewise.
* tests/data/test-alt-dwarf-file/test0-debug-dir/test0-common-dwz.debug:
Likewise.
* tests/data/test-read-dwarf/test1.abi: Adjust. bidw doesn't emit
an abstract constructor/destructor anymore. It emits just the
functions matching the cdtor symbols found in the binary.
* tests/data/test-read-dwarf/test2.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-08-15 16:11:49 +00:00
|
|
|
runtestaltdwarf_SOURCES=test-alt-dwarf-file.cc
|
|
|
|
runtestaltdwarf_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestcorediff_SOURCES=test-core-diff.cc
|
2013-10-03 00:05:53 +00:00
|
|
|
runtestcorediff_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2014-09-26 08:58:16 +00:00
|
|
|
runtestabidiff_SOURCES = test-abidiff.cc
|
|
|
|
runtestabidiff_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
2013-11-29 12:49:50 +00:00
|
|
|
|
2016-02-10 20:31:53 +00:00
|
|
|
runtestabidiffexit_SOURCES = test-abidiff-exit.cc
|
|
|
|
runtestabidiffexit_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestdiffdwarf_SOURCES = test-diff-dwarf.cc
|
2014-03-21 14:15:02 +00:00
|
|
|
runtestdiffdwarf_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestdifffilter_SOURCES = test-diff-filter.cc
|
2014-03-29 05:44:13 +00:00
|
|
|
runtestdifffilter_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
Initial support for type suppressions
* include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY):
New enumerator.
(diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY,
VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for
these.
(diff::EVERYTHING_CATEGORY): Adjust.
(suppression_base, type_suppression): Declare new types.
(suppression_ptr, suppressions_type, type_suppression_sptr)
(type_suppressions_type): New typedefs.
(read_type_suppressions, read_suppressions): Declare new
functions.
(diff_context::{suppressions, add_suppression, add_suppressions}):
Declare new methods.
(diff::is_suppressed): Declare new member function.
(apply_suppressions): Declare new function & overloads.
* src/abg-comparison.cc (is_type_diff): Define new static
function.
({suppression_base, type_suppression}::priv): Define new types.
({suppression_base, type_suppression}::*): Define the methods of the new
suppression_base, type_suppressions types.
(read_type_suppression, read_type_suppressions, read_suppressions)
(read_type_suppressions): Define new static functions.
(diff_context::priv::supprssions_): New data member.
(diff_context::{suppressions, add_suppression, add_suppressions}):
New methods.
(diff::is_filtered_out): Consider that a diff node that is in the
SUPPRESSED_CATEGORY is filtered out.
(diff::is_suppressed): Define new member function.
(operator<<(ostream& o, diff_category c)): Support the
SUPPRESSED_CATEGORY category.
(corpus_diff::report): Apply suppressions before reporting
anything.
(category_propagation_visitor::visit_end): Do not propagate
SUPPRESSED_CATEGORY. This is just like what we do for
REDUNDANT_CATEGORY.
(struct suppression_categorization_visitor): New visitor.
(apply_suppressions): Define function & overloads.
* include/abg-ini.h (config::section::find_property): New method.
(config::section): Fix end of class comment.
* src/abg-ini.cc (config::section::find_property): Define new
method.
* tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New
test input files.
* tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt:
Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise.
* tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code
for new test input.
* tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test
input files.
* tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code
for new test input files.
* tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise
* tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New
test input files.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise.
* tests/test-diff-suppr.cc: New test harness to run type suppression tests
using the input files above.
* tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input.
* tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise.
* tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise.
* tests/Makefile.am: Build the new runtestdiffsuppr test harness
from the test-diff-filter.cc file. Add the new test files to the
build system and source distribution.
* tools/bidiff.cc (options::suppressions): New data member.
(display_usage): Add a help string for the new
--suppressions command line switch.
(parse_command_line): Parse the --suppressions command line
switch.
(set_diff_context_from_opts): Read the suppressions provided by
the --suppression command line switch and stuff them into the diff
context.
2014-09-19 09:55:49 +00:00
|
|
|
runtestdiffsuppr_SOURCES = test-diff-suppr.cc
|
|
|
|
runtestdiffsuppr_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2015-11-09 14:39:17 +00:00
|
|
|
runtestdiffdwarfabixml_SOURCES = test-diff-dwarf-abixml.cc
|
|
|
|
runtestdiffdwarfabixml_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
Initial implementation of the abicompat tool
Given an application A that links to a shared library L of version V
denoted L(V) and a subsequent version of that library denoted L(V+P),
the 'abicompat' tool tells the user if L(V+P) is still ABI compatible
with L(V+P). And if it is not, abicompat gives a reports that shows
the differences between L(V) and L(V+P) that makes L(V+P)
ABI-incompatible with A.
The source code of this tool is in the tools/abicompat.cc source
file. To support this new tool, this commit changes the comparison
engine to optionally avoid showing added symbols that were not
referenced by any debug info. It changes the ABI corpus type to allow
the specification of a list of variables and functions symbols to keep
(and drop all other functions and variables which have other symbols
on the floor even before starting to compare the two libraries).
This is how the abicompat tool itself works. It basically compares
L(V) and L(V+P) but it only looks at their exported functions and
variables which symbols are undefined in application A. If the list
of exported and defined variables and functions of L(V) whose symbols
are undefined in A equals that of L(V+P) (including the sub-types of
these variables and functions) A is still compatible with L(V+P).
Otherwise, they might not be compatible depending on the kind of
differences that are found.
* include/abg-comparison.h
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Declare new accessors.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols,
apply_filters_and_suppressions_before_reporting}): Declare new
methods.
(corpus_diff::diff_stats): Declare this new type. Actually this
was previously corpus_diff::priv::diff_stats, which was a hidden
internal type.. We are moving it here, in the external API so
that client code can have more information about changes
statistics. Change all the previously publicly accessible data
members into accessor functions.
* src/abg-comparison.cc (class corpus_diff::diff_stats::priv): New
type.
(diff_context::priv::show_added_syms_unreferenced_by_di_): New
data member.
(diff_context::priv::priv): Adjust.
(diff_context::show_added_symbols_unreferenced_by_debug_info):
Define this new method.
(corpus_diff::priv::emit_diff_stats): Do not show the diff stat
if the only changes is added function or variables symbols and if
we were instructed to not show added symbols.
(corpus_diff::priv::{diff_stats_, filters_and_suppr_applied_}):
New data members.
(corpus_diff::priv::priv): Initialize the
filters_and_suppr_applied_ data member.
(corpus_diff::priv::diff_stats): Move this type to
corpus_diff::diff_stats.
(corpus_diff::priv::{apply_filters_and_compute_diff_stats,
emit_diff_stats}): Adjust.
(corpus_diff::apply_filters_and_suppressions_before_reporting):
Define new member function.
(corpus_diff::report): Use the new
apply_filters_and_suppressions_before_reporting() function, rather
than applying the filters and suppressions by ourselves. Also
adjust to the use the accessors of the new corpus_diff::diff_stats
type.
(corpus_diff::{deleted_variables,
deleted_unrefed_function_symbols,
deleted_unrefed_variable_symbols}): Define new accessors.
(corpus_diff::diff_stats::{diff_stats, num_func_removed,
num_func_added, num_func_changed, num_func_filtered_out,
net_num_func_changed, num_vars_removed, num_vars_added,
num_vars_changed, num_vars_filtered_out, net_num_vars_changed,
num_func_sym_removed, num_func_syms_added, num_var_syms_removed,
num_var_syms_added}): Define new member functions.
* include/abg-corpus.h (corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Declare new methods.
* src/abg-corpus.cc (corpus::priv::{sym_id_fns_to_keep,
sym_id_vars_to_keep}): Added data members.
(symtab_build_visitor_type::{unrefed_fun_symbols,
unrefed_var_symbols, sym_id_fns_to_keep, sym_id_vars_to_keep}):
Added new data members.
(symtab_build_visitor_type::symtab_build_visitor_type): Take two
additional parameters for the function and variable symbol ids to
keep.
(symtab_build_visitor_type::add_fn_to_wip_fns): Take the function
symbols to keep in account when building the exported symbol
table.
(symtab_build_visitor_type::add_var_to_wip_vars): Likewise, take
the variable symbols to keep in account when building the exported
symbol table.
(corpus::priv::build_public_decl_table): Adjust the initialization
of the visitor that walks the ABI artifacts to build the exported
symbol table to know take a list of function/variable symbols to
keep.
(corpus::priv::build_unreferenced_symbols_tables): Ensure that the
public table of functions/variables is built before doing the work
of this function. Also, if a list of variable/function symbols to
keep is given, drop all symbols that are not in that list on the
floor.
(corpus::{get_sym_ids_of_fns_to_keep,
get_sym_ids_of_vars_to_keep}): Define new accessors.
* tools/abicompat.cc: New abicompat tool.
* doc/manuals/abicompat.rst: New documentation source for
abicompat.
* doc/manuals/libabigail-tools.rst: Add an entry for the abicompat
doc.
* tests/test-abicompat.cc: New test harness for the 'abicompat'
tool.
* tests/Makefile.am: Build the runtestabicompat test harness and
add it to the list of tests harnesses that are run by make check.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v0.so: New
test input.
* tests/data/test-abicompat/libtest0-fn-changed-libapp-v1.so: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app: Likewise.
* tests/data/test-abicompat/test0-fn-changed-0.suppr: Likewise
* tests/data/test-abicompat/test0-fn-changed-report-0.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-report-1.txt: Likewise.
* tests/data/test-abicompat/test0-fn-changed-app.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp.h: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v0.cc: Likewise.
* tests/data/test-abicompat/test0-fn-changed-libapp-v1.cc: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest1-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app: Likewise.
* tests/data/test-abicompat/test1-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test1-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest2-var-removed-v1.so: Likewise.
* tests/data/test-abicompat/test2-var-removed-app: Likewise.
* tests/data/test-abicompat/test2-var-removed-app.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test2-var-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test2-var-removed-v1.cc: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v0.so: Likewise.
* tests/data/test-abicompat/libtest3-fn-removed-v1.so: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app: Likewise.
* tests/data/test-abicompat/test3-fn-removed-app.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-report-0.txt: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v0.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-v1.cc: Likewise.
* tests/data/test-abicompat/test3-fn-removed-version-script-0 Likewise.:
* tests/data/test-abicompat/test3-fn-removed-version-script-1: Likewise.
* tests/data/Makefile.am: Add the new test inputs above to the
source distribution.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-30 17:18:55 +00:00
|
|
|
runtestabicompat_SOURCES = test-abicompat.cc
|
|
|
|
runtestabicompat_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2015-07-16 09:05:04 +00:00
|
|
|
runtestdiffpkg_SOURCES = test-diff-pkg.cc
|
|
|
|
runtestdiffpkg_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
Bug 19139 - DWARF reader doesn't handle garbage in function names
In this bug, the DWARF debug info of the binary (generated by Intel's
ICC compiler) has interesting constructs like:
[ 6b5a0] subprogram
decl_line (data2) 787
decl_column (data1) 15
decl_file (data1) 46
declaration (flag)
accessibility (data1) public (1)
type (ref4) [ 6b56a]
prototyped (flag)
name (string) "ldiv"
MIPS_linkage_name (string) "ldiv"
[ 6b5b6] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë2"
[ 6b5bf] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë3"
Note the strings that make up the name of the formal parameters of the
function, near the end:
[ 6b5b6] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë2"
[ 6b5bf] formal_parameter
type (ref4) [ 5f2aa]
name (string) "$Ë3"
The strings "$Ë2" and $Ë3" (which are the names of the
parameters of the function) are garbage.
Libabigail's DWARF reader naively uses those strings as names for the
function parameters, in the type of the function.
Then, the abixml writer emits an XML document, with these strings as
property values, representing the name of the type of the function.
And of course, the XML later chokes when it tries to read that XML
document, saying that the property is not valid UTF-8.
This patch addresses the issue by dropping those garbage names on the
floor, for function type names. In that context, any string that is
not made of ASCII characters is considered as being garbage, for now.
The patch, in the abixml writer, also escapes function parameters
names so that they don't contain characters that are not allowed in
XML. The abixml reader already handles the un-escaping of the names
it reads, so I think there is nothing to do there.
Ultimately, I guess I should get the unicode value of the characters
of that string, encode the string into UTF-8 and use the result as the
name for the parameter. That would mean using UTF-8 strings for
function parameter names, and, for all declarations names. But that
is too much for worfk too little gain for now. The great majority of
the binaries we are dealing with are still using ASCII for declaration
names.
The patch also introduces a new test harness that runs "abidw
--abidiff" on a bunch of input binaries. This harness runs over the
binaries that were submitted in this bug report.
* include/abg-tools-utils.h (string_is_ascii): Declare new
function ...
* src/abg-tools-utils.cc (string_is_ascii): ... and define it.
* src/abg-writer.cc (write_function_type): Escape forbidden XML
characters in function type names.
* src/abg-dwarf-reader.cc (build_function_type): If a parameter
name is not ascii, drop it on the floor.
* tests/data/test-types-stability/pr19139-DomainNeighborMapInst.o:
New test input binary.
* tests/data/test-types-stability/pr19202-libmpi_gpfs.so.5.0:
Likewise.
* tests/data/Makefile.am: Add the new binaries above to the build
system.
* tests/test-types-stability.cc: New test harness.
* tests/Makefile.am: Add the new test harness to the build system.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-11-05 15:01:56 +00:00
|
|
|
runtesttypesstability_SOURCES = test-types-stability.cc
|
|
|
|
runtesttypesstability_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2018-08-30 08:54:33 +00:00
|
|
|
runtestini_SOURCES = test-ini.cc
|
|
|
|
runtestini_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
Fully account for anonymous-ness of scopes when comparing decl names
When comparing internal decl names (as part of decl comparison), we
need to take into account the fact that a given decl might be
anonymous and that it might have anonymous scopes in its tree of
containing scopes.
For instance, "__anonymous_struct__1::foo" and
"__anonymous_struct__2::foo" are considered equivalent.
So are "__anonymous_struct__1::foo::__anonymous_struct__2::bar" and
"__anonymous_struct__10::foo::__anonymous_struct__11::bar".
But "__anonymous_struct__1::bar::__anonymous_struct__2::baz" and
"__anonymous_struct__10::foo::__anonymous_struct__11::bar" are not.
This patch introduces the function tools_utils::decl_names_equal that
compares fully qualified names by taking into account anonymous
component names.
That function is thus used in the equals() function overload for
decl_base types. Because tools_utils::decl_names_equal compares strings the
usual way (character by character) it's slower than comparing
instances of interned_string in a O(1) time. So the patch carefully
tries to use tools_utils::decl_names_equal sparringly; that is, it
uses it only when we are looking at decls that have some anonymous
scope. That way, we use the fast interned_string comparison most of
the time. By doing this, we barely see any performance degradation
while running abidw --noout on a full blown vmlinux binary.
* include/abg-ir.h (decl_base::{get_has_anonymous_parent,
set_has_anonymous_parent,
get_is_anonymous_or_has_anonymous_parent}): Declare new member
functions.
* src/abg-ir.cc (decl_base::priv::has_anonymous_parent_): Define
new data member.
(decl_base::priv): Initialize the new data member.
(decl_base::{get_has_anonymous_parent, set_has_anonymous_parent,
get_is_anonymous_or_has_anonymous_parent}): Define new member
functions.
(equals): In the overload for decl_base, use the new
decl_names_equal for decls that have anonymous scopes.
(scope_decl::add_member_decl): Propagate the
decl_base::has_anonymous_parent_ property.
* include/abg-tools-utils.h
(get_anonymous_struct_internal_name_prefix)
(get_anonymous_union_internal_name_prefix)
(get_anonymous_enum_internal_name_prefix, decl_names_equal):
Declare new functions.
* src/abg-comp-filter.cc (has_harmless_name_change): Handle the
case where the name change is actually from an anonymous name to
another one, using the new decl_names_equal function.
* src/abg-dwarf-reader.cc
(get_internal_anonymous_die_prefix_name): Renamed
get_internal_anonynous_die_base_name into this. Use the new
get_anonymous_{struct, union, enum}_internal_name_prefix functions
here.
(get_internal_anonymous_die_name, die_qualified_type_name)
(build_enum_type, add_or_update_class_type)
(add_or_update_union_type): Adjust.
* src/abg-tools-utils.cc (get_anonymous_struct_internal_name_prefix)
(get_anonymous_union_internal_name_prefix)
(get_anonymous_enum_internal_name_prefix, decl_names_equal):
Define new functions.
* tests/test-tools-utils.cc: New test file.
* tests/Makefile.am: Add new runtesttoolsutils test, built from
test-tools-utils.cc.
* tests/data/test-diff-dwarf/test46-rust-report-0.txt: Adjust.
* tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt:
Likewise.
* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-06-20 16:04:43 +00:00
|
|
|
runtesttoolsutils_SOURCES = test-tools-utils.cc
|
|
|
|
runtesttoolsutils_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
|
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
runtestsvg_SOURCES=test-svg.cc
|
2013-05-28 08:22:08 +00:00
|
|
|
runtestsvg_LDADD=$(top_builddir)/src/libabigail.la
|
|
|
|
|
2014-11-19 09:23:41 +00:00
|
|
|
runtestdot_SOURCES = test-dot.cc
|
|
|
|
runtestdot_LDADD = $(top_builddir)/src/libabigail.la
|
2013-07-02 01:08:18 +00:00
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
testirwalker_SOURCES=test-ir-walker.cc
|
2014-03-21 08:32:14 +00:00
|
|
|
testirwalker_LDADD=$(top_builddir)/src/libabigail.la
|
Implement a translation unit traversal API
* include/libabigail/abg-ir.h (struct ir_node_visitor, struct
traversable): New interfaces.
(translation_unit, scope_decl, type_decl, qualified_type_def)
(pointer_type_def, reference_type_def, enum_type_decl)
(typedef_decl, var_decl, function_decl, data_member)
(member_function, member_function_template)
(member_class_template): Implement the traversable interface,
overload the traversable::traverse pure virtual function.
* src/abg-ir.cc ({translation_unit, scope_decl, type_decl,
namespace_decl, qualified_type_def, pointer_type_def,
reference_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, class_decl::member_function, class_decl,
class_decl::data_member, class_decl::member_function_template,
class_decl::member_class_template, function_template_decl,
class_template_decl, }::traverse): Implement traversal.
(ir_node_visitor::visit): New method, overloaded for the types
above, which implement the traversable interface.
* tests/test-walker.cc: New test case program to showcase how to
use the new traversal API.
* tests/makefile.am: Add test-walker.cc to the build system.
2013-07-20 10:30:04 +00:00
|
|
|
|
2014-06-23 12:23:04 +00:00
|
|
|
testdiff2_SOURCES=test-diff2.cc
|
2013-10-02 21:52:58 +00:00
|
|
|
testdiff2_LDADD=$(top_builddir)/src/libabigail.la
|
|
|
|
|
Implement generic diff tree walking and port categorization over it
* include/abg-comp-filter.h (apply_filter): Declare new overload
that takes a corpus_diff_sptr ...
* src/abg-comp-filter.cc (apply_filter): ... and define it. On
the existing overload for diff_sptr, make sure to traverse all
diff nodes, even those that have already been traversed.
* include/abg-comparison.h (enum diff_category): Remove
NOT_REDUNDANT_CATEGORY, add REDUNDANT_CATEGORY.
(operator&=, +operator<<): Declare new operators for enum diff_category.
(diff_context::{forbid_traversing_a_node_twice,
traversing_a_node_twice_is_forbidden):
(diff_context::categorizing_redundancy): Remove this declaration.
(diff_context::maybe_apply_filters): Declare a new overload that
takes a corpus_diff_sptr. And a take a new flag that says if it
should visit all nodes including those that have already been
visited.
(diff::priv_): Make this data member protected.
(diff::{begin_traversing, is_traversing, end_traversing,
finish_diff_type, children_nodes, append_child_node,
get_pretty_representation, chain_into_hierarchy, traverse}):
Declare new member functions.
(distinct_diff::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Likewise.
(distinct_diff::traverse): Remove.
(pointer_diff::pointer_diff): Take the underlying type diff in
parameter.
(pointer_diff::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
(pointer_diff::traverse): Remove.
(reference_type_def::reference_type_def): Take the underlying type
diff in parameter.
({array_type_def, reference_type_def}::{finish_diff_type,
get_pretty_representation, chain_into_hierarchy}): Declare new
member functions.
({array_type_diff, reference_type_def}::traverse): Remove.
(qualified_type_diff::qualified_type_diff): Take the underlying
type diff in parameter.
({enum_diff, qualified_type_diff, class_diff}::{finish_diff_type,
get_pretty_representation, chain_into_hierarchy}): Declare new
member functions.
({enum_diff, qualified_type_diff, class_diff}::traverse): Remove.
(is_class_diff): Declare new function.
(base_diff::base_diff): Take the underlying type diff in
parameter.
({scope_diff, base_diff}::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
({scope_diff, base_diff}::traverse): Remove.
(function_decl_diff::function_decl_diff): Take the return type
diff as parameter.
({function_decl_diff, type_decl_diff}::{finish_diff_type,
get_pretty_representation, chain_into_hierarchy}): Declare new
member functions.
({function_decl_diff, type_decl_diff}::traverse): Remove.
(typedef_diff::typedef_diff): Take the underlying type diff as
parameter.
(typedef::{finish_diff_type, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
({typedef, translation_unit_diff}::traverse): Remove member
function.
(corpus_diff::{finish_diff_type, children_nodes,
append_child_node, changed_variables, get_pretty_representation,
chain_into_hierarchy}): Declare new member functions.
(class diff_node_visitor::{visit_begin, visit_end}): Declare new
member functions.
(propagate_categories, print_diff_tree, categorizing_redundancy)
(clear_redundancy_categorization, apply_filters): New functions
and function overloads.
* src/abg-comparison.cc (TRY_PRE_VISIT, TRY_PRE_VISIT_CLASS_DIFF)
(TRY_POST_VISIT, TRY_POST_VISIT_CLASS_DIFF)
(CATEGORIZE_REDUNDANCY_FROM_CHILD_NODE)
(UPDATE_REDUNDANCY_CATEGORIZATION_FROM_NODE_SUBTREE)
(TRAVERSE_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(TRAVERSE_MEM_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(TRAVERSE_MEM_FN_DIFF_NODE_AND_PROPAGATE_CATEGORY)
(ENSURE_DIFF_NODE_TRAVERSED_ONCE)
(ENSURE_MEM_DIFF_NODE_TRAVERSED_ONCE): Remove these macros.
Hurrah.
(diff_context::priv::categorizing_redundancy_): Remove.
(diff_context::priv::forbid_traversing_a_node_twice_): Add new
data member.
(diff_context::priv::priv): Adjust.
(diff_context::{forbid_traversing_a_node_twice,
traversing_a_node_twice_is_forbidden}): Define new member
functions.
(diff_context::maybe_apply_filters): Once filters are applied (and
categories are set to the relevant diff tree nodes, run a pass
over the diff tree to propagate the categories to the relevant
diff tree parent nodes. Add an overload for corpus_diff_sptr.
(diff_context::categorizing_redundancy): Remove member function.
(diff_context::maybe_apply_filters): Define a new overload for
corpus_diff_sptr
(struct diff::priv::{finished_, traversing_, children_,
pretty_representation_}): New data members.
(diff::priv::priv): Adjust.
(diff::{begin_traversing, is_traversing, end_traversing,
finish_diff_type, children_nodes, append_child_node, traverse,
set_category, get_pretty_representation, chain_into_hierarchy}):
Define new member functions.
(diff::is_filtered_out): Do not refer to NOT_REDUNDANT_CATEGORY
anymore. Rather, use the new REDUNDANT_CATEGORY.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, type_decl_diff,
typedef_diff}::{get_pretty_representation, chain_into_hierarchy,
finish_diff_type}): Define new member functions.
({distinct_diff, var_diff, pointer_diff, array_diff,
reference_diff, qualified_type_diff, enum_diff, class_diff,
base_diff, scope_diff, function_decl_diff, type_decl_diff,
typedef_diff, translation_unit_diff}::traverse): Remove member
functions.
(operator&=, operator<<): Define new operators for diff_category.
({function_decl_diff, typedef_diff}::priv::priv): Add a new
constructor.
(pointer_diff::{priv::priv, pointer_diff})
(reference_diff::{priv::priv, reference_diff})
(qualified_type_diff::{priv::priv, qualified_type_diff})
(enum_diff::{priv::priv, enum_diff}, base_diff::{priv::priv,
base_diff}, function_decl_diff::function_decl_diff): Take the
underlying type diff in parameter.
(compute_diff): Adjust the pointer_diff, reference_diff,
qualified_type_diff, base_diff, function_decl_diff overloads.
(class_diff::priv::{count_filtered_bases,
count_filtered_subtype_changed_dm, count_filtered_changed_dm,
count_filtered_changed_mem_fns, count_filtered_inserted_mem_fns,
count_filtered_deleted_mem_fns}): Adjust for the call to
diff_context::maybe_apply_filters.
(corpus_diff::priv::{finished_, pretty_representation_}): New data
member.
(corpus_diff::priv::priv): New constructor.
(corpus_diff::priv::clear_redundancy_categorization): Define new
member function.
(corpus_diff::priv::apply_filters_and_compute_diff_stats):
Adjust for call to diff_context::maybe_apply_filters. Also, call
clear_redundancy_categorization at the end.
(corpus_diff::priv::categorize_redundant_changed_sub_nodes):
Revisit logic.
(corpus_diff::{chain_into_hierarchy, finish_diff_type,
children_nodes, append_child_node, changed_variables,
get_pretty_representation}): Define new member functions.
(corpus_diff::report): Categorize redundancy for every top level
function/variable diff.
(corpus_diff::traverse): Adjust to the new traversing interface.
(diff_node_visitor::{visit_begin, visit_end}): Define new member
functions.
(struct category_propagation_visitor, struct diff_node_printer)
(struct redundancy_marking_visitor, struct
redundancy_clearing_visitor): New diff tree node visitors.
(propagate_categories, print_diff_tree, categorize_redundancy)
(clear_redundancy_categorization, apply_filters): Define new
functions.
* tests/Makefile.am: Add the new tests/print-diff-tree.cc to the
source distribution. Build it into a tests/printdifftree binary.
* tools/abidiff.cc (print_diff_tree): Add debugging functions to
call from within the debugger. By default, this function and its
overloads are not compiled.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-10-10 11:15:40 +00:00
|
|
|
printdifftree_SOURCES = print-diff-tree.cc
|
|
|
|
printdifftree_LDADD = $(top_builddir)/src/libabigail.la
|
|
|
|
|
Canonicalize types either early or late after TU reading
While trying to diff two identical files (abidiff foo.so foo.so) it
appeared that canonicalizing types during e.g, the DWARF reading
process was leading to subtle errors because it's extremely hard to
know when a type is complete. That is, during the building of a class
type C, a pointer to C can be built before C is complete. Worse, even
after reading the DIE (from DWARF) of class C, there can be DIE seen
later in the translation unit that modifies type C. In these late
cases, one needs to wait -- not only until C is fully built, but also
sometimes, after the translation unit is fully built -- to
canonicalize C and then the pointer to C. This kind of things.
So now there are two possible points in time when canonicalization of
a type can happen. It can happen early, when the type is built. This
is the case for basic types and composite types for which all
sub-types are canonicalized already. It can happen late, right after
we've finished reading the debug info for the current translation
unit.
So this patch fixes the IR traversal and uses that to walk the
translation unit (or even types) after it's built. It does away with
the first attempt to perform early canonicalizing only.
The patch also handles type canonicalizing while reading xml-abi
format.
* include/abg-fwd.h (is_class_type)
(type_has_non_canonicalized_subtype): Declare new functions.
(is_member_type): Remove the overload that takes a decl_base_sptr.
It's superfluous. We just need the one that takes a
type_base_sptr.
* include/abg-ir.h (translation_unit::{is_constructed,
set_is_constructed}): Add new methods.
(class_decl::has_virtual_member_functions): Likewise.
(class decl_base): Makes it virtually inherit ir_traversable_base.
(class type_base): Make this virtually inherit traversable_base
too.
(type_base::canonicalize): Renamed enable_canonical_equality
into this.
(type_base::traverse): Declare new virtual method.
(canonicalize): Renamed enable_canonical_equality into this.
(scope_type_decl::traverse): Declare new virtual method.
(namespace_decl::get_pretty_representation): Declare new virtual
method.
(function_type::traverse): Likewise.
(class_decl::base_spec::traverse): Likewise.
(ir_node_visitor::visit): Remove the overloads and replace each of
them with a pair of ...
(ir_node_visitor::{visit_begin, visit_end}): ... of these.
* include/abg-traverse.h (traversable_base::visiting): New
method.
(traversable_base::visiting_): New data member.
(traversable_base::traversable_base): New constructor.
* src/abg-ir.cc ({scope_decl, type_decl, namespace_decl,
qualified_type_def, pointer_type_def, reference_type_def,
array_type_def, enum_type_decl, typedef_decl, var_decl,
function_decl, function_decl::parameter, class_decl,
class_decl::member_function_template,
class_decl::member_class_template, function_tdecl,
class_tdecl}::traverse): Fix this to properly set the
traversable_base::visiting_ flag and to reflect the new signatures
of the ir_node_visitor methods.
({type_base, scope_type_decl, function_type,
class_decl::base_spec}::traverse): New method.
(type_base::get_canonical_type_for): Handle the case of the type
already having a canonical type. Properly hash the type using the
dynamic type hasher. Look through declaration-only classes to
consider the definition of the class instead. Fix logic to have a
single pointer of return, to ease debugging.
(canonicalize): Renamed enable_canonical_equality into this.
(namespace_decl::get_pretty_representation): Define new method.
(ir_node_visitor::visit): Replace each of these overloads with a
pair of visit_begin/visit_end ones.
(translation_unit::priv::is_constructed_): New data member.
(translation_unit::priv::priv): Initialize it.
(translation_unit::{is_constructed, set_is_constructed}): Define
new methods.
(is_member_type(const decl_base_sptr)): Remove.
(is_class_type(decl_base *d)): Define new function.
(class_decl::has_virtual_member_functions): Define new method.
(equals(const class_decl&, const class_decl&, change_kind*)): If
the containing translation unit is not constructed yet, do not
take virtual member functions in account when comparing the
classes. This is because when reading from DWARF, there can be
DIEs that change the number of virtual member functions after the
DIE of the class. So one needs to start taking virtual members
into account only after the translation unit has been constructed.
(class non_canonicalized_subtype_detector): Define new type.
(type_has_non_canonicalized_subtype): Define new function.
* src/abg-corpus.cc (symtab_build_visitor_type::visit): Renamed
this into symtab_build_visitor_type::visit_end.
* src/abg-dwarf-reader.cc (die_type_map_type): New typedef.
(die_class_map_type): This is now a typedef on a map of
Dwarf_Off/class_decl_sptr.
(read_context::{die_type_map_, alternate_die_type_map_,
types_to_canonicalize_, alt_types_to_canonicalize_}): New data
members.
(read_context::{associate_die_to_decl,
associate_die_to_decl_primary}): Make these methods public.
(read_context::{associate_die_to_type,
lookup_type_from_die_offset, is_wip_class_die_offset,
types_to_canonicalize, schedule_type_for_canonicalization}):
Define new methods.
(build_type_decl, build_enum_type)
(build_class_type_and_add_to_ir, build_qualified_type)
(build_pointer_type_def, build_reference_type, build_array_type)
(build_typedef_type, build_function_decl): Do not canonicalize
types here.
(maybe_canonicalize_type): Define new function.
(build_ir_node_from_die): Take a new flag that says if the ir node
is a member type/function or not. Early-canonicalize base types.
Canonicalize composite types that have only canonicalized
sub-types. Schedule the other types for late canonicalizing. For
class types, early canonicalize those that are non-member types,
that are fully constructed and that have only canonicalized
sub-types. Adjust to the new signature of build_ir_node_from_die.
(get_scope_for_die, build_namespace_decl_and_add_to_ir)
(build_qualified_type, build_pointer_type_def)
(build_reference_type, build_array_type, build_typedef_type)
(build_var_decl, build_function_decl): Adjust for the new
signature of build_ir_node_from_die.
(build_translation_unit_and_add_to_ir): Likewise. Perform the
late canonicalizing of the types that have been scheduled for
that.
(build_class_type_and_add_to_ir): Return a class_decl_sptr, not a
decl_base_sptr. Adjust for the new signature of
build_ir_node_from_die. Early canonicalize member types that are
created and added to a given class, or schedule them for late
canonicalizing.
* src/abg-reader.cc (class read_context::{m_wip_classes_map,
m_types_to_canonicalize}): New data members.
(read_context::{clear_types_to_canonicalize,
clear_wip_classes_map, mark_class_as_wip, unmark_class_as_wip,
is_wip_class, maybe_canonicalize_type,
schedule_type_for_late_canonicalizing,
perform_late_type_canonicalizing}): Add new method definitions.
(read_context::clear_per_translation_unit_data): Call
read_context::clear_types_to_canonicalize().
(read_translation_unit_from_input): Call
read_context::perform_late_type_canonicalizing() at the end of the
function.
(build_function_decl): Fix the function type canonicalizing (per
translation) that was already in place. Do the canonicalizing of
these only when the type is fully built. Oops. This was really
brokend. Also, when the function type is constructed, consider it
for type canonicalizing.
(build_type_decl): Early canonicalize basic types.
(build_qualified_type_decl, build_pointer_type_def)
(build_pointer_type_def, build_reference_type_def)
(build_array_type_def, build_enum_type_decl, build_typedef_decl):
Handle the canonicalizing for these composite types: either early
or late.
(build_class_decl): Likewise. Also, mark this class a 'being
built' until it's fully built. This helps the canonicalizing code
to know that it should leave a class alone until it's fully built.
* tests/test-ir-walker.cc (struct name_printing_visitor): Adjust
to the visitor methods naming change.
* configure.ac: Generate the tests/runtestcanonicalizetypes.sh
testing script from tests/runtestcanonicalizetypes.sh.in.
* tests/runtestcanonicalizetypes.sh.in: Add the template for the
new runtestcanonicalizetypes.sh script that test for type
canonicalizing.
* tests/Makefile.am: Add the new runtestcanonicalizetypes.sh
regression testing script to the build system.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-02-13 19:20:57 +00:00
|
|
|
runtestcanonicalizetypes_sh_SOURCES =
|
|
|
|
runtestcanonicalizetypes.sh$(EXEEXT):
|
|
|
|
|
Bug 19428 - New fedabipkgdiff utility
fedabipkgdiff is a convenient way to compare the ABI of Fedora
packages easily.
The first version of fedabipkgdiff introduced by this patch lets users
perform operations like:
fedabipkgdiff --from fc23 foo-0.1-1.fc23.x86_64.rpm
fedabipkgdiff --from fc23 --to fc24 foo
fedabipkgdiff foo-0.1-1.fc23 foo-0.1-1.fc24
fedabipkgdiff foo-0.1-1.fc23.i686 foo-0.1-1.fc24.i686
fedabipkgdiff --all-subpackages foo-0.1-1.fc23 foo-0.1-1.fc24
* autoconf-archive/ax_compare_version.m4: New file copied from the
autoconf-archive project.
* autoconf-archive/ax_prog_python_version.m4: Likewise.
* autoconf-archive/ax_python_module.m4: Likewise.
* Makefile.am: Add the new files above to the source distribution.
* configure.ac: Include the new m4 macros from the autoconf
archive. Add a new --enable-fedabipkgdiff option. Update the
report at the end of the configure process to show the status of
the fedabipkgdiff feature. Add check for prerequisite python
modules argparse, glob, logging, os, re, shlex, subprocess, sys,
itertools, urlparse, itertools, shutil, unittest, xdg, koji and
mock. These are necessary for the unit test of
fedabipkgdiff. Generate tests/runtestfedabipkgdiff.py into the
build directory, from the tests/runtestfedabipkgdiff.py.in input
file.
* tools/Makefile.am: Include the fedabipkgdiff to the source
distribution and install it if the "fedabipkgdiff" feature is
enabled.
* tests/Makefile.am: Rename runtestfedabipkgdiff.sh into
runtestfedabipkgdiff.py. Add the new runtestfedabipkgdiff.py.in
autoconf template file in here.
* tests/runtestfedabipkgdiff.py.in: New unit test file.
* tools/fedabipkgdiff: New fedabipkgdiff tool.
* doc/manuals/fedabipkgdiff.rst: New manual.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-02-09 10:05:33 +00:00
|
|
|
runtestfedabipkgdiff_py_SOURCES =
|
|
|
|
runtestfedabipkgdiff.py$(EXEEXT):
|
|
|
|
|
Bug 20180 - Support system-wide suppression specifications
This patch adds support for loading system and user level suppression
specifications for libabigail tools.
At launch time, relevant libabigail tools (abidiff, abipkgdiff
fedabipkgdiff for now) read the default system suppression
specification file, if it's present, from a file which path is the
value of the environment variable
LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE, if set, or from the file
$libdir/libabigail/default.abignore.
Then it reads the user system suppression specification file, if it's
present, from a file which path is the value of the environment
variable LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE, if set, or from the
file $HOME/.abignore.
The content of the user system suppression file is merged with the
content of default system suppression file.
That content is also merged with the content of the suppression
specification files that might be provided by the --suppressions
command line option of the invoked tools.
The resulting set of all these suppression specifications is thus used
to filter the ABI change reports that are emitted.
abidiff, abipkgdiff and abipkgdiff gain a --no-default-suppression
option to avoid loading any of these default suppression specification
files.
The patch also installs a default.abignore file into $(pkglibdir).
Note that on x86_64, that directory is /usr/lib64/libabigail. Now we
just need to think about the content of that default.abignore file.
* doc/manuals/abidiff.rst: Document the default suppression
scheme, its interaction with the --supprs option and the new
--no-default option.
* doc/manuals/abipkgdiff.rst: Likewise.
* doc/manuals/fedabipkgdiff.rst: Likewise.
* configure.ac: Generate the tests/runtestdefaultsupprs.py file
from the new tests/runtestdefaultsupprs.py.in template.
* default.abignore: New file.
* Makefile.am: Add it to source distribution.
* src/Makefile.am: Define the ABIGAIL_ROOT_SYSTEM_LIBDIR
preprocessor macro that is set the value of the $libdir autotools
macro.
* include/abg-tools-utils.h: Update copyright years.
(get_system_libdir, get_default_system_suppression_file_path)
(get_default_user_suppression_file_path)
(load_default_system_suppressions)
(load_default_user_suppressions): Declare new functions
* src/abg-tools-utils.cc (get_system_libdir)
(get_default_system_suppression_file_path)
(get_default_user_suppression_file_path)
(load_default_system_suppressions)
(load_default_user_suppressions): Define new functions.
(is_regular_file): Amend this so that it return true for symlinks
to regular files too.
(is_dir): Amend this so that it returns true for symlinks to
directories too.
* tools/abidiff.cc (options::no_default_supprs): New data member.
(options::options): Initialize the new data member.
(display_usage): Display a new help string for the new
--no-default-suppression command line option.
(parse_command_line): Parse this new command line option.
(set_diff_context_from_opts): Load the default suppression
specifications, unless --no-default-suppression or --supprs was
provided.
* tools/abipkgdiff.cc (options::no_default_supprs): New data
member.
(options::options): Initialize the new data member.
(parse_command_line): Parse the new --no-default-suppression
command line option.
(main): Load the default suppression specifications, unless
--no-default-suppression or --supprs was provided.
* tools/fedabipkgdiff (abipkgdiff): Add --no-default-suppression
to the invocation of abipkgdiff if it was provided on the command
line.
(build_commandline_args_parser): Parse the new
--no-default-suppression command line option.
* tests/runtestdefaultsupprs.py.in: New test harness template.
* tests/Makefile.am: Add the new runtestdefaultsupprs.py to the
set of tests.
* tests/data/test-default-supprs/test0-type-suppr-0.suppr: New
test input.
* tests/data/test-default-supprs/test0-type-suppr-report-0.txt: Likewise.
* tests/data/test-default-supprs/test0-type-suppr-v0.o: Likewise.
* tests/data/test-default-supprs/test0-type-suppr-v1.o: Likewise.
* tests/data/test-default-supprs/dirpkg-1-dir-report-0.txt:
Likewise.
* tests/data/test-default-supprs/dirpkg-1-dir1: Likewise.
* tests/data/test-default-supprs/dirpkg-1-dir2: Likewise.
* tests/data/Makefile.am: Add new the new tests input above to
Makefile.am.
* tests/runtestcanonicalizetypes.sh.in: Pass
--no-default-suppression to abidiff invocations.
* tests/runtestdefaultsupprs.py.in: Likewise.
* tests/test-abidiff-exit.cc: Likewise.
* tests/test-diff-dwarf-abixml.cc: Likewise.
* tests/test-diff-filter.cc: Likewise.
* tests/test-diff-suppr.cc: Likewise.
* tools/abidiff.cc: Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-30 08:37:48 +00:00
|
|
|
runtestdefaultsupprs_py_SOURCES =
|
|
|
|
runtestdefaultsupprs.py$(EXEEXT):
|
|
|
|
|
2018-03-25 07:34:59 +00:00
|
|
|
runtestfedabipkgdiffpy3_sh_SOURCES =
|
|
|
|
runtestfedabipkgdiffpy3.sh$(EXEEXT):
|
|
|
|
|
|
|
|
runtestdefaultsupprspy3_sh_SOURCES =
|
|
|
|
runtestdefaultsupprspy3.sh$(EXEEXT):
|
|
|
|
|
2013-08-29 15:08:47 +00:00
|
|
|
AM_CPPFLAGS=-I${abs_top_srcdir}/include \
|
2015-06-07 15:01:52 +00:00
|
|
|
-I${abs_top_builddir}/include -I${abs_top_srcdir}/tools -fPIC
|
2013-03-21 22:42:41 +00:00
|
|
|
|
2013-05-03 13:28:10 +00:00
|
|
|
clean-local: clean-local-check
|
|
|
|
.PHONY: clean-local-check
|
|
|
|
|
|
|
|
clean-local-check:
|
2013-07-03 05:32:21 +00:00
|
|
|
-rm -rf ${builddir}/output *.svg *.gv
|
2016-05-21 00:09:50 +00:00
|
|
|
|
|
|
|
@VALGRIND_CHECK_RULES@
|
|
|
|
VALGRIND_SUPPRESSIONS_FILES = ${srcdir}/test-valgrind-suppressions.supp
|
|
|
|
|
|
|
|
# These are flags passed to Valgrind so that it follows children
|
|
|
|
# processes of the test programs. This is because many test programs
|
|
|
|
# actually fork libabigail command line tools, and we want to valgrind
|
|
|
|
# those libabigail command line tools as well.
|
|
|
|
#
|
|
|
|
# The problem though is that there are many other command line
|
|
|
|
# programs that are forked too. For instance, /bin/sh is forked
|
|
|
|
# because tests are using the system() function to execute commands.
|
|
|
|
# So we must tell Valgrind to avoid following a bunch of command line
|
|
|
|
# programs that we don't care about and that take a lot of time to
|
|
|
|
# valgrind.
|
|
|
|
RECURSIVE_VALGRIND_FLAGS = \
|
|
|
|
--num-callers=30 \
|
|
|
|
--trace-children=yes \
|
|
|
|
--trace-children-skip=/bin/diff,/bin/rm,/bin/mkdir,/bin/cd,*cpio,/bin/dpkg,/bin/rpm,/bin/test,/bin/tar,/bin/sed,/bin/ls,/bin/g++,/*collect*,/bin/ld
|
|
|
|
|
|
|
|
# Use the target below to run tests under Valgrind's memcheck tool by
|
|
|
|
# telling it to follow children process, so that it can also check
|
|
|
|
# libabigail tools that are forked by the tests. This usually takes a
|
|
|
|
# while. So, to launch just one test in this configuration, if you
|
|
|
|
# are in the top-most source directory you can do:
|
|
|
|
#
|
|
|
|
# make -C <build-directory>/tests check-valgrind-memcheck-recursive TESTS=runtestdiffsuppr
|
|
|
|
|
|
|
|
check-valgrind-memcheck-recursive:
|
|
|
|
$(MAKE) check-valgrind-memcheck VALGRIND_FLAGS="${RECURSIVE_VALGRIND_FLAGS}"
|
2017-02-24 13:57:52 +00:00
|
|
|
|
|
|
|
check-valgrind-helgrind-recursive:
|
|
|
|
$(MAKE) check-valgrind-helgrind VALGRIND_FLAGS="${RECURSIVE_VALGRIND_FLAGS}"
|