Add regression tests for abipkgdiff tool

Add tests for the abipkgdiff tool.  The tests runs abipkgdiff on RPM
packages. RPMs for test data are taken from Fedora koji build with
build id - 106158 and 648058

	* tests/Makefile.am: Build new runtestdiffpkg regression test
	* tests/data/Makefile.am: Add new test files to source
	* tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm:
	Test data for abipkgdiff tool
	* tests/data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm: Likewise
	* tests/data/test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm:
	Likewise
	* tests/data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm:
	Likewise
	* tests/data/test-diff-pkg/test-rpm-report-0.txt: Expected test output
	* tests/data/test-diff-pkg/test-rpm-report-1.txt: Likewise
	* tests/data/test-diff-pkg/test-rpm-report-2.txt: Likewise
	* tests/data/test-diff-pkg/test-rpm-report-3.txt: Likewise
	* tests/data/test-diff-pkg/test-rpm-report-4.txt: Likewise
	* tests/test-diff-pkg.cc: New file

Signed-off-by: Sinny Kumari <sinny@redhat.com>
This commit is contained in:
Sinny Kumari 2015-07-16 14:35:04 +05:30 committed by Dodji Seketeli
parent dea76e9f5f
commit 260b92f5df
12 changed files with 332 additions and 1 deletions

View File

@ -27,6 +27,7 @@ runtestcanonicalizetypes.sh \
runtestdifffilter \
runtestdiffsuppr \
runtestabicompat \
runtestdiffpkg \
$(CXX11_TESTS)
EXTRA_DIST = runtestcanonicalizetypes.sh.in
@ -79,6 +80,9 @@ runtestdiffsuppr_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
runtestabicompat_SOURCES = test-abicompat.cc
runtestabicompat_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
runtestdiffpkg_SOURCES = test-diff-pkg.cc
runtestdiffpkg_LDADD = libtestutils.la $(top_builddir)/src/libabigail.la
runtestsvg_SOURCES=test-svg.cc
runtestsvg_LDADD=$(top_builddir)/src/libabigail.la

View File

@ -773,4 +773,15 @@ test-abicompat/test6-var-changed-app \
test-abicompat/test6-var-changed-app.cc \
test-abicompat/test6-var-changed-libapp-v0.cc \
test-abicompat/test6-var-changed-libapp-v1.cc \
test-abicompat/test6-var-changed-report-0.txt
test-abicompat/test6-var-changed-report-0.txt \
\
test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm \
test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm \
test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm \
test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm \
test-diff-pkg/test-rpm-report-0.txt \
test-diff-pkg/test-rpm-report-1.txt \
test-diff-pkg/test-rpm-report-2.txt \
test-diff-pkg/test-rpm-report-3.txt \
test-diff-pkg/test-rpm-report-4.txt

View File

@ -0,0 +1,37 @@
================ changes of 'dbus-binding-tool'===============
Functions changes summary: 2 Removed, 0 Changed, 0 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 0 Removed, 1 Added function symbol not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
2 Removed functions:
'function BaseInfo* base_info_ref(BaseInfo*)'
'function void base_info_unref(BaseInfo*)'
1 Added function symbol not referenced by debug info:
dbus_g_value_build_g_variant
================ end of changes of 'dbus-binding-tool'===============
================ changes of 'libdbus-glib-1.so.2.1.0'===============
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 0 Removed, 8 Added function symbols not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
8 Added function symbols not referenced by debug info:
dbus_g_bus_get_private
dbus_g_connection_open_private
dbus_g_connection_unregister_g_object
dbus_g_method_invocation_get_g_connection
dbus_g_object_type_register_shadow_property
dbus_g_value_build_g_variant
dbus_g_value_parse_g_variant
dbus_glib_global_set_disable_legacy_property_access
================ end of changes of 'libdbus-glib-1.so.2.1.0'===============

View File

@ -0,0 +1,36 @@
================ changes of 'dbus-binding-tool'===============
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 2 Removed, 1 Added function symbols not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
2 Removed function symbols not referenced by debug info:
base_info_ref
base_info_unref
1 Added function symbol not referenced by debug info:
dbus_g_value_build_g_variant
================ end of changes of 'dbus-binding-tool'===============
================ changes of 'libdbus-glib-1.so.2.1.0'===============
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 0 Removed, 8 Added function symbols not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
8 Added function symbols not referenced by debug info:
dbus_g_bus_get_private
dbus_g_connection_open_private
dbus_g_connection_unregister_g_object
dbus_g_method_invocation_get_g_connection
dbus_g_object_type_register_shadow_property
dbus_g_value_build_g_variant
dbus_g_value_parse_g_variant
dbus_glib_global_set_disable_legacy_property_access
================ end of changes of 'libdbus-glib-1.so.2.1.0'===============

View File

