libabigail/tests/Makefile.am

211 lines
6.4 KiB
Makefile
Raw Normal View History

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