libabigail/tests/test-diff-pkg.cc
Dodji Seketeli c32b8ec9f3 Bug 24690 - Support comparing non-reachable types of a binary
This patch adds the ability to compare all types of a binary,
including those types that are not reachable from global functions and
variables.

This implies that for types that are not reachable from public
interfaces, we want compare them against each others directly, without
first comparing global functions/variables and walking the graph of
reachable types from there.

The patch adds the --non-reachable-types option to abidiff and
abipkgdiff, instructing them to also compare types that are
non-reachable from global variables and functions.

Using that option, for instance, here is what the summary of
abipkgdiff now looks like, in the test case attached added by this
patch:

================ changes of 'libflatpak.so.0.10204.0'===============
  Functions changes summary: 0 Removed, 0 Changed (16 filtered out), 16 Added functions
  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
  Unreachable types summary: 3 removed (2 filtered out), 1 changed (15 filtered out), 3 added (1 filtered out) types

You can see that there is a new summary line which starts with the
string: "Unreachable types summary:"

Then in the body of the report, those unreachable types are reported
separately.

In practise, we want to limit the unreachable types to compare
somehow, otherwise we'll end up comparing all the types of the types
of the binary and that can be huge.  So we want to limit the
unreachable type analysis to types that are defined in public headers.

So, for abipkgdiff, one can limit the analysis of non-reachable types
to those defined in public headers by supplying the --devel{1,2}
options that specifies the development packages that contain said
public headers.  For abidiff however, you'll want to use the
--headers-dir{1,2} options for that.