@ -0,0 +1,36 @@
================ changes of 'dbus-binding-tool'===============
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 2 Removed, 1 Added function symbols not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
2 Removed function symbols not referenced by debug info:
base_info_ref
base_info_unref
1 Added function symbol not referenced by debug info:
dbus_g_value_build_g_variant
================ end of changes of 'dbus-binding-tool'===============
================ changes of 'libdbus-glib-1.so.2.1.0'===============
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 0 Removed, 8 Added function symbols not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
8 Added function symbols not referenced by debug info:
dbus_g_bus_get_private
dbus_g_connection_open_private
dbus_g_connection_unregister_g_object
dbus_g_method_invocation_get_g_connection
dbus_g_object_type_register_shadow_property
dbus_g_value_build_g_variant
dbus_g_value_parse_g_variant
dbus_glib_global_set_disable_legacy_property_access
================ end of changes of 'libdbus-glib-1.so.2.1.0'===============

View File

@ -0,0 +1,36 @@
================ changes of 'dbus-binding-tool'===============
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 2 Removed, 1 Added function symbols not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
2 Removed function symbols not referenced by debug info:
base_info_ref
base_info_unref
1 Added function symbol not referenced by debug info:
dbus_g_value_build_g_variant
================ end of changes of 'dbus-binding-tool'===============
================ changes of 'libdbus-glib-1.so.2.1.0'===============
Functions changes summary: 0 Removed, 0 Changed, 0 Added function
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
Function symbols changes summary: 0 Removed, 8 Added function symbols not referenced by debug info
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
8 Added function symbols not referenced by debug info:
dbus_g_bus_get_private
dbus_g_connection_open_private
dbus_g_connection_unregister_g_object
dbus_g_method_invocation_get_g_connection
dbus_g_object_type_register_shadow_property
dbus_g_value_build_g_variant
dbus_g_value_parse_g_variant
dbus_glib_global_set_disable_legacy_property_access
================ end of changes of 'libdbus-glib-1.so.2.1.0'===============

171
tests/test-diff-pkg.cc Normal file
View File

@ -0,0 +1,171 @@
// -*- Mode: C++ -*-
//
// Copyright (C) 2013-2015 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 fetch ABI diff between ELF binaries present inside
/// input packages with optional debuginfo packages.
/// Resulting ABI diff report is compared with reference one.
///
/// The set of input files and reference reports to consider should be
/// present in the source distribution.
#include <cstring>
#include <string>
#include <cstdlib>
#include <iostream>
#include "test-utils.h"
#include "abg-tools-utils.h"
using std::string;
using std::cerr;
struct InOutSpec
{
const char* first_in_package_path;
const char* second_in_package_path;
const char* first_in_debug_package_path;
const char* second_in_debug_package_path;
const char* ref_report_path;
const char* out_report_path;
};// end struct InOutSpec
static InOutSpec in_out_specs[] =
{
// 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",
"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",
"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",
"",
"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",
"",
"",
"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",
"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"
},
// This should be the last entry.
{0, 0, 0, 0, 0, 0}
};
int
main()
{
using abigail::tests::get_src_dir;
using abigail::tests::get_build_dir;
using abigail::tools_utils::ensure_parent_dir_created;
bool is_ok = true;
string first_in_package_path, second_in_package_path,
ref_abi_diff_report_path, out_abi_diff_report_path, cmd, abipkgdiff,
first_in_debug_package_path, second_in_debug_package_path;
for (InOutSpec *s = in_out_specs; s->first_in_package_path; ++s)
{
first_in_package_path =
get_src_dir() + "/tests/" + s->first_in_package_path;
second_in_package_path =
get_src_dir() + "/tests/" + s->second_in_package_path;
if (s->first_in_debug_package_path
&& strcmp(s->first_in_debug_package_path, ""))
first_in_debug_package_path =
get_src_dir() + "/tests/" + s->first_in_debug_package_path;
else
first_in_debug_package_path.clear();
if (s->second_in_debug_package_path
&& strcmp(s->second_in_debug_package_path, ""))
second_in_debug_package_path =
get_src_dir() + "/tests/" + s->second_in_debug_package_path;
else
second_in_debug_package_path.clear();
ref_abi_diff_report_path = get_src_dir() + "/tests/" + s->ref_report_path;
out_abi_diff_report_path =
get_build_dir() + "/tests/" + s->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;
continue;
}
abipkgdiff = get_build_dir() + "/tools/abipkgdiff";
if (!first_in_debug_package_path.empty())
abipkgdiff += " --d1 " + first_in_debug_package_path;
if (!second_in_debug_package_path.empty())
abipkgdiff += " --d2 " + second_in_debug_package_path;
cmd =
abipkgdiff + " " + first_in_package_path + " " + second_in_package_path;
cmd += " > " + out_abi_diff_report_path;
bool abipkgdiff_ok = true;
if (system(cmd.c_str()) & 255)
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;
}
return !is_ok;
}