Add --no-added-syms to abipkgdiff

With this new option the tool ignores added functions, variables and
their symbols.

	* tools/abipkgdiff.cc (options::show_added_syms): New data member.
	(options::options): Initialize it.
	(parse_command_line): Parse the new --no-added-syms option and set
	the options::show_added_syms flag accordingly.
	(display_usage): Add a help string for the new option.
	(set_diff_context_from_opts): Set the diff context according to
	the state of the new options::show_added_syms flag.
	* doc/manuals/abipkgdiff.rst: Add manual entry for the new
	--no-added-syms options.
	* tests/data/test-diff-pkg/test-rpm-report-5.txt: New test
	reference input file.
	* tests/data/Makefile.am: Add the new file above to source
	distribution.
	* tests/test-diff-pkg.cc (InOutSpec::prog_options): New data
	member.
	(in_out_specs): Adjust.  Add a new input to run the test again
	with --no-added-syms.
	(main): Adjust to pass the program options contained in
	InOutSpec::prog_options to abipkgdiff.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>

fixup! Add --no-added-syms to abipkgdiff

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-08-06 13:56:48 +02:00
parent 465b25e0d8
commit 9f7c07460d
5 changed files with 55 additions and 2 deletions

View File

@ -64,6 +64,11 @@ Options
In the resulting report, do not display the linkage names of
the added, removed, or changed functions or variables.
* ``--no-added-syms``
Do not show the list of functions, variables, or any symbol that
was added.
* ``--no-added-binaries``
Do not show the list of binaries that got added to the second

View File

@ -814,5 +814,6 @@ 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
test-diff-pkg/test-rpm-report-4.txt \
test-diff-pkg/test-rpm-report-5.txt

View File

@ -0,0 +1,13 @@
================ 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
Variable symbols changes summary: 0 Removed, 0 Added variable symbol not referenced by debug info
2 Removed functions:
'function BaseInfo* base_info_ref(BaseInfo*)' {base_info_ref}
'function void base_info_unref(BaseInfo*)' {base_info_unref}
================ end of changes of 'dbus-binding-tool'===============

View File

@ -43,6 +43,7 @@ struct InOutSpec
{
const char* first_in_package_path;
const char* second_in_package_path;
const char* prog_options;
const char* first_in_debug_package_path;
const char* second_in_debug_package_path;
const char* ref_report_path;
@ -55,6 +56,7 @@ static InOutSpec in_out_specs[] =
{
"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",
@ -64,6 +66,7 @@ static InOutSpec in_out_specs[] =
{
"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",
@ -74,6 +77,7 @@ static InOutSpec in_out_specs[] =
"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"
@ -84,6 +88,7 @@ static InOutSpec in_out_specs[] =
"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"
},
@ -91,13 +96,25 @@ static InOutSpec in_out_specs[] =
{
"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"
},
// 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-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"
},
// This should be the last entry.
{0, 0, 0, 0, 0, 0}
{0, 0, 0, 0, 0, 0, 0}
};
int
@ -109,6 +126,7 @@ main()
bool is_ok = true;
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_debug_package_path, second_in_debug_package_path;
for (InOutSpec *s = in_out_specs; s->first_in_package_path; ++s)
@ -117,6 +135,9 @@ main()
get_src_dir() + "/tests/" + s->first_in_package_path;
second_in_package_path =
get_src_dir() + "/tests/" + s->second_in_package_path;
prog_options = s->prog_options;
if (s->first_in_debug_package_path
&& strcmp(s->first_in_debug_package_path, ""))
first_in_debug_package_path =
@ -143,6 +164,10 @@ main()
}
abipkgdiff = get_build_dir() + "/tools/abipkgdiff";
if (!prog_options.empty())
abipkgdiff += " " + prog_options;
if (!first_in_debug_package_path.empty())
abipkgdiff += " --d1 " + first_in_debug_package_path;
if (!second_in_debug_package_path.empty())

View File

@ -98,6 +98,7 @@ struct options
bool compare_dso_only;
bool show_linkage_names;
bool show_redundant_changes;
bool show_added_syms;
bool show_added_binaries;
vector<string> suppression_paths;
@ -108,6 +109,7 @@ struct options
compare_dso_only(),
show_linkage_names(true),
show_redundant_changes(),
show_added_syms(true),
show_added_binaries(true)
{}
};
@ -364,6 +366,7 @@ display_usage(const string& prog_name, ostream& out)
<< " --no-linkage-name do not display linkage names of "
"added/removed/changed\n"
<< " --redundant display redundant changes\n"
<< " --no-added-syms do not display added functions or variables\n"
<< " --no-added-binaries do not display added binaries\n"
<< " --verbose emit verbose progress messages\n"
<< " --help display help message\n";
@ -499,6 +502,10 @@ set_diff_context_from_opts(diff_context_sptr ctxt,
ctxt->error_output_stream(&cerr);
ctxt->show_redundant_changes(opts.show_redundant_changes);
ctxt->show_linkage_names(opts.show_linkage_names);
ctxt->show_added_fns(opts.show_added_syms);
ctxt->show_added_vars(opts.show_added_syms);
ctxt->show_added_symbols_unreferenced_by_debug_info
(opts.show_added_syms);
ctxt->switch_categories_off
(abigail::comparison::ACCESS_CHANGE_CATEGORY
@ -923,6 +930,8 @@ parse_command_line(int argc, char* argv[], options& opts)
opts.show_linkage_names = false;
else if (!strcmp(argv[i], "--redundant"))
opts.show_redundant_changes = true;
else if (!strcmp(argv[i], "--no-added-syms"))
opts.show_added_syms = false;
else if (!strcmp(argv[i], "--no-added-binaries"))
opts.show_added_binaries = false;
else if (!strcmp(argv[i], "--verbose"))