The patch comes with appropriate regression tests.

	* include/abg-comparison.h (string_type_base_sptr_map): Define new
	typedef.
	(diff_context::show_unreachable_types): Declare new member
	functions.
	(corpus_diff::{deleted_unreachable_types,
	deleted_unreachable_types_sorted, added_unreachable_types,
	added_unreachable_types_sorted, changed_unreachable_types,
	changed_unreachable_types_sorted}): Likewise.
	(maybe_report_unreachable_type_changes): Declare this function a
	friend of class corpus_diff.
	(corpus_diff::diff_stats::{num_added_unreachable_types,
	num_added_unreachable_types_filtered_out,
	net_num_added_unreachable_types, num_removed_unreachable_types,
	num_removed_unreachable_types_filtered_out,
	net_num_removed_unreachable_types, num_changed_unreachable_types,
	num_changed_unreachable_types_filtered_out,
	net_num_changed_unreachable_types}): Likewise.
	* src/abg-comparison-priv.h
	(diff_context::priv::show_unreachable_types_): Define new data
	member.
	(diff_context::priv::priv): Initialize the new data member.
	(diff_comp::operator()): Use pretty representation of diff
	subjects to sort them, rather than just their name.  Also, add
	comment to the other member functions of diff_comp.
	(corpus_diff::{unreachable_types_edit_script_,
	deleted_unreachable_types_, deleted_unreachable_types_sorted_,
	suppressed_deleted_unreachable_types_, added_unreachable_types_,
	added_unreachable_types_sorted_,
	suppressed_added_unreachable_types_, changed_unreachable_types_,
	changed_unreachable_types_sorted_}): Define new data members.
	(corpus_diff::priv::apply_supprs_to_added_removed_fns_vars_unreachable_types):
	Changed the name of
	corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars into
	this.
	(corpus_diff::priv::{added_unreachable_type_is_suppressed,
	deleted_unreachable_type_is_suppressed,
	changed_unreachable_types_sorted, count_unreachable_types}):
	Declare new member functions.
	(corpus_diff::diff_stats::priv::{num_added_unreachable_types,
	num_added_unreachable_types_filtered_out,
	num_removed_unreachable_types,
	num_removed_unreachable_types_filtered_out,
	num_changed_unreachable_types,
	num_changed_unreachable_types_filtered_out}): Define new data
	members.
	(sort_string_type_base_sptr_map): Declare new function.
	* src/abg-comparison.cc (sort_string_type_base_sptr_map)
	(diff_context::show_unreachable_types): Define new functions.
	(corpus_diff::diff_stats::{num_added_unreachable_types,
	num_added_unreachable_types_filtered_out,
	net_num_added_unreachable_types,
	net_num_removed_unreachable_types,
	num_removed_unreachable_types_filtered_out,
	num_removed_unreachable_types}): Define new member functions.
	(diff_maps::insert_diff_node): Do not update the map "diff ->
	impacted interfaces" if the current impacted interface is nil.
	This happens if we are looking at a diff node for a change on a
	type that is not reachable from any interfaces.
	(corpus_diff::priv::ensure_lookup_tables_populated): Handle the
	edit script for unreachable types.
	(corpus_diff::priv::apply_supprs_to_added_removed_fns_vars_unreachable_types):
	Rename
	corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars
	into this.  Apply suppression specifications to added and removed
	unreachable types as well.
	(corpus_diff::priv::{added,deleted}_unreachable_type_is_suppressed):
	Define new member functions.
	(corpus_diff::priv::{count_unreachable_types,
	changed_unreachable_types_sorted}): Likewise.
	(corpus_diff::priv::apply_filters_and_compute_diff_stats): Update
	statistics (including walking changed unreachable types to apply
	categorization and redundancy filters to them) related to
	unreachable types.
	(corpus_diff::priv::emit_diff_stats): Emit diff stats related to
	unreachable types.
	(corpus_diff::priv::maybe_dump_diff_tree): Dump diff tree nodes
	related to unreachable types.
	(corpus_diff::{deleted_unreachable_types,
	deleted_unreachable_types_sorted, added_unreachable_types,
	added_unreachable_types_sorted, changed_unreachable_types,
	changed_unreachable_types_sorted): Define new member functions.
	(corpus_diff::has_changes): Take deleted/added/changed unreachable
	types into account.
	(corpus_diff::has_incompatible_changes): Take net removed/changed
	unreachable types into account.
	(corpus_diff::has_net_subtype_changes): Take net removed and
	changed unreachable types into account.
	(corpus_diff::has_net_changes): Take net removed/added/changed
	unreachable types into account.
	(corpus_diff::traverse): When traversing the components of a
	corpus_diff node, make sure to traverse the changed unreachable
	types of the corpus.
	(leaf_diff_node_marker_visitor::visit_begin): Arrange for the fact
	that the current topmost interface can be nil if we are looking at
	types not reachable from global functions/variables.  Also, make
	sure that only leaf nodes that are reachable from a global
	function/variable are recorded as leaf nodes.
	(compute_diff): In the overload for corpus_sptr, compute the
	changes between types not reachable from global functions and
	variables, if the user wishes that we do so.  Also, add more
	comments.
	(apply_suppressions): Update for the name change of the function
	apply_suppressions_to_added_removed_fns_vars to
	apply_supprs_to_added_removed_fns_vars_unreachable_types.
	* include/abg-corpus.h
	(corpus::{record_type_as_reachable_from_public_interfaces,
	type_is_reachable_from_public_interfaces,
	get_types_not_reachable_from_public_interfaces}): Declare new
	member functions.
	(corpus::recording_types_reachable_from_public_interface_supported):
	Declare new virtual member function.
	(corpus_group::get_public_types_pretty_representations): Declare
	new member functons.
	(corpus_group::recording_types_reachable_from_public_interface_supported):
	Declare new virtual member function.
	* src/abg-corpus-priv.h
	(corpus::priv::{types_not_reachable_from_pub_ifaces_,
	pub_type_pretty_reprs_}): Define new data members.
	(corpus::priv::priv): Initialize the pub_type_pretty_reprs_ data
	member because it's a pointer.
	(corpus::priv::get_public_types_pretty_representations): Declare
	new member function.
	(corpus::priv::~priv): Declare a destructor.
	* src/abg-corpus.cc
	(corpus::priv::get_public_types_pretty_representations): Define
	new member function.
	(corpus::priv::~priv): Define new destructor to delete the new
	pub_type_pretty_reprs_ member pointer.
	(corpus::{record_type_as_reachable_from_public_interfaces,
	type_is_reachable_from_public_interfaces,
	get_types_not_reachable_from_public_interfaces,
	recording_types_reachable_from_public_interface_supported}):
	Define new member functions
	(corpus_group::get_public_types_pretty_representations): Likewise.
	* include/abg-diff-utils.h (struct deep_ptr_eq_functor): Document
	the equality operator.  Also, add an overload to the equality
	operator, for weak_ptr<T>.  The existing equality operator
	overload was just for shared_ptr<T>.
	* include/abg-fwd.h (is_user_defined_type): Declare function.
	* include/abg-ir.h (operator!=(const decl_base_sptr&, const
	decl_base_sptr&)): Declare new operator.
	(type_maps::get_types_sorted_by_name): Declare
	new member function.
	(decl_base::{g,s}et_is_artificial): Declare new member function.
	(function_decl::parameter::{g,s}et_artificial): Remove these
	member functions.
	* src/abg-ir.cc (operator!=(const decl_base_sptr&, const
	decl_base_sptr&)): Define new operator.
	(decl_base::priv::is_artificial_): Define new data
	member.
	(type_maps::priv::sorted_types_): Define new data member.
	(struct type_name_comp): Define new comparison functor to sort
	types based on their pretty representations.
	(decl_base::priv::priv): Initialize it.
	(decl_base::{g,s}et_is_artificial): Define new member functions.
	(type_maps::get_types_sorted_by_name): Define new member function.
	(is_user_defined_type): Define new function overloads.
	(strip_typedef, function_type::{function_type, set_parameters}):
	Adjust using decl_base::get_is_artificial rather than
	function_decl::parameter::get_artificial.
	(function_decl::parameter::priv::artificial_): Remove this data
	member.
	(function_decl::parameter::priv::priv): Adjust to the removal of
	function_decl::parameter::priv::artificial_.  This constructor
	does not take an "is_artificial" flag anymore.
	(function_decl::parameter::parameter): Adjust to the removal of
	the is_artificial flag from the arguments of the constructor of
	function_decl::parameter::parameter::priv.
	(function_decl::parameter::get_artificial): Remove this member
	function.
	* src/abg-reporter-priv.h (maybe_report_unreachable_type_changes):
	Declare new function.
	* src/abg-reporter-priv.cc
	(maybe_report_unreachable_type_changes): Define new function.
	* src/abg-default-reporter.cc (default_reporter::report): In the
	overload for corpus_diff&, report added/removed/changed types that
	are not reachable from global functions and variables using the
	new function maybe_report_unreachable_type_changes.
	* src/abg-leaf-reporter.cc (leaf_reporter::report): In the
	overload for corpus_diff, report changes to types unreachable from
	global functions or variables, using the new function
	maybe_report_unreachable_type_changes.
	* src/abg-dwarf-reader.cc (build_ir_node_from_die): When the user
	requests that all types be loaded, record relevant types as
	reachable from global functions and variables.
	(build_enum_type, add_or_update_class_type)
	(add_or_update_union_type): Read the 'is-artificial' DWARF
	attribute and set the corresponding decl_base property
	accordingly.
	(finish_member_function_reading, strip_typedef)
	(function_type::function_type): Adjust using
	decl_base::get_is_artificial, rather than
	function_decl::parameter::get_artificial.
	* include/abg-reader.h
	(consider_types_not_reachable_from_public_interfaces): Declare new
	function.
	* src/abg-reader.cc
	(read_context::m_tracking_non_reachable_types): Add new data
	member.
	(read_context::read_context): Initialize it.
	(read_context::tracking_non_reachable_types): Define accessors for
	the new data member above.
	(read_is_declaration_only): Re-indent.
	(read_is_artificial): Define new helper function.
	(build_function_parameter): Use the new read_is_artificial
	function here, rather than open-coding it.
	(build_enum_type_decl, build_class_decl, build_union_decl):
	Support reading the 'is-artificial' property by using the new
	read_is_artificial function.
	(read_corpus_from_input): If the user wants us to take
	non-reachable types into account, then make sure we do so.
	(read_tracking_non_reachable_types, read_is_non_reachable_type):
	Define new static functions.
	(handle_element_node, build_type): Read the "is-non-reachable"
	attribute on type element nodes if the user wants us to track
	non-reachable types.
	(consider_types_not_reachable_from_public_interfaces): Define new
	function.
	* src/abg-writer.cc (write_is_artificial): Define new static
	helper function.
	(annotate): Adjust using decl_base::get_is_artificial rather than
	function_decl::parameter::get_artificial.
	(write_enum_type_decl, write_class_decl_opening_tag)
	(write_union_decl_opening_tag): Support writing the
	"is-artificial" property, using the new write_is_artificial
	function.
	(write_function_type): Adjust this to use the new
	write_is_artificial rather than open-coding writing the
	'is-artificial' attribute.
	(write_is_non_reachable)
	(write_tracking_non_reachable_types): Define new static functions.
	(write_enum_type_decl, write_class_decl_opening_tag)
	(write_union_decl_opening_tag): Write the 'is-no-reachable'
	attribute when applicable.
	(write_corpus, write_corpus_group): Write the
	'tracking-non-reachable-types' attribute when applicable.
	* tools/abidiff.cc (options::options): Initialize ...
	(options::show_all_types): ... new data member.
	(display_usage): Add help string from the new
	--non-reachable-types option.
	(parse_command_line): Parse the new --non-reachable-types option.
	(set_diff_context_from_opts): Set the
	dwarf_reader::read_context::show_unreachable_types property.
	(set_native_xml_reader_options): Define new
	static function.
	(main): Load all types when analyzing the DWARF or the ABIXML
	files, if the user wants us to do so.
	* tools/abipkgdiff.cc (options::show_all_types): Define new data
	member.
	(options::options): Initialize it.
	(parse_command_line): Parse the --non-reachable-types option to
	set the options::show_all_types data member.
	(display_usage): Add a help string for the new
	--non-reachable-types option.
	(set_diff_context_from_opts): Set the
	dwarf_reader::read_context::show_unreachable_types property based
	on the options::show_all_type data member.
	(compare): Configure the read context to load all types while
	analyzing the DWARF info, depending on the options::show_all_type
	data member.
	* doc/manuals/abidiff.rst: Document the new --non-reachable-types
	option added to abidiff above.
	* doc/manuals/abipkgdiff.rst: Add documentation for the
	--non-reachable-types option.
	* tests/data/test-diff-suppr/test47-non-reachable-types-v{0,1}.c:
	Source code files of test binary input.
	* tests/data/test-diff-suppr/test47-non-reachable-types-suppr-{1,2,3,4,5}.txt:
	New test input files.
	* tests/data/test-diff-suppr/test47-non-reachable-types-report-{1,2,3,4,5,6,7,8,9,10}.txt:
	New test reference output files.
	* tests/data/test-diff-suppr/test47-non-reachable-types-v{0,1}.o.alltypes.abixml:
	New test input abixml.
	* tests/data/Makefile.am: Add the new test material to source
	distribution.
	* tests/test-diff-suppr.cc (in_out_specs): Add the new tests above
	to this test harness.
	* tests/data/test-abidiff/test-struct1-report.txt: Adjust.
	* tests/data/test-diff-pkg/PR24690/flatpak-debuginfo-1.2.4-3.fc30.x86_64.rpm:
	New input binary RPM.
	* tests/data/test-diff-pkg/PR24690/flatpak-debuginfo-1.4.0-1.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/flatpak-devel-1.2.4-3.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/flatpak-devel-1.4.0-1.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/flatpak-libs-1.2.4-3.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/flatpak-libs-1.4.0-1.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/flatpak-libs-debuginfo-1.2.4-3.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/flatpak-libs-debuginfo-1.4.0-1.fc30.x86_64.rpm:
	Likewise.
	* tests/data/test-diff-pkg/PR24690/PR24690-report-0.txt: New test
	reference output.
	* tests/data/Makefile.am: Add the new test material above to
	source distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the new test material
	above to this test harness.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2020-01-06 14:26:00 +01:00

851 lines
30 KiB
C++

// -*- Mode: C++ -*-
//
// Copyright (C) 2013-2019 Red Hat, Inc.
//
// This file is part of the GNU Application Binary Interface Generic
// Analysis and Instrumentation Library (libabigail). This library is
// free software; you can redistribute it and/or modify it under the
// terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3, or (at your option) any
// later version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details.
// You should have received a copy of the GNU Lesser General Public
// License along with this program; see the file COPYING-LGPLV3. If
// not, see <http://www.gnu.org/licenses/>.
// Author: Sinny Kumari
/// @file
///
/// This test harness program computes the ABI changes between ELF
/// binaries present inside input packages. Some of the input
/// packages have debuginfo, some don't. The resulting ABI change
/// report is then compared with a reference one.
///
/// The set of input files and reference reports to consider should be
/// present in the source distribution, which means they must be
/// referenced in tests/data/Makefile.am by the EXTRA_DIST variable.
// For package configuration macros.
#include "config.h"
#include <sys/wait.h>
#include <cassert>
#include <cstring>
#include <string>
#include <cstdlib>
#include <iostream>
#include <vector>
#include "abg-workers.h"
#include "test-utils.h"
#include "abg-tools-utils.h"
using std::string;
using std::vector;
using std::cerr;
using abigail::tests::get_src_dir;
using abigail::tools_utils::split_string;
struct InOutSpec
{
const char* first_in_package_path;
const char* second_in_package_path;
const char* prog_options;
const char* suppression_path;
const char* first_in_debug_package_path;
const char* second_in_debug_package_path;
const char* first_in_devel_package_path;
const char* second_in_devel_package_path;
const char* ref_report_path;
const char* out_report_path;
};// end struct InOutSpec
static InOutSpec in_out_specs[] =
{
// dir1 contains a suppr spec - it should be ignored.
{
"data/test-diff-pkg/dirpkg-0-dir1",
"data/test-diff-pkg/dirpkg-0-dir2",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/dirpkg-0-report-0.txt",
"output/test-diff-pkg/dirpkg-0-report-0.txt"
},
// dir2 contains a suppr spec - it should be recognized.
{
"data/test-diff-pkg/dirpkg-1-dir1",
"data/test-diff-pkg/dirpkg-1-dir2",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/dirpkg-1-report-0.txt",
"output/test-diff-pkg/dirpkg-1-report-0.txt"
},
// dir2 contains a suppr spec but --no-abignore is specified,
// the file should be ignored.
{
"data/test-diff-pkg/dirpkg-1-dir1",
"data/test-diff-pkg/dirpkg-1-dir2",
"--no-default-suppression --no-abignore --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/dirpkg-1-report-1.txt",
"output/test-diff-pkg/dirpkg-1-report-1.txt"
},
// dir2 contains several suppr spec files, ".abignore" and
// "dir.abignore", so the specs should be merged.
{
"data/test-diff-pkg/dirpkg-2-dir1",
"data/test-diff-pkg/dirpkg-2-dir2",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/dirpkg-2-report-0.txt",
"output/test-diff-pkg/dirpkg-2-report-0.txt"
},
// dir2 contains a suppr spec file, ".abignore" and
// an additional suppr file is specified on the command line,
// so the specs should be merged.
{
"data/test-diff-pkg/dirpkg-3-dir1",
"data/test-diff-pkg/dirpkg-3-dir2",
"--no-default-suppression --no-show-locs",
"data/test-diff-pkg/dirpkg-3.suppr",
"",
"",
"",
"",
"data/test-diff-pkg/dirpkg-3-report-0.txt",
"output/test-diff-pkg/dirpkg-3-report-0.txt"
},
// dir2 contains a suppr spec file, ".abignore", which should
// be ignored because of the program options and
// an additional suppr file is specified on the command line,
// which should be recognized.
{
"data/test-diff-pkg/dirpkg-3-dir1",
"data/test-diff-pkg/dirpkg-3-dir2",
"--no-default-suppression --no-show-locs --no-abignore",
"data/test-diff-pkg/dirpkg-3.suppr",
"",
"",
"",
"",
"data/test-diff-pkg/dirpkg-3-report-1.txt",
"output/test-diff-pkg/dirpkg-3-report-1.txt"
},
{ // Just like the previous tests, but loc info is emitted.
"data/test-diff-pkg/dirpkg-3-dir1",
"data/test-diff-pkg/dirpkg-3-dir2",
"--no-default-suppression --no-abignore",
"data/test-diff-pkg/dirpkg-3.suppr",
"",
"",
"",
"",
"data/test-diff-pkg/dirpkg-3-report-2.txt",
"output/test-diff-pkg/dirpkg-3-report-2.txt"
},
{
"data/test-diff-pkg/symlink-dir-test1/dir1/symlinks",
"data/test-diff-pkg/symlink-dir-test1/dir2/symlinks",
"--no-default-suppression ",
"",
"",
"",
"",
"",
"data/test-diff-pkg/symlink-dir-test1-report0.txt ",
"output/test-diff-pkg/symlink-dir-test1-report0.txt "
},
#if WITH_TAR
{
"data/test-diff-pkg/tarpkg-0-dir1.tar",
"data/test-diff-pkg/tarpkg-0-dir2.tar",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/tarpkg-0-report-0.txt",
"output/test-diff-pkg/tarpkg-0-report-0.txt"
},
{
"data/test-diff-pkg/tarpkg-0-dir1.ta",
"data/test-diff-pkg/tarpkg-0-dir2.ta",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/tarpkg-0-report-0.txt",
"output/test-diff-pkg/tarpkg-0-report-01.txt"
},
{
"data/test-diff-pkg/tarpkg-0-dir1.tar.gz",
"data/test-diff-pkg/tarpkg-0-dir2.tar.gz",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/tarpkg-0-report-0.txt",
"output/test-diff-pkg/tarpkg-0-report-02.txt"
},
{
"data/test-diff-pkg/tarpkg-0-dir1.tar.bz2",
"data/test-diff-pkg/tarpkg-0-dir2.tar.bz2",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/tarpkg-0-report-0.txt",
"output/test-diff-pkg/tarpkg-0-report-03.txt"
},
{
"data/test-diff-pkg/tarpkg-1-dir1.tar.gz",
"data/test-diff-pkg/tarpkg-1-dir2.tar.gz",
"--no-default-suppression --dso-only",
"",
"",
"",
"",
"",
"data/test-diff-pkg/tarpkg-1-report-0.txt",
"output/test-diff-pkg/tarpkg-1-report-0.txt"
},
#endif //WITH_TAR
#ifdef WITH_RPM
// Two RPM packages with debuginfo available and have ABI changes
{
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm",
"--no-default-suppression --private-dso --no-show-locs",
"",
"data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm",
"",
"",
"data/test-diff-pkg/test-rpm-report-0.txt",
"output/test-diff-pkg/test-rpm-report-0.txt"
},
// Two RPM packages with 2nd package debuginfo missing
{
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm",
"--no-default-suppression --private-dso --no-show-locs",
"",
"data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm",
"",
"",
"",
"data/test-diff-pkg/test-rpm-report-1.txt",
"output/test-diff-pkg/test-rpm-report-1.txt"
},
// Two RPM packages with first package debuginfo missing
{
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm",
"--no-default-suppression --private-dso --no-show-locs",
"",
"",
"data/test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm",
"",
"",
"data/test-diff-pkg/test-rpm-report-2.txt",
"output/test-diff-pkg/test-rpm-report-2.txt"
},
// Two RPM packages with missing debuginfo
{
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm",
"--no-default-suppression --no-show-locs",
"",
"",
"",
"",
"",
"data/test-diff-pkg/test-rpm-report-3.txt",
"output/test-diff-pkg/test-rpm-report-3.txt"
},
// Two RPM packages with no ABI change
{
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"--no-default-suppression --no-show-locs",
"",
"data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm",
"",
"",
"data/test-diff-pkg/test-rpm-report-4.txt",
"output/test-diff-pkg/test-rpm-report-4.txt"
},
// Two RPM packages with debuginfo available and we don't want to
// see added symbols.
{
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm",
"--no-default-suppression --no-show-locs --no-added-syms",
"",
"data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm",
"",
"",
"data/test-diff-pkg/test-rpm-report-5.txt",
"output/test-diff-pkg/test-rpm-report-5.txt"
},
{
"data/test-diff-pkg/qemu-img-rhev-2.3.0-7.el7.ppc64.rpm",
"data/test-diff-pkg/qemu-img-rhev-2.3.0-20.el7.ppc64.rpm",
"--no-default-suppression --no-show-locs --no-added-syms",
"",
"data/test-diff-pkg/qemu-kvm-rhev-debuginfo-2.3.0-7.el7.ppc64.rpm",
"data/test-diff-pkg/qemu-kvm-rhev-debuginfo-2.3.0-20.el7.ppc64.rpm",
"",
"",
"data/test-diff-pkg/qemu-img-rhev-2.3.0-7.el7.ppc64--qemu-img-rhev-2.3.0-20.el7.ppc64-report-0.txt",
"output/test-diff-pkg/qemu-img-rhev-2.3.0-7.el7.ppc64--qemu-img-rhev-2.3.0-20.el7.ppc64-report-0.txt"
},
{
"data/test-diff-pkg/empty-pkg-libvirt-0.9.11.3-1.el7.ppc64.rpm",
"data/test-diff-pkg/empty-pkg-libvirt-1.2.17-13.el7_2.2.ppc64.rpm",
"",
"",
"",
"",
"",
"",
"data/test-diff-pkg/empty-pkg-report-0.txt",
"output/test-diff-pkg/empty-pkg-report-0.txt"
},
{
"data/test-diff-pkg/gmp-4.3.1-7.el6_2.2.ppc64.rpm",
"data/test-diff-pkg/gmp-4.3.1-10.el6.ppc64.rpm",
"",
"",
"data/test-diff-pkg/gmp-debuginfo-4.3.1-7.el6_2.2.ppc64.rpm",
"data/test-diff-pkg/gmp-debuginfo-4.3.1-10.el6.ppc64.rpm",
"",
"",
"data/test-diff-pkg/gmp-4.3.1-7.el6_2.2.ppc64--gmp-4.3.1-10.el6.ppc64-report-0.txt",
"output/test-diff-pkg/gmp-4.3.1-7.el6_2.2.ppc64--gmp-4.3.1-10.el6.ppc64-report-0.txt"
},
{
"data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64.rpm",
"data/test-diff-pkg/tbb-4.3-3.20141204.fc23.x86_64.rpm",
"--no-default-suppression",
"",
"data/test-diff-pkg/tbb-debuginfo-4.1-9.20130314.fc22.x86_64.rpm",
"data/test-diff-pkg/tbb-debuginfo-4.3-3.20141204.fc23.x86_64.rpm",
"",
"",
"data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt",
"output/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt"
},
{
"data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64.rpm",
"data/test-diff-pkg/tbb-4.3-3.20141204.fc23.x86_64.rpm",
"--no-default-suppression",
"",
"data/test-diff-pkg/tbb-debuginfo-4.1-9.20130314.fc22.x86_64.rpm",
"data/test-diff-pkg/tbb-debuginfo-4.3-3.20141204.fc23.x86_64.rpm",
"data/test-diff-pkg/tbb-devel-4.1-9.20130314.fc22.x86_64.rpm",
"data/test-diff-pkg/tbb-devel-4.3-3.20141204.fc23.x86_64.rpm",
"data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt",
"output/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt"
},
{
"data/test-diff-pkg/tbb-2017-8.20161128.fc26.x86_64.rpm",
"data/test-diff-pkg/tbb-2017-9.20170118.fc27.x86_64.rpm",
"--no-default-suppression",
"",
"data/test-diff-pkg/tbb-debuginfo-2017-8.20161128.fc26.x86_64.rpm",
"data/test-diff-pkg/tbb-debuginfo-2017-9.20170118.fc27.x86_64.rpm",
"",
"",
"data/test-diff-pkg/tbb-2017-8.20161128.fc26.x86_64--tbb-2017-9.20170118.fc27.x86_64.txt",
"output/test-diff-pkg/tbb-2017-8.20161128.fc26.x86_64--tbb-2017-9.20170118.fc27.x86_64.txt"
},
{
"data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm",
"data/test-diff-pkg/libICE-1.0.9-2.el7.x86_64.rpm",
"--no-default-suppression",
"",
"data/test-diff-pkg/libICE-debuginfo-1.0.6-1.el6.x86_64.rpm",
"data/test-diff-pkg/libICE-debuginfo-1.0.9-2.el7.x86_64.rpm",
"",
"",
"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",
"output/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt"
},
{
"data/test-diff-pkg/gtk2-immodule-xim-2.24.22-5.el7.i686.rpm",
"data/test-diff-pkg/gtk2-immodule-xim-2.24.28-8.el7.i686.rpm",
"--no-default-suppression",
"",
"data/test-diff-pkg/gtk2-debuginfo-2.24.22-5.el7.i686.rpm",
"data/test-diff-pkg/gtk2-debuginfo-2.24.28-8.el7.i686.rpm",
"",
"",
"data/test-diff-pkg/gtk2-immodule-xim-2.24.22-5.el7.i686--gtk2-immodule-xim-2.24.28-8.el7.i686-report-0.txt",
"output/test-diff-pkg/gtk2-immodule-xim-2.24.22-5.el7.i686--gtk2-immodule-xim-2.24.28-8.el7.i686-report-0.txt"
},
{
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm",
"--no-default-suppression --show-identical-binaries",
"",
"data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm",
"",
"",
"data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt",
"output/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt"
},
{
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm",
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.armv7hl.rpm",
"--no-default-suppression",
"",
"",
"",
"",
"",
"data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64--dbus-glib-0.104-3.fc23.armv7hl-report-0.txt",
"output/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64--dbus-glib-0.104-3.fc23.armv7hl-report-0.txt"
},
{
"data/test-diff-pkg/nonexistent-0.rpm",
"data/test-diff-pkg/nonexistent-1.rpm",
"--no-default-suppression --private-dso",
"",
"",
"",
"",
"",
"data/test-diff-pkg/test-nonexistent-report-0.txt",
"output/test-diff-pkg/test-nonexistent-report-0.txt"
},
{
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm",
"--no-default-suppression",
"",
"data/test-diff-pkg/spice-debuginfo-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-debuginfo-0.12.8-1.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-devel-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-devel-0.12.8-1.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt",
"output/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt"
},
{
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm",
"--no-default-suppression --redundant",
"",
"data/test-diff-pkg/spice-debuginfo-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-debuginfo-0.12.8-1.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-devel-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-devel-0.12.8-1.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-1.txt",
"output/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-1.txt"
},
{
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm",
"--no-default-suppression --redundant",
"",
"data/test-diff-pkg/spice-debuginfo-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-debuginfo-0.12.8-1.el7.x86_64.rpm",
"",
"",
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt",
"output/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt"
},
{
"data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64.rpm",
"data/test-diff-pkg/libcdio-0.94-2.fc26.x86_64.rpm",
"--no-default-suppression --redundant",
"",
"data/test-diff-pkg/libcdio-debuginfo-0.94-1.fc26.x86_64.rpm",
"data/test-diff-pkg/libcdio-debuginfo-0.94-2.fc26.x86_64.rpm",
"",
"",
"data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt",
"output/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt"
},
{
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm",
"--no-default-suppression --leaf-changes-only --impacted-interfaces",
"",
"data/test-diff-pkg/spice-debuginfo-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-debuginfo-0.12.8-1.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-devel-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-devel-0.12.4-19.el7.x86_64.rpm",
"data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt",
"output/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt"
},
{
"data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm",
"data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm",
"data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm",
"",
"",
"data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt",
"output/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt"
},
{
"data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm",
"data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm "
"data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm",
"data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm "
"data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm",
"",
"",
"data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt",
"output/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt"
},
{
"data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64.rpm",
"data/test-diff-pkg/elfutils-libs-0.171-1.el7.x86_64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/elfutils-debuginfo-0.170-4.el7.x86_64.rpm",
"data/test-diff-pkg/elfutils-debuginfo-0.171-1.el7.x86_64.rpm",
"data/test-diff-pkg/elfutils-devel-0.170-4.el7.x86_64.rpm",
"data/test-diff-pkg/elfutils-devel-0.171-1.el7.x86_64.rpm",
"data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64-multiple-sym-vers-report-0.txt",
"output/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64-multiple-sym-vers-report-0.txt"
},
{
"data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64.rpm",
"data/test-diff-pkg/nss-3.24.0-1.0.fc23.x86_64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/nss-debuginfo-3.23.0-1.0.fc23.x86_64.rpm",
"data/test-diff-pkg/nss-debuginfo-3.24.0-1.0.fc23.x86_64.rpm",
"data/test-diff-pkg/nss-devel-3.23.0-1.0.fc23.x86_64.rpm",
"data/test-diff-pkg/nss-devel-3.24.0-1.0.fc23.x86_64.rpm",
"data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt",
"output/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt"
},
{
"data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64.rpm",
"data/test-diff-pkg/GtkAda-gl-2.24.2-30.fc30.x86_64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/GtkAda-debuginfo-2.24.2-29.fc29.x86_64.rpm, "
"data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-29.fc29.x86_64.rpm",
"data/test-diff-pkg/GtkAda-debuginfo-2.24.2-30.fc30.x86_64.rpm, "
"data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-30.fc30.x86_64.rpm",
"data/test-diff-pkg/GtkAda-devel-2.24.2-29.fc29.x86_64.rpm",
"data/test-diff-pkg/GtkAda-devel-2.24.2-30.fc30.x86_64.rpm",
"data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt",
"output/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt"
},
{
"data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-11.fc30.x86_64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-10.fc29.x86_64.rpm,"
"data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-10.fc29.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-11.fc30.x86_64.rpm,"
"data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-11.fc30.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-10.fc29.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-11.fc30.x86_64.rpm",
"data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt",
"output/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt"
},
{
"data/test-diff-pkg/PR24410-old/poppler-qt5-0.73.0-4.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24410-new/poppler-qt5-0.73.0-8.fc30.x86_64.rpm",
"--fail-no-dbg",
"",
"data/test-diff-pkg/PR24410-old/poppler-debuginfo-0.73.0-4.fc30.x86_64.rpm, "
"data/test-diff-pkg/PR24410-old/poppler-qt5-debuginfo-0.73.0-4.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24410-new/poppler-debuginfo-0.73.0-8.fc30.x86_64.rpm, "
"data/test-diff-pkg/PR24410-new/poppler-qt5-debuginfo-0.73.0-8.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24410-old/poppler-qt5-devel-0.73.0-4.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24410-new/poppler-qt5-devel-0.73.0-8.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24410-report-0.txt",
"output/test-diff-pkg/PR24410-report-0.txt"
},
{
"data/test-diff-pkg/PR24690/flatpak-libs-1.2.4-3.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24690/flatpak-libs-1.4.0-1.fc30.x86_64.rpm",
"--non-reachable-types",
"",
"data/test-diff-pkg/PR24690/flatpak-debuginfo-1.2.4-3.fc30.x86_64.rpm, "
"data/test-diff-pkg/PR24690/flatpak-libs-debuginfo-1.2.4-3.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24690/flatpak-debuginfo-1.4.0-1.fc30.x86_64.rpm, "
"data/test-diff-pkg/PR24690/flatpak-libs-debuginfo-1.4.0-1.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24690/flatpak-devel-1.2.4-3.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24690/flatpak-devel-1.4.0-1.fc30.x86_64.rpm",
"data/test-diff-pkg/PR24690/PR24690-report-0.txt",
"output/test-diff-pkg/PR24690/PR24690-report-0.txt"
},
#endif //WITH_RPM
#ifdef WITH_DEB
// Two debian packages.
{
"data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64.deb",
"data/test-diff-pkg/libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64.deb",
"--no-default-suppression --no-show-locs --fail-no-dbg",
"",
"data/test-diff-pkg/libsigc++-2.0-0c2a-dbgsym_2.4.0-1_amd64.ddeb",
"data/test-diff-pkg/libsigc++-2.0-0v5-dbgsym_2.4.1-1ubuntu2_amd64.ddeb",
"",
"",
"data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt",
"output/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt"
},
#endif // WITH_DEB
// This should be the last entry.
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
/// A task which launches abipkgdiff on the binaries passed to the
/// constructor of the task. The test also launches gnu diff on the
/// result of abipkdiff to compare it against a reference abipkgdiff
/// result.
struct test_task : public abigail::workers::task
{
InOutSpec spec;
bool is_ok;
string diff_cmd;
string error_message;
test_task(const InOutSpec& s)
: spec(s),
is_ok(true)
{}
/// This virtual function overload actually performs the job of the
/// task.
///
/// It actually launches abipkgdiff on the binaries passed to the
/// constructor of the task. It also launches gnu diff on the
/// result of the abidiff to compare it against a reference abidiff
/// result.
virtual void
perform()
{
using abigail::tests::get_build_dir;
using abigail::tools_utils::ensure_parent_dir_created;
string first_in_package_path, second_in_package_path,
prog_options,
ref_abi_diff_report_path, out_abi_diff_report_path, cmd, abipkgdiff,
first_in_devel_package_path, second_in_devel_package_path,
suppression_path;
vector<string> first_in_debug_package_paths, second_in_debug_package_paths;
first_in_package_path =
string(get_src_dir()) + "/tests/" + spec.first_in_package_path;
second_in_package_path =
string(get_src_dir()) + "/tests/" + spec.second_in_package_path;
prog_options = spec.prog_options;
if (spec.first_in_debug_package_path
&& strcmp(spec.first_in_debug_package_path, ""))
{
vector<string> debug_info_pkg_paths;
split_string(spec.first_in_debug_package_path, ", ",
debug_info_pkg_paths);
ABG_ASSERT(!debug_info_pkg_paths.empty());
for (vector<string>::const_iterator s = debug_info_pkg_paths.begin();
s != debug_info_pkg_paths.end();
++s)
first_in_debug_package_paths.push_back(string(get_src_dir()) +
"/tests/" + *s);
}
else
first_in_debug_package_paths.clear();
if (spec.second_in_debug_package_path
&& strcmp(spec.second_in_debug_package_path, ""))
{
vector<string> debug_info_pkg_paths;
split_string(spec.second_in_debug_package_path,
", ",
debug_info_pkg_paths);
ABG_ASSERT(!debug_info_pkg_paths.empty());
for (vector<string>::const_iterator s = debug_info_pkg_paths.begin();
s != debug_info_pkg_paths.end();
++s)
second_in_debug_package_paths.push_back(string(get_src_dir()) +
"/tests/" + *s);
}
else
second_in_debug_package_paths.clear();
if (spec.first_in_devel_package_path
&& strcmp(spec.first_in_devel_package_path, ""))
first_in_devel_package_path =
string(get_src_dir()) + "/tests/" + spec.first_in_devel_package_path;
if (spec.second_in_devel_package_path
&& strcmp(spec.second_in_devel_package_path, ""))
second_in_devel_package_path =
string(get_src_dir()) + "/tests/" + spec.second_in_devel_package_path;
if (spec.suppression_path
&& strcmp(spec.suppression_path, ""))
suppression_path =
string(get_src_dir()) + "/tests/" + spec.suppression_path;
else
suppression_path.clear();
ref_abi_diff_report_path =
string(get_src_dir()) + "/tests/" + spec.ref_report_path;
out_abi_diff_report_path =
string(get_build_dir()) + "/tests/" + spec.out_report_path;
if (!ensure_parent_dir_created(out_abi_diff_report_path))
{
cerr << "could not create parent directory for "
<< out_abi_diff_report_path;
is_ok = false;
return;
}
abipkgdiff = string(get_build_dir()) + "/tools/abipkgdiff";
if (!prog_options.empty())
abipkgdiff += " " + prog_options;
for (vector<string>::const_iterator p =
first_in_debug_package_paths.begin();
p != first_in_debug_package_paths.end();
++p)
abipkgdiff += " --d1 " + *p;
for (vector<string>::const_iterator p =
second_in_debug_package_paths.begin();
p != second_in_debug_package_paths.end();
++p)
abipkgdiff += " --d2 " + *p;
if (!first_in_devel_package_path.empty())
abipkgdiff += " --devel1 " + first_in_devel_package_path;
if (!second_in_devel_package_path.empty())
abipkgdiff += " --devel2 " + second_in_devel_package_path;
if (!suppression_path.empty())
abipkgdiff += " --suppressions " + suppression_path;
cmd =
abipkgdiff + " " + first_in_package_path + " " + second_in_package_path;
cmd += " > " + out_abi_diff_report_path + " 2>&1";
bool abipkgdiff_ok = true;
int code = system(cmd.c_str());
if (!WIFEXITED(code))
abipkgdiff_ok = false;
if (abipkgdiff_ok)
{
cmd = "diff -u " + ref_abi_diff_report_path + " "
+ out_abi_diff_report_path;
if (system(cmd.c_str()))
is_ok = false;
}
else
is_ok = false;
}
}; // end struct test_task
/// A convenience typedef for shared
typedef shared_ptr<test_task> test_task_sptr;
int
main()
{
using std::vector;
using abg_compat::dynamic_pointer_cast;
using abigail::workers::queue;
using abigail::workers::task;
using abigail::workers::task_sptr;
using abigail::workers::get_number_of_threads;
/// Create a task queue. The max number of worker threads of the
/// queue is the number of the concurrent threads supported by the
/// processor of the machine this code runs on.
const size_t num_tests = sizeof(in_out_specs) / sizeof (InOutSpec) - 1;
size_t num_workers = std::min(get_number_of_threads(), num_tests);
queue task_queue(num_workers);
bool is_ok = true;
for (InOutSpec *s = in_out_specs; s->first_in_package_path; ++s)
{
test_task_sptr t(new test_task(*s));
ABG_ASSERT(task_queue.schedule_task(t));
}
/// Wait for all worker threads to finish their job, and wind down.
task_queue.wait_for_workers_to_complete();
// Now walk the results and print whatever error messages need to be
// printed.
const vector<task_sptr>& completed_tasks =
task_queue.get_completed_tasks();
ABG_ASSERT(completed_tasks.size() == num_tests);
for (vector<task_sptr>::const_iterator ti = completed_tasks.begin();
ti != completed_tasks.end();
++ti)
{
test_task_sptr t = dynamic_pointer_cast<test_task>(*ti);
if (!t->is_ok)
{
is_ok = false;
if (!t->diff_cmd.empty())
system(t->diff_cmd.c_str());
if (!t->error_message.empty())
cerr << t->error_message << '\n';
}
}
return !is_ok;
}