Commit Graph

1319 Commits

Author SHA1 Message Date
Dodji Seketeli
756cdc113b Do not emit empty namespaces in abixml
Today The abixml writer emits namespaces even if they are empty or
contain empty namespaces.  This leads to abixml files that are
unnecessarily big and verbose.  This patch prevents that.

	* include/abg-ir.h
	(namespace_decl::is_empty_or_has_empty_sub_namespaces): Declare
	new function ...
	* src/abg-ir.cc
	(namespace_decl::is_empty_or_has_empty_sub_namespaces): ... and
	define it.
	* src/abg-writer.cc (write_namespace_decl): Do not write empty
	namespaces or namespaces containing empty namespaces.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust.
	* tests/data/test-read-dwarf/libtest23.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-21 18:35:07 +02:00
Dodji Seketeli
a97547f905 Fix misleading indentation issues
This patch fixes misleading indentation mistakes reported by GCC 6.1.1

	* tools/abipkgdiff.cc (compare): Likewise.
	* tools/abisym.cc (main): Fix misleading indentation.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-09-21 12:06:51 +02:00
Dodji Seketeli
3227d2156a Bug 20534 - abipkgdiff wrongly displays the name of added binary files
abipkgdiff displays an address instead of displaying the name of the
added binary file.  This patch, which is from a diff that Sinny Kumari
attached to the bugzilla entry, fixes the issue.

	* tools/abipkgdiff.cc (compare): Show the name of the added
	binary, rather than its address.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-30 09:44:28 +02:00
Dodji Seketeli
237734dd94 Bug 20420 - Wrong ODR-based type comparison optimization on qualified type
During type canonicalizing, qualified types are being compared using
the ODR-based optimization.  This is wrong because, for instance, it's
not because two types from the same ABI corpus are both const
anonymous structs that they are meant to be equivalent.

This patch fixes the issue by applying the ODR-based comparison
optimization only to built-in types and non-anonymous struct and
enums.

The reproducer is a glibc package that takes a while to compare so
it's not suitable for inclusion in the test suite.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-24 10:37:08 +02:00
Dodji Seketeli
09154361a4 Don't walk diff trees indefinitely when applying suppressions
When applying suppressions to diff graphs, if the same diff node
appears twice in the graph in a way that creates a cycle, we can get
trapped in the cycle when walking the graph.  That results in a an
infinite loop.  Note that the infinite loop appears in the
diff::traverse member function, in the for-loop that walks the
children nodes of a given node.

This patch avoids walking the same node twice when applying
suppressions.

The test binaries that exhibit the issue come from the two following
packages:

rh-mariadb101-mariadb-10.1.14-2.el6 and	rh-mariadb101-mariadb-10.1.16-1.el6.

The sub-packages compared are
rh-mariadb101-mariadb-server-10.1.14-2.el6.x86_64.rpm and
rh-mariadb101-mariadb-server-10.1.16-1.el6.x86_64.rpm.

The debug info packages are
rh-mariadb101-mariadb-debuginfo-10.1.16-1.el6.x86_64.rpm and
rh-mariadb101-mariadb-debuginfo-10.1.14-2.el6.x86_64.rpm.

Once the packages are properly extracted the command line that
exhibits the infinite loop is:

    abidiff --d1 rh-mariadb101-mariadb-10.1.14-2.el6.x86_64/usr/lib/debug --d2 rh-mariadb101-mariadb-10.1.16-1.el6.x86_64/usr/lib/debug rh-mariadb101-mariadb-10.1.14-2.el6.x86_64/opt/rh/rh-mariadb101/root/usr/lib64/mysql/plugin/ha_connect.so rh-mariadb101-mariadb-10.1.16-1.el6.x86_64/opt/rh/rh-mariadb101/root/usr/lib64/mysql/plugin/ha_connect.so

This patch has no test because of the cheer size of these packages;
the debug info packages alone take more than 100MB :-( I really hope
we set up a separate repository with big test packages to overcome
this.  Maybe something using fedabipkgdiff ...

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-08-23 12:38:36 +02:00
Dodji Seketeli
103a6eb94f Control symbols exported from libabigail.so
Symbols of pretty much all member functions of types that are meant to
be "private" to translation units that contribute to libabigail.so
were exported because we didn't do much to prevent that.

This patch starts controlling the set of symbols that are exported.

By default, symbols of any entity declared in a translation unit that
contributes to libabigail.so are hidden by default.  Only symbols of
entities declared in public headers (headers in include/*.h) are
exported.

There are many ways to achieve that.  This patch chooses to avoid
cluttering declarations of entities in the public header by adding
__attribute__((visibility="default")) to every declared type of
function in there.

Rather, the patch uses "#pragma GCC visibility push(default)" before
entities declared on those headers.  By doing so, all those entities
have their symbol marked as "visible" by the compiler.  Once the
header are #included, the #pragma GCC visibility pop" is used, so that
anything else has its symbol be hidden from that point on.

Note that for ease of maintenance the patch uses the macros
ABG_BEGIN_EXPORT_DECLARATIONS and ABG_END_EXPORT_DECLARATIONS rather
than using the pragma directive directly.

I believe this is a more elegant way of handling visibility, compared
to cluttering every single declaration in public headers with a
"__attribute__((visibility=("default")))" or with a macro which
expands to it.

This reduces the the set of symbols exported by libabigail.so from
20000+ to less than 5000.

	* VISIBILITY: New documentation about this visiblity business.
	* CONTRIBUTING: Update the "contributing guide" to refer to symbol
	visibility issues.
	* configure.ac: Define a variable VISIBILITY_FLAGS that is set to
	the -fvisibility=hidden flag to pass to GCC, when its available.
	* src/Makefile.am: Add VISIBILITY to source distribution.  Also
	add COMPILING and COMMIT-LOG-GUIDELINES that were missing.
	* src/Makefile.am: Use the new $(VISIBILITY_FLAGS) when buiding
	the library.
	* tests/Makefile.am: Use the new $(VISIBILITY_FLAGS) when buiding
	tests.
	* tools/Makefile.am: Use the new $(VISIBILITY_FLAGS) when buiding
	tools.
	* src/abg-comp-filter.cc: Enclose inclusion of public headers in
	ABG_BEGIN_EXPORT_DECLARATIONS and ABG_END_EXPORT_DECLARATIONS to
	export the symbols of entities declared in there.
	* src/abg-comparison.cc: Likewise.
	* src/abg-config.cc: Likewise.
	* src/abg-corpus.cc: Likewise.
	* src/abg-diff-utils.cc: Likewise.
	* src/abg-dwarf-reader.cc: Likewise.
	* src/abg-hash.cc: Likewise.
	* src/abg-ini.cc: Likewise.
	* src/abg-ir.cc: Likewise.
	* src/abg-libxml-utils.cc: Likewise.
	* src/abg-libzip-utils.cc: Likewise.
	* src/abg-reader.cc: Likewise.
	* src/abg-suppression.cc: Likewise.
	* src/abg-tools-utils.cc: Likewise.
	* src/abg-traverse.cc: Likewise.
	* src/abg-viz-common.cc: Likewise.
	* src/abg-viz-dot.cc: Likewise.
	* src/abg-viz-svg.cc: Likewise.
	* src/abg-workers.cc: Likewise.
	* src/abg-writer.cc: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-27 12:51:02 +02:00
Dodji Seketeli
8b2f4ac43f Support DW_TAG_type_unit
Type units sections are sections in which the compiler emits types
uniquely identified by a signature.  This is so that the linker can
later discard redundant types (types having the same signature) from
the debug info and thus reduce the overall size of debug info.

These types are children DIEs of DW_TAG_type_unit.

Because DIEs coming from that .debug_types section can have the same
offset as DIEs coming from the .debug_info section, this patch defines
a new DIE source to identify DIEs coming from .debug_types section.
The name of that new source is the new TYPE_UNIT_DIE_SOURCE enumerator
of the die_source enum.  The patch also creates the necessary maps
containing DIEs coming from this new source and adjusts the
accompanying accessors accordingly.

	* src/abg-dwarf-reader.cc (TYPE_UNIT_DIE_SOURCE): New enumerator
	in enum die_source.
	(read_context::{type_unit_die_decl_map_, type_unit_die_type_map_,
	type_unit_die_wip_classes_map_,
	type_unit_die_wip_function_types_map_,
	type_unit_types_to_canonicalize_,
	type_units_tu_die_imported_unit_points_map_,
	type_section_die_parent_map_}): New data members.
	(read_context::{get_die_source, associate_die_to_decl,
	lookup_decl_from_die_offset, die_type_map, clear_die_type_maps,
	die_wip_classes_map, die_wip_function_types_map,
	types_to_canonicalize, clear_types_to_canonicalize,
	tu_die_imported_unit_points_map, die_parent_map}): Support
	TYPE_UNIT_DIE_SOURCE.
	(get_parent_die, get_scope_for_die): Likewise.
	(read_context::{lookup_decl_from_type_unit_die_offset,
	type_section_die_parent_map}): Define new member functions.
	(read_context::build_die_parent_maps): Build a DIE -> parent map
	for DIEs coming from the .debug_types section.
	* tests/data/test-read-dwarf/libtest23.so: New test input.
	* tests/data/test-read-dwarf/libtest23.so.abi: New reference output.
	* tests/data/test-read-dwarf/test23-first-tu.cc: Source code of
	the new binary above.
	* tests/data/test-read-dwarf/test23-second-tu.cc: Likewise.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-read-dwarf.cc (in_out_specs): Make this test harness
	execute over the new test input and reference output.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-26 20:07:03 +02:00
Dodji Seketeli
69024ca49c Misc code cleanup
* src/abg-dwarf-reader.cc (build_function_decl): Use the more
	readable is_class_type rather than a dynamic_cast.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-26 20:06:55 +02:00
Dodji Seketeli
980d2b6065 Generalize DIE source concept in DWARF reader
There are many functions in the DWARF reader that need to know if a
DIE comes from the primary or alternate debug info file.  Today, this
is conveyed by a boolean parameter.

This patch generalizes this idea of "source of DIE" by introducing a
new enum type named die_source that says where the DIE comes from.
This is to help later enable the introduction of a new kind of DIE
source.

The patch also introduces a new member function named
read_context::get_die_source to determine the source of a DIE.  This
helps remove the need of a die_source parameter on functions that
already take a DIE.  So this patch conceptually removes the die_source
parameter from many functions.

	* src/abg-dwarf-reader.cc (enum die_source): Define new enum.
	(operator++): Define new prefix increment operator for the
	die_source enum.
	(imported_unit_point::imported_unit_from_alt_di): Remove this
	data member.
	(imported_unit_point::imported_unit_die_source):
	New data member of type die_source.
	(read_context::primary_die_parent_map_): Renamed
	die_parent_map_ data member into this.
	(read_context::clear_per_corpus_data): Use the new
	clear_die_type_maps function, not die_type_map.  Also use the
	new clear_types_to_canonicalize overload that takes no
	parameter.
	(read_context::{get_die_source, clear_die_type_maps,
	clear_types_to_canonicalize}): New member functions.
	(build_ir_node_from_die, die_die_attribute, get_parent_die)
	(get_scope_for_die, build_namespace_decl_and_add_to_ir)
	(build_type_decl, build_enum_type)
	(build_class_type_and_add_to_ir, build_qualified_type)
	(build_pointer_type_def, build_reference_type)
	(build_function_type, build_array_type, build_typedef_type)
	(build_var_decl, build_function_decl): Remove the boolean
	parameter that was designating the source of the DIE.  If
	necessary, get the source of the DIE from inside the function
	using the new read_context::get_die_source.
	(read_debug_info_into_corpus): Adjust.
	(maybe_canonicalize_type, find_import_unit_point_between_dies)
	(maybe_canonicalize_type, read_context::{associate_die_to_decl,
	lookup_decl_from_die_offset, die_type_map, associate_die_to_type,
	lookup_type_from_die_offset, die_wip_classes_map,
	die_wip_function_types_map, is_wip_class_die_offset,
	is_wip_function_type_die_offset, types_to_canonicalize,
	schedule_type_for_late_canonicalization,
	canonicalize_types_scheduled, add_late_canonicalized_types_stats,
	perform_late_type_canonicalizing}): Take a die_source as the
	source of the DIE, not a boolean.  Adjust the code of the function
	accordingly.
	(read_context::{tu_die_imported_unit_points_map}): Modified
	this to make it take a die_source and return the appropriate
	map depending on the source.
	(read_context::build_die_parent_relations_under): Turn the
	non-member static function build_die_parent_relations_under
	into a member function.
	(read_context::build_die_parent_maps): Turn the non-member
	static function build_die_parent_maps into a member function.
	Make this function build a DIE -> parent map also for type
	DIEs that are in the .type_units section.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-26 20:05:23 +02:00
Dodji Seketeli
b07fcbcc0d Cleanup is_class and is_compatible_with_class_type
There was two overloads of is_class, one for types and one for decls.
Now that we have type_or_decl_base which is a common base type for
both, having just one is_class function that takes a type_or_decl_base
is more compact and easier to maintain.  This patch does that.  It
also cleans up the declaration of the is_compatible_with_class_type
function.

	* include/abg-fwd.h (is_class): Remove the overloads that take a
	decl_base or a type_base.  Add one that takes a type_or_decl_base.
	(is_compatible_with_class_type): Make this take a reference to
	smart pointer, not just the smart pointer.
	* src/abg-ir.cc (is_class): Do the same as in the header file.
	(is_compatible_with_class_type): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-26 20:04:53 +02:00
Dodji Seketeli
5a24ffcd61 Add ABG_ASSERT_NOT_REACHED macro
Adding this macro to abort at places where the execution flow
shouldn't take us to.  Using this is more explicit (self-documented)
than using abort.

This patch replaces the use of abort() in abg-dwarf-reader.cc.

	* include/abg-tools-utils.h (ABG_ASSERT_NOT_REACHED): New macro.
	* src/abg-dwarf-reader.cc (stt_to_elf_symbol_type)
	(stb_to_elf_symbol_binding, get_elf_class_size_in_bytes)
	(build_ir_node_from_die): Use the new ABG_ASSERT_NOT_REACHED macro
	in lieu of just calling abort().

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-26 20:04:23 +02:00
Dodji Seketeli
a126e92583 Prepare support for symbol visibility control
While working on something else, I started to prepare the support for
visibility control in the library.  This patch detects that we are
using a compiler that supports GCC's visibility control attributes and
defines macros ABG_HIDDEN, ABG_EXPORTED,
ABG_{BEGIN,END}_EXPORT_DECLARATIONS to control the visibility of
declarations accordingly.  These are not yet used but using them
should now be easy.

	* configure.ac: Detect compiler support for
	__attribute__((visibility("hidden")) and define the
	HAS_GCC_VISIBILITY_ATTRIBUTE macro accordingly.  Update the
	configuration report.
	* src/abg-internal.h: New internal header file that defines macros
	to be used in the source code to control declaration visibility.
	* src/Makefile.am: Add abg-internal.h to source distribution.  Add
	src/ to the include search path.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-26 20:04:04 +02:00
Chenxiong Qi
1a00cad493 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-15 19:41:08 +02:00
Dodji Seketeli
e88892c0b1 Fix spurious type size change report for distinct_diff
When looking at diff of two distinct types it can happen that the
change report mentions a type size change even when the two type sizes
are equal.

This patch fixes that.

	* src/abg-comparison.cc (report_size_and_alignment_changes):
	Report size change only when the sizes are different.
	* tests/data/test-diff-filter/test33-report-0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-13 23:45:49 +02:00
Dodji Seketeli
ca133d551b Bug 20199 - Consider integral type synonyms as being equal
In this problem report, Abigail's type comparison engine considers
e.g, "unsigned short" and "short unsigned int" as being different
types because they have different name strings.  This is wrong.

This patch canonicalize the names of integral types, so that e.g,
"short unsigned", "unsigned short" and "unsigned short int" all have
the same name which would be "unsigned short int".

	* src/abg-ir.cc (class integral_type): New class declaration and
	definition.
	(operator|, operator&, operator&=): New non-member bitwise
	operators for integral_type.
	(parse_integral_type_modifier, parse_base_integral_type)
	(parse_integral_type_modifier): New static function definitions.
	(type_decl::type_decl): Use the parse_integral_type to parse an
	integral type out of the current type_decl being built and
	transform the current type name into a canonical form.
	* tests/data/test-abidiff/test-PR18791-v0.so.abi: Adjust.
	* tests/data/test-abidiff/test-PR18791-v1.so.abi: Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise.
	* tests/data/test-diff-filter/test33-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test34-report-0.txt: Likewise.
	* tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Likewise.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-13 23:37:43 +02:00
Dodji Seketeli
5b9ef4d091 Bug 20332 - too many ...'s counted as parameters
GCC can generate several DW_TAG_unspecified_parameters for a given
function.  Abigail's DWARF reader is recklessly creating a variadic
function parameter in its internal representation (IR) each time it
sees a DW_TAG_unspecified_parameters.  This leads to functions having
several variadic parameters in the final IR.  And this is wrong.

This patch fixes the problem by creating a variadic parameter only for
the first DW_TAG_unspecified_parameters encountered for a given
function DIE.

	* src/abg-dwarf-reader.cc (build_function_type): Create a variadic
	parameter just for the first DW_TAG_unspecified_parameters seen.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Adjust.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-08 09:51:24 +02:00
Dodji Seketeli
93fea0667e Better recognize qualified void type
This fixes Bug 20329 - DW_TAG_const_type with no DW_AT_type not recognized as "const void".

It appears that GCC sometimes emits "const void" types by emitting a
const type DIE with no type attribute.  The DWARF reader didn't
recognize that construct as a qualified void type.

This patch teaches the DWARF reader to recognize that construct.

It also appears that "const void" and "void" are equivalent and can be
emitted interchangeably by compilers (Intel and GCC) in their debug
info.  That can lead to spurious ABI change reports saying that a type
"const void" was changed into a "void" type.

This patch transforms an occurrence of "const void" type into a "void"
type in the internal representation when reading DWARF.  This does
away with the spurious change that appears when comparing selected
binaries emitted with the intel against binaries emitted with GCC.

	* include/abg-ir.h (environment::is_void_type): Declare new member
	function.
	* src/abg-ir.cc (environment::is_void_type): Define new member
	function.
	* src/abg-dwarf-reader.cc (maybe_strip_qualification): Strip const
	qualifier from const void.
	* tests/data/test-diff-filter/test34-libjemalloc.so.2-gcc-6.1.0:
	New test input.
	* tests/data/test-diff-filter/test34-libjemalloc.so.2-intel-16.0.3: Likewise.
	* tests/data/test-diff-filter/test34-report-0.txt: New reference output.
	* tests/data/Makefile.am: Add the new files above to the source
	distribution.
	* tests/test-diff-filter.cc (in_out_specs): Compare the two new
	binaries above.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Adjust.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Adjust.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: Adjust.
	* tests/data/test-read-dwarf/test1.abi: Adjust.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Adjust.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Adjust.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
	* tests/data/test-read-dwarf/test13-pr18894.so.abi: Adjust.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Adjust.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Adjust.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Adjust.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Adjust.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Adjust.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Adjust.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi: Adjust.
	* tests/data/test-read-dwarf/test21-pr19092.so.abi: Adjust.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-07 14:04:10 +02:00
Dodji Seketeli
10ce99e428 Bug 20194 - Fail to recognize void type represented by DW_TAG_base_type
This patch makes the DWARF reader recognize a "void" type expressed as
a DW_TAG_base_type of size zero and named "void".

	* src/abg-dwarf-reader.cc (build_type_decl): Recognize a
	DW_TAG_base_type of size zero and of name "void" as a void
	type.
	* tests/data/test-diff-filter/test33-libelf.so.0.8.13-gcc: New
	binary test input.
	* tests/data/test-diff-filter/test33-libelf.so.0.8.13-intel16.0.3: Likewise.
	* tests/data/test-diff-filter/test33-report-0.txt: New reference output.
	* tests/data/Makefile.am: Add the new files above to source
	distribution.
	* tests/test-diff-filter.cc (in_out_specs): Make this test harness
	run over the new test inputs above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-05 12:52:52 +02:00
Dodji Seketeli
9da7ae49d7 Add a new overload for is_type_decl
While working on something else, it appeared that I needed an overload
for is_type_decl that takes a shared pointer to decl_base.  The
current is_type_decl takes a shared opinter to type_base.

This patch also updates some code that unnecessarily calls
is_type_decl.

	* include/abg-fwd.h (is_type_decl): Declare a new overload
	* src/abg-ir.cc (is_type_decl): Define a new overload.
	(function_decl::parameter::get_pretty_representation): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-07-04 16:51:10 +02:00
Chenxiong Qi
eb96c6f341 Add --abipkgdiff option in manual and bash completion
* doc/manuals/fedabipkgdiff.rst: Add description of --abipkgdiff
	option. Reformat paragraph.
	* bash-completion/fedabipkgdiff: Add --abipkgdiff

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-30 15:39:15 +02:00
Chenxiong Qi
e9c25f539d Add fedabipkgdiff bash completion to dist
* bash-completion/Makefile.am: Add fedabipkgdiff
	* bash-completion/fedabipkgdiff: Change mode to 775

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-30 09:38:13 +02:00
Chenxiong Qi
e4e53aa763 Update bash completion for fedabipkgdiff
* bash-completion/fedabipkgdiff: New bash completion file.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-29 10:52:05 +02:00
Dodji Seketeli
3b52398421 Bump version number to 1.0.rc6
* configure.ac: Bump version number to 1.0.rc6

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-29 10:47:58 +02:00
Dodji Seketeli
59cfae117e Update web page for 1.0.rc5
* doc/website/mainpage.txt: Update web page.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-29 10:46:49 +02:00
Dodji Seketeli
204504db24 Update ChangeLog for 1.0.rc5
* ChangeLog: Update by doing "make update-changelog" in the build
	directory.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-28 09:14:28 +02:00
Dodji Seketeli
8d18878f1d Update NEWS file in preparation for 1.0.rc5
* NEWS: update with the edited content of the command:
	git shortlog libabigail-1.0.rc4..HEAD

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-28 09:14:28 +02:00
Dodji Seketeli
4a751787b0 Fix python interpreter path for el6
On el6, the python interpreter is not found at /bin/python, so let's
use /usr/bin/python in tests/runtestdefaultsupprs.py.in.

	* tests/runtestdefaultsupprs.py.in: Use the python interpreter at
	/usr/bin/python, not the one at /bin/python.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-28 09:12:40 +02:00
Dodji Seketeli
800ef86bcc Misc cleanup in abg-reader.cc
While looking at something else, I figured we should pass a smart
pointer parameter by reference in
read_context::push_decl_to_current_scope in the abixml reader.

	* src/abg-reader.cc (read_context::push_decl_to_current_scope):
	Pass the decl smart pointer by value.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-24 14:27:50 +02:00
Dodji Seketeli
a0213cc999 Use ODR-based optimization on C/C++ translation unit only
Looking at the debug info of the libgo library (written in Go) it
appears that there can be for instance a public type "int" which is a
4 bytes long in a translation unit, and another type named "int" as
well, and which is 8 bytes long.  Having this in C++ is illegal as per
the One Definition Rule (ODR).  And generally, in C, we don't have
this either even if C doesn't have an ODR.

Abigail uses the ODR to speed-up type canonicalization.  So in cases
where two "int" types (of different sizes) are considered equal
because they have the same name and are in the same binary we end up
with inconsistencies that make comparison tools emit wrong reports.

This patch thus performs the ODR-based optimization only for C and C++
translation units.

Note that while working on this, I noticed that we were not setting
the translation unit of a certain number of ABI artifacts correctly.
This patch fixes that too.  We need to set the translation unit of all
ABI artifacts because to get the language of the translation union of
an ABI artifact, we need to get its translation unit first.

	* src/abg-ir.cc (strip_typedef): Set the translation unit of the
	new ABI artifact.
	(type_base::get_canonical_type_for): Perform the ODR-based
	optimization only for ABI artifact in C and C++ language
	translation units.
	* src/abg-dwarf-reader.cc (build_ir_node_from_die): Assert that
	the new ABI artifact has its translation unit set.
	* src/abg-reader.cc (read_context::{push_decl_to_current_scope,
	push_and_key_type_decl}): Set the translation unit of the current
	decl, irrespective of if it was added to the current scope or not.
	Assert that the decl that was newly pushed to the current scope is
	added to the current translation unit.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-24 14:25:44 +02:00
Dodji Seketeli
a1b07236bb Misc white space and comment cleanups
While looking at something else, I noticed some spots that need
cleanup with respect to white space or comments.  This patch does just
that.  No big deal.

	* include/abg-ir.h (typedef type_or_decl_base): Cleanup comment.
	* src/abg-ir.cc (struct type_or_decl_base::priv): Fix comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-13 14:43:52 +02:00
Dodji Seketeli
09a24a4767 Cleanup function_decl::parameter::get_pretty_representation
Simplify the logic of function_decl::parameter::get_pretty_representation.

	* src/abg-ir.cc
	(function_decl::parameter::get_pretty_representation): Assert that
	the environment is always non-nil.  Then no needs to check for it
	being non-nil anymore.  Use is_type_decl instead of
	dynamic_pointer_cast.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-13 14:43:24 +02:00
Chenxiong Qi
95b12167fa Fix package NVR comparison in fedabipkgdiff
When sorting two packages by their {Name Value Release} triplet to
select the latest one, just doing a string comparison of the NVRs is
wrong.  Take for example the packages foo-0.10-1.fc25 and
foo-0.2-1.fc25.  A basic string comparison will result in the string
"foo-0.10-1.fc25" being less than "foo-0.2-1.fc25", and thus
foo-0.2-1.fc25 will be selected as the latest package.  And that is
wrong, because the latest one is obviously foo-0.10-1.fc25.

So, after some research on this, I figured rpm.labelCompare is a
better choice to appropriately compare two NVRs.

Another reason why I chose rpm.labelCompare is because the latest
build in fedabipkgdiff means a build with the latest version.release
within a specific Fedora distribution such as fc23 or fc25.

	* configure.ac: Add new dependency.
	* tests/runtestfedabipkgdiff.py.in (builds): Add new builds for
	running tests to test selecting latest build from a package.
	(packages): Add new package gnutls.
	(GetPackageLatestBuildTest.{test_get_latest_one,
	test_cannot_find_a_latest_build_with_invalid_distro}): Use new
	builds of package gnutls to run tests.
	* tools/fedabipkgdiff (cmp_nvr): New function used to compare nvrs
	by Python built-in function sorted.
	(Brew.listBuilds): Use the new cmp_nvr function.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-11 09:10:10 +02:00
Chenxiong Qi
69d2dcd163 Bug 20135 - Make fedabipkgdiff compare ABIs using devel packages
This patch makes fedabipkgdiff compare the ABI of two packages by
taking into account their associated devel packages, along with their
debug info packages.  Taking devel packages into account makes the
tool report changes about types that are defined in public header
files only.  This helps decrease the amount of change reports about
types not defined in public headers.

This is now the default behaviour.

However, if the user provides the new --no-devel-pkg command line
option, then the devel package is not taken into account during the
ABI comparison.

	* doc/manuals/fedabipkgdiff.rst: Add documentation for the new
	--no-devel-pkg command line option, as well as for the new default
	behaviour of taking devel packages into account during ABI
	comparison.
	* tools/fedabipkgdiff (PkgInfo): Add new attribute
	devel_package.
	(RPM.is_devel): New property to determine if rpm is a
	development package.
	(LocalRPM._find_rpm): New method to find a specific rpm.
	(LocalRPM.find_debuginfo): Use new method _find_rpm to find
	debuginfo package.
	(LocalRPM.find_devel): New method to find an associated
	development package.
	(Brew.select_rpms_from_a_build): RPMs selector method is
	changed to select development package also.
	(abipkgdiff): Construct and run abipkgdiff with and without
	--devel-pkg[12] options.
	(magic_construct): Construct PkgInfo with development package.
	(run_abipkgdiff): Run abipkgdiff against rpms with development
	packages.
	(diff_local_rpm_with_latest_rpm_from_koji): Find development
	package, and call method abipkgdiff with development package.
	(build_commandline_args_parser): add new option --no-devel-pkg.
	* tests/runtestfedabipkgdiff.py.in (packages): Add new package
	nss-util.
	(builds): Add new builds of nss-utils, nss-util-3.12.6-1.fc14
	and nss-util-3.24.0-2.0.fc25.
	(rpms): Add new associated rpms of the two new builds.
	(AssertionHelper.assert_functions_changes_summary): New method
	to match and assert functions changes summary.
	(AssertionHelper.assert_abi_comparison_result): Changed to
	support to help assert functions changes summary.
	(MockGlobalConfig.{no_devel_pkg, check_all_subpackages}): New
	fake options with default value for running tests.
	(RPMTest.setUp): add new development package for running test
	case.
	(RPMTest.test_is_devel): New test to test is_devel property.
	(RunAbipkgdiffTest.setUp): Add new development packages for
	running test case.
	(RunAbipkgdiffTest.{test_all_success, test_all_failure,
	test_partial_failure}): Mock global config.
	(RunAbipkgdiffWithDSOOnlyOptionTest): Removed.
	(CompareABIFromCommandLineTest.test_compare_with_no_devel_pkg):
	New test to test fedabipkgdiff with or without --no-devel-pkg
	option.
	* tests/data/Makefile.am: Add new rpms.
	* tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/
	x86_64/nss-util-3.12.6-1.fc14.x86_64.rpm: New rpm for running
	tests.
	* tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/
	x86_64/nss-util-debuginfo-3.12.6-1.fc14.x86_64.rpm: New rpm for
	running tests.
	* tests/data/test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/
	x86_64/nss-util-devel-3.12.6-1.fc14.x86_64.rpm: New rpm for
	running tests.
	* tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/
	x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm: New rpm for running
	tests.
	* tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/
	x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm: New rpm
	for running tests.
	* tests/data/test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/
	x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm: New rpm for
	running tests.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-09 11:11:33 +02:00
Dodji Seketeli
38ac2a8fb2 Improve python modules detection
After I tried to build libabigail on Debian, I realized the detection
of python modules wasn't that great.  The koji module wasn't present
and yet the detection system tried to launch fedabipkgdiff regression
tests.  Woops.

I was thinking about coming up with something easier to to update to
add new modules to check for anyway, so I just dived in.  I came up
with a new autoconf macro of my own, AX_CHECK_PYTHON_MODULES, that
lets you check for the presence of several python modules at once.
This is more handy than having to call AX_PYTHON_MODULE for each
module we want to detect.  This fixes the detection issue I found and
simplifies configure.ac.

	* configure.ac: Include
	autoconf-archive/ax_check_python_modules.m4 rather than
	autoconf-archive/ax_python_module.m4.  Use AX_CHECK_PYTHON_MODULES
	rather than AX_PYTHON_MODULE.
	* Makefile.am: Add the new file
	autoconf-archive/ax_check_python_modules.m4 to source distribution
	and remove the older autoconf-archive/ax_python_module.m4 one.
	* autoconf-archive/ax_check_python_modules.m4: New file.
	* autoconf-archive/ax_python_module.m4: Remove.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-03 17:53:11 +02:00
Chenxiong Qi
70614e18f1 Add integration tests for fedabipkgdiff
A new test case class is introduced as integration tests, that is able to
test fedabipkgdiff ability against supported use cases and with other
command line options. Currently, integration tests only aim to ensure
whether expected comparison against rpms and binaries really happen.

	* configure.ac: do not detect shutil module.
	* tests/runtestfedabipkgdiff.py.in: do not import shutil
	anymore.
	(BUILT_ABIPKGDIFF): new global variable to reference the
	abipkgdiff built from source code, as the new test case' tests
	require this command directly rather than mocking the
	global_config.
	(test_data_dir): convert variable name to uppercase,
	reference to the test data directory by absolute path instead of
	relative path.
	(TEST_TOPDIR): new global variable to use data directory as the
	topdir passed to fedabpkgdiff to download rpms.
	(TEST_DOWNLOAD_CACHE_DIR): new global variable referencing a
	fake download cache directory for tests only.
	(packages, builds, rpms): new global variables as a fake
	storage holding packages, builds and rpms.
	(AssertionHelper): new class helping to assert abipkgdiff
	result easily.
	(MockClientSession): new class to mock koji.ClientSession.
	(MockGlobalConfig.abipkgdiff): set this option to global
	variable BUILT_ABIPKGDIFF.
	(MockKojiClientSessin): removed.
	(mock_get_session): removed.
	(GetPackageLatestBuildTest.{test_get_latest_one,
	test_cannot_find_a_latest_build_with_invalid_distro,
	test_cannot_find_a_latest_build_with_invalid_distro}): mock
	koji.ClientSession with new class MockClientSession. Remove
	invalid documentation from docstring. Use new package rather
	than httpd.
	(DownloadRPMTest.setUp): remove self.download_dir and use global
	TEST_DOWNLOAD_CACHE_DIR.
	(DownloadRPMTest.tearDown): do not remove download cache
	directory.
	(DownloadRPMTest.make_remote_file_url): do not omit positional
	argument specifiers in string format.
	(DownloadRPMTest.{test_succeed_to_download_a_rpm,
	test_failed_to_download_a_rpm}): set fake download cache
	directory to mocked get_download_dir in mock.patch decorator.
	(BrewListRPMsTest.test_select_specific_rpms): use new
	MockClientSession to mock koji.ClientSession. Rewrite test by
	using the new package listed in global variable packages.
	(RunAbipkgdiffWithDSOOnlyOptionTest.{test_abipkgdiff_with_dso_only,
	test_abipkgdiff_without_dso_only}): set fake download cache
	directory to mocked get_download_dir in mock.patch decorator.
	(CompareABIFromCommandLineTest): new integration test case.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/
	i686/dbus-glib-0.100.2-2.fc20.i686.rpm: new rpm for running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/
	i686/dbus-glib-debuginfo-0.100.2-2.fc20.i686.rpm: new rpm for
	running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/
	i686/dbus-glib-devel-0.100.2-2.fc20.i686.rpm: new rpm for
	running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/
	x86_64/dbus-glib-0.100.2-2.fc20.x86_64.rpm: new rpm for running
	tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/
	x86_64/dbus-glib-debuginfo-0.100.2-2.fc20.x86_64.rpm: new rpm
	for running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.100.2/2.fc20/
	x86_64/dbus-glib-devel-0.100.2-2.fc20.x86_64.rpm: new rpm for
	running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/
	i686/dbus-glib-0.106-1.fc23.i686.rpm: new rpm for running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/
	i686/dbus-glib-debuginfo-0.106-1.fc23.i686.rpm: new rpm for
	running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/
	i686/dbus-glib-devel-0.106-1.fc23.i686.rpm: new rpm for running
	tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/
	x86_64/dbus-glib-0.106-1.fc23.x86_64.rpm: new rpm for running
	tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/
	x86_64/dbus-glib-debuginfo-0.106-1.fc23.x86_64.rpm: new rpm for
	running tests.
	* tests/data/test-fedabipkgdiff/packages/dbus-glib/0.106/1.fc23/
	x86_64/dbus-glib-devel-0.106-1.fc23.x86_64.rpm: new rpm for
	running tests.
	* tests/data/Makefile.am: add new rpms.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-06-01 11:41:55 +02:00
Dodji Seketeli
1ab5aebf59 Bug 19967 - System-level suppressions for glibc
This patch adds system-wide default suppression specifications for
glibc.  The intent is to suppress ABI change report for glibc
functions and variables which symbol version is GLIBC_PRIVATE.

	* default.abignore: Add initial suppression specifications for
	glibc.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-31 12:37:57 +02:00
Dodji Seketeli
3e47efb112 Escape all characters when reading a string in ini files
It turns out that when parsing foo = bar\[a-z\], the '[' and ']'
characters where not being escaped while parsing the string
"bar\[a-z\]".

This patch fixes that.

	* src/abg-ini.cc (read_context::peek): Take an output parameter to
	tell the caller when this function escaped the returned
	character.  Added an overload without this new parameter.
	(read_context::read_string): Accept all characters as part of the
	string.
	* tests/data/test-diff-suppr/test7-var-suppr-9.suppr: New test
	input.
	* tests/data/test-diff-suppr/test7-var-suppr-report-9.txt: New
	test reference output.
	* tests/data/Makefile.am: Add the files above to source
	distribution.
	* tests/test-diff-suppr.cc (in_out_spec): Run a new comparison of
	libtest7-var-suppr-v{0,1}.so this time using the new
	test7-var-suppr-9.suppr specification that exercices a string with
	the escaped characters that we were having difficulty with.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-31 12:37:57 +02:00
Dodji Seketeli
5fe6a7404b Don't require all version symbol sections to present
When we need to get the version of a defined symbol, only the
SHT_GNU_versym and SHT_GNU_verdef sections are necessary.
SHT_GNU_verneed is not necessary, for instance.

So do not require that all of the three version-related sections to be
present when we want to get some symbol version information.

Otherwise, we just don't get the version of a defined symbol when the
SHT_GNU_verneed section is not present.  I stumbled upon this while
looking the abidw's output of ld-2.17.so from
glibc-2.17-79.el7_1.x86_64.  The _rtld_global_ro variable's symbol was
being seen as having no symbol version.  In reality it has the
GLIBC_PRIVATE version, but because the binary lacks a SHT_GNU_verneed
section, we were not getting the symbols version information.

I am not adding that library to the test suite because it's too big.
But at least this change doesn't break the existing regression test
suite.

	* src/abg-dwarf-reader.cc (get_symbol_versionning_sections): Allow
	returning just some of the three version-related section, not
	necessarily all of them.  Adjust comment.
	(get_version_for_symbol): Be ready to not necessarily having the
	three version-related sections available.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-31 12:37:57 +02:00
Dodji Seketeli
b36ca1501e 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 18:39:49 +02:00
Dodji Seketeli
af3e2fd570 Add --abipkgdiff option to fedabipkgdiff
When running the 'fedabipkgdiff' tool that is in the build directory,
before "make install", we want to use the 'abipkgdiff' command line
tool that is in the build directory, not the one that might be
at $PATH/bin/abipkgdiff.

To do so, this patch adds a --abipkgdiff <path/to/a/given/abipkgdiff>
option so that the user can chose where to find the 'abipkgdiff'
binary to use.

Note that there is no regression test for this option yet because for
that, we'd this bug to be fixed first:
https://sourceware.org/bugzilla/show_bug.cgi?id=20147.

	* tools/fedabipkgdiff (build_path_to_abipkgdiff): Define new
	function.
	(abipkgdiff): Invoke the new build_path_to_abipkgdiff() here.
	(build_commandline_args_parser): Parse the new --abipkgdiff
	option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-30 16:24:53 +02:00
Dodji Seketeli
9086b015d1 Better diagnostics when abipkgdiff has an extra argument
When abipkgdiff is launched with three packages to compare rather than
just two, it gives a nonsensical error, just like if a wrong option was
given.  This patch fixes that.

	* tools/abipkgdiff.cc (options::wrong_arg): New data member.
	(parse_command_line): Set options::wrong_arg
	to the wrong argument passed.
	(main): Tell wrong argument case apart, and report it.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-30 16:24:53 +02:00
Dodji Seketeli
ef782b7536 Fix suppr spec wording in abipkgdiff manual
* doc/manuals/abipkgdiff.rst: Fix the wording for the --suppr
	option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-30 16:24:53 +02:00
Dodji Seketeli
8e4338d3c3 Update reference to tools in libabigail-concepts manual
* doc/manuals/libabigail-concepts.rst: Do not refer just to
	 abidiff when talking about suppression specification.  Also
	 refer to abipkgdiff and other tools.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-30 16:24:53 +02:00
Dodji Seketeli
d5d303b6c2 Fix some wording in the Libabigail overview manual page
While reading the overview manual page some things stroke me as
needing some cleanup, especially, the confusion about 'ABIGAIL' the
framework and libabigail the library.

	* doc/manuals/libabigail-overview.rst: Cleanup some confusion
	about Abigail-the-framework and libabigail-the-library.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-30 16:24:53 +02:00
Dodji Seketeli
7013500ca7 Add test data for tests/runtestfedabipkgdiff.py
While applying the patch 59917a8 and resolving the conflicts that
arose then, I forgot to git add the RPMs that were needed by the
accompanying test.

This test fixes that.

	* tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm:
	New file.
	* tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm: Likewise.
	* tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm:
	Likewise.
	* tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-25 12:29:28 +02:00
Dodji Seketeli
e34631ce29 Add a 'check-valgrind' target to the top-most Makefile.am
The check-valgrind target was only accessible from the tests/
sub-directory.  Make it be accessible from the top-most directory too.

	* Makefile.am (check-valgrind): Add this new target here.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-25 10:25:47 +02:00
Chenxiong Qi
59917a8118 Bug 20085 - Add --dso-only option to fedabipkgdiff
abipkgdiff supports --dso-only to compare only ABI of shared libraries
instead of all binaries. So, with adding this option to fedabipkgdiff,
its user is also able to let fedabipkgdiff compare ABI of shared
libraries, or not.

	* tools/fedabipkgdiff: Do not import shlex anymore.
	(ABIDIFF_OK, ABIDIFF_ERROR, ABIDIFF_USAGE_ERROR)
	(ABIDIFF_ABI_CHANGE): New global constant variables.
	(abipkgdiff): Pass the --dso-only option to the abipkgdiff command
	line tool, if that option was passed to fedabipkgdiff. Build this
	abipkgdiff command invocation from an array of strings, rather
	than from formatting a string.  This makes us get rid of the shlex
	module.  Fix typo in dry-run logged string.  If there was an
	internal error reported by abipkgdiff, report it to stderr.
	(build_commandline_args_parser): Parse the --dso-only command line
	option.
	* tests/runtestfedabipkgdiff.py.in (fedabipkgdiff_mod): Fix a typo
	in initializing this global variable.
	(test_data_dir): New global variable, that is used to reference
	tests/data/test-fedabipkgdiff/.
	(RunAbipkgdiffTest.{test_all_success, test_partial_failure}): Fix
	typo.
	(Mockglobalconfig.{koji_topdir, dso_only}): New data members.
	(GetPackageLatestBuildTest.{test_get_latest_one,
	test_cannot_find_a_latest_build_with_invalid_distro,
	test_succeed_to_download_a_rpm, test_failed_to_download_a_rpm}):
	Fix typo.
	(BrewListRPMsTest.test_select_specific_rpms): Fix typo.
	(RunAbipkgdiffWithDSOOnlyOptionTest): New test case class.
	* doc/manuals/fedabipkgdiff.rst: update document for this new
	--dso-only option.
	* tests/data/test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm:
	New symbolic link to
	test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm.
	* tests/data/test-fedabipkgdiff/dbus-glib-0.80-3.fc12.x86_64.rpm:
	New symbolic link to
	test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm.
	* tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm:
	New symbolic link to
	test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm.
	* tests/data/test-fedabipkgdiff/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm:
	New symbolic link to
	test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm.
	* tests/data/Makefile.am: add tests/data/test-fedabipkgdiff so
	that this data directory and all things within it can be included
	in tarball.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-25 09:42:21 +02:00
Sinny Kumari
c95cdd611a Change parent directory for keeping extracted packages in abipkgdiff
Previously, abipkgdiff was extracting packages and its debuginfo into path
provided in TMPDIR environment variable if set, otherwise into
/tmp/ directory. In distro like Fedora, extracting packages into /tmp/
directory causes abipkgdiff to fail on packages with larger size.
This is because /tmp/ directory in Fedora is of type tmpfs and due to which
it consumes spaces from main memory. In addition, type information for packages
and its debuginfo to be compared  gets loaded into main memory. Overall,
extraction of packages in /tmp/ reduces free main memory which can be used
in other activities like loading type information for shared libraries to be
compared.

With this commit, by default temporary package extraction will occur in
$HOME/.cache/libabigail/ directory which uses space from hard disk.
Also, by setting XDG_CACHE_HOME environment variable, we can change default
package extraction location.

It also changes temporary directory name created inside parent directory
which is abipkgdiff-tmp-dir-XXXXXX instead of libabigail-tmp-dir-XXXXXX

	* tools/abipkgdiff.cc (extracted_packages_parent_dir): Change
	TMPDIR environment variable to XDG_CACHE_HOME and default
	temporary parent directory to $HOME/.cache/libabigail/

Signed-off-by: Sinny Kumari <sinny@redhat.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-24 16:59:02 +02:00
Dodji Seketeli
e19bf5627a Make abi{pkg}diff filter out changes about private types
This is to address the following enhancement requests:

    #19588 - Add a --headers-dir1 and --headers-dir2 option to abidiff
    #19948 - Add --devel-pkg1 and --devel-pkg2 options to abipkgdiff

When the user specifies where to find header files for two binaries
(or packages) being compared, this patch generates a type suppression
specification that filters out change reports about types that are
defined in files that are not in the set of header files specified.

The type suppression specification also suppresses change reports
about changed/added/removed virtual member functions which enclosing
class type matches the type suppression specification.

There is a corner case that the patch handles too, and that is
exhibited by the accompanying test case for abidiff.  There can be a
class defined by DWARF as having no source location and as being a
pure declaration.  This can be a class declaration that has inline
virtual members only, and one or several non-defined virtual methods
too.  When that declaration is included in a source file, GCC
generates debug info that describes that class as being a
declaration-only class with no source declaration.  This patch
considers such a class as being non defined; you know, like a true
opaque type.  So it's considered being not defined in any public
header file.  Changes to this kind of class are thus filtered out.

	* include/abg-comp-filter.h: Update copyright year.
	* src/abg-comp-filter.cc (has_virtual_mem_fn_change): Make this
	static function become exported.
	(has_virtual_mem_fn_change): Declare new function.
	* include/abg-suppression.h
	(suppression_base::{get,set}_is_artificial): Declare new
	accessors.
	(type_suppression::get_source_locations_to_keep): Return an
	unordered set of strings, not a vector.  Add a non-const overload.
	(type_suppression::set_source_locations_to_keep): Set an unordered
	set of strings, not a vector.
	* src/abg-suppression.cc (suppression_base::priv::is_artificial_):
	New data member.
	(suppression_base::priv::priv): Initialize the new data member.
	(suppression_base::{get,set}_is_artificial): Define new accessors.
	(type_suppression::priv::source_locations_to_keep_): Change the
	vector of strings representing source file names into unordered
	set of string.
	(type_suppression::get_source_locations_to_keep): Return an
	unordered set of strings, not a vector.  Define a non-const
	overload.
	(type_suppression::set_source_locations_to_keep): Set an unordered
	set of strings, not a vector.
	(type_suppression::suppresses_diff): Make this suppress virtual
	member function diffs if the enclosing type of the changed virtual
	member is suppressed by the current type_suppression.
	(read_type_suppression): Adjust to use the fact that the source
	locations are not stored in an unordered set, not in a vector
	anymore.  Otherwise, using a vector here make things too slow.
	(type_suppression::suppresses_type): Likewise.  Also, If the type
	we are looking at has no location because it's a true opaque type
	and if the current suppression is an artificial suppression that
	is meant to suppress change reports about non-public types, then
	suppress the type.
	* include/abg-tools-utils.h (gen_suppr_spec_from_headers): Declare
	new public function.
	* src/abg-tools-utils.cc (PRIVATE_TYPES_SUPPR_SPEC_NAME): Define a
	new constant variable.
	(handle_fts_entry): Define new static function.
	(gen_suppr_spec_from_headers): Define new public function.
	* src/abg-comparison.cc
	(corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars):
	If a type suppression suppresses a given class C, make it change
	added/removed virtual functions whose enclosing type is C.
	* tools/abidiff.cc (options::{headers_dir1, headers_dir2}): New
	data members.
	(display_usage): Add help strings for --headers-dir1 and
	--headers-dir2.
	(parse_command_line): Parse the new --headers-dir1 and
	--headers-dir2 options.
	(set_diff_context_from_opts): Generate suppression specifications
	to filter out changes on private types, if --headers-dir1 or
	--headers-dir2 is given.
	* tools/abipkgdiff.cc (options::{devel_package1, devel_package2}):
	New data members.
	(typedef package_sptr): New typedef.
	(enum package::kind): New enum.
	(package::kind_): New data member.  This replaces ...
	(package::is_debug_info_): ... this data member.
	(package::{devel_package_, private_types_suppressions_}): New data
	members.
	(package::package): Adjust.
	(package::get_kind): Define new member function.  This replaces
	...
	(package::is_debug_info): ... this member function overload.
	(package::set_kind): Define new member functin.  It replaces ...
	(package::is_debug_info): ... this member function overload.
	(package::{devel_package, private_types_suppressions}): Define new
	accessors.
	(package::erase_extraction_directies): Erase the sub-directory
	where development packages are extracted to.
	(compare_args::private_types_suppr{1,2}): New data members.
	(compare_args::compare_args): Adjust.
	(display_usage): Add help strings for --devel-pkg1/--devel-pkg2.
	(compare): Make the overload that compares elf files take private
	types suppressions.  Add the private types suppressions to the
	diff context.
	(pthread_routine_compare): Adjust the call to compare.
	(maybe_create_private_types_suppressions): Define new static
	function.
	(pthread_routine_extract_pkg_and_map_its_content): If a devel
	package was specified for the main package then extract it in
	parallel with the other package extraction.  When the extraction
	is done, create private types suppressions by visiting the
	directories that contain the header files.
	(compare): In the overload that compares packages by scheduling
	comparison of individual elf files that are in the packages, pass
	in the private type suppressions too.
	(parse_command_line): Parse the new --devel-pkg{1,2} command line
	options.
	(main): Associate the devel package to the main package, if the
	--devel-pkg{1,2}.
	* doc/manuals/abidiff.rst: Add documentation about the new
	--headers-dir1 and --headers-dir2 options.
	* doc/manuals/abipkgdiff.rst: Likewise, add documentation about
	the new --devel-pkg1 and --devel-pkg2 libraries.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
	New test reference output.
	* tests/data/test-diff-pkg/tbb-devel-4.1-9.20130314.fc22.x86_64.rpm:
	New test input package.
	* tests/data/test-diff-pkg/tbb-devel-4.3-3.20141204.fc23.x86_64.rpm: Likewise.
	* tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc
	(InOutSpec::{first,second}_in_devel_package_path): New data
	members.
	(in_out_specs): Adjust.  Also, add a new entry describing the new
	test inputs above.
	(test_task::perform): When the new test entry contains devel
	packages, pass them to abipkgdiff using the --devel1 and --devel2
	options.
	* tests/data/test-diff-suppr/test30-include-dir-v0/test30-pub-lib-v0.h:
	A new test input source code.
	* tests/data/test-diff-suppr/test30-include-dir-v1/test30-pub-lib-v1.h: Likewise.
	* tests/data/test-diff-suppr/test30-priv-lib-v0.cc: Likewise.
	* tests/data/test-diff-suppr/test30-priv-lib-v0.h: Likewise.
	* tests/data/test-diff-suppr/test30-priv-lib-v1.cc: Likewise.
	* tests/data/test-diff-suppr/test30-priv-lib-v1.h: Likewise.
	* tests/data/test-diff-suppr/test30-pub-lib-v0.cc: Likewise.
	* tests/data/test-diff-suppr/test30-pub-lib-v0.so: Add new test
	binary input.
	* tests/data/test-diff-suppr/test30-pub-lib-v1.cc: Add new test
	input source code.
	* tests/data/test-diff-suppr/test30-pub-lib-v1.so: Add new test
	binary input.
	* tests/data/test-diff-suppr/test30-report-0.txt: Add new test
	reference output.
	* tests/data/test-diff-suppr/test30-report-1.txt: Add new test
	reference output.
	* tests/test-diff-suppr.cc (InOutSpec::headers_dir{1,2}): New data
	members.
	(InOutSpec::abidiff_options): Renamed the bidiff_options data
	member into this.
	(in_out_specs): Adjust.  Also, added the new test input above to
	this.
	(main): Adjust to invoke abidiff with the new --hd1 and --hd2
	options if the input specs for the tests has the new
	InOutSpec::headers_dir{1,2} data member set.  Renamed bidiff into
	abidiff.
	* tests/data/Makefile.am: Add the new test inputs to the source
	distribution.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-24 10:32:08 +02:00
Dodji Seketeli
3f1d7c3976 Fix the number of removed functions in change report
Right now, the number of removed functions that is shown in the change
report is the total number of removed functions.

But it should be the *net* number of removed functions.  That is, the
total number of removed functions minus the number of removed
functions that were filtered out.

This patch fixes that.  A one liner.

	* src/abg-suppression.cc (corpus_diff::report): Show the net
	number of removed functions, not the total number of the removed
	functions.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2016-05-24 10:25:05 +02:00