mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-16 06:54:37 +00:00
beededda29
44 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Matthias Maennich
|
beededda29 |
Add compatibility layer for C++11 mode
Introduce a compatibility layer for C++11 code by adding include/abg-cxx-compat.h. abg-cxx-compat defines a new namespace abg_compat and defines abg_compat::hash abg_compat::shared_ptr abg_compat::weak_ptr abg_compat::dynamic_pointer_cast abg_compat::static_pointer_cast abg_compat::unordered_map abg_compat::unordered_set based on definitions from std::tr1 (std=gnu++98) or std:: (std=gnu++11). I decided for introducing abg_compat:: rather than polluting abigail:: to allow an easier transition to C++11 at a later time and to not subtly break existing code. As the shared_ptr in C++11 defines shared_ptr::operator bool() explicit, some locations where a shared_ptr is assigned to boolean, needed to be adjusted to explicitly cast to bool. * include/abg-cxx-compat.h: new file introducing the abg_compat namespace to provide C++11 functionality from either std::tr1 or std:: * include/Makefile.am: Add the new abg-cxx-compat.h to source distribution. * include/abg-comparison.h: replace std::tr1 usage by abg_compat and adjust includes accordingly: likewise * include/abg-diff-utils.h: likewise * include/abg-fwd.h: likewise * include/abg-ini.h: likewise * include/abg-interned-str.h: likewise * include/abg-ir.h: likewise * include/abg-libxml-utils.h: likewise * include/abg-libzip-utils.h: likewise * include/abg-reporter.h: likewise * include/abg-sptr-utils.h: likewise * include/abg-suppression.h: likewise * include/abg-tools-utils.h: likewise * include/abg-workers.h: likewise * src/abg-comp-filter.cc: likewise * src/abg-comparison-priv.h: likewise * src/abg-corpus.cc: likewise * src/abg-dwarf-reader.cc: likewise * src/abg-hash.cc: likewise * src/abg-ir.cc: likewise * src/abg-reader.cc: likewise * src/abg-suppression.cc: likewise * src/abg-tools-utils.cc: likewise * src/abg-writer.cc: likewise * tests/test-diff-filter.cc: likewise * tests/test-diff-pkg.cc: likewise * tests/test-read-dwarf.cc: likewise * tests/test-read-write.cc: likewise * tests/test-types-stability.cc: likewise * tests/test-write-read-archive.cc: likewise * tools/abicompat.cc: likewise * tools/abidiff.cc: likewise * tools/abidw.cc: likewise * tools/abilint.cc: likewise * tools/abipkgdiff.cc: likewise Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e54191eac9 |
Add test for the fix for PR24410
PR24410 was fixed by these recent commits: |
||
Dodji Seketeli
|
c00e2120b9 |
Bug 24188 - Assertion failed while analysing a Fortran binary
While analysing a Fortran binary the DWARF reader performs DIE de-duplication. During that process, the compare_dies function stumbles accross the a DIE of the DW_TAG_string_type kind. And it doesn't know how to compare those DIEs. And this leads to an abort of the abipkgdiff program, in particular. DW_TAG_string_type DIEs do have a DW_AT_string_length attribute which value is a location expression that does not resolve to a constant value. In general, we cannot evaluate those expressions in a static context like in Libabigail because we lack things like register values which are dynamic in nature. So, I decided for now to consider that two DW_TAG_string_type seen at different DWARF offsets are considered to be different for now. This pessimises DIEs de-duplication for types that contain DW_TAG_string_type as their subtypes, but at least this is a basic support for DW_TAG_string_type. Tested with the RPMs on which abipkgdiff was failing. Signed-off-by: Dodji Seketeli <dodji@redhat.com> * src/abg-dwarf-reader.cc (compare_as_type_dies): Handle DW_TAG_string_type DIEs here. (compare_dies): Handle DW_TAG_string_type DIEs by using compare_as_type_dies. * tests/data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-10.fc29.x86_64.rpm: New test RPM. * tests/data/test-diff-pkg/netcdf-fortran-debuginfo-4.4.4-11.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64-4.4.4-11.fc30.x86_64-report-0.txt: New expected test reference output. * tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-10.fc29.x86_64.rpm: New test RPM. * tests/data/test-diff-pkg/netcdf-fortran-mpich-4.4.4-11.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-10.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/netcdf-fortran-mpich-debuginfo-4.4.4-11.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-10.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/netcdf-fortran-mpich-devel-4.4.4-11.fc30.x86_64.rpm: Likewise. * tests/data/Makefile.am: Add the new test input material above to source distribution. * tests/test-diff-pkg.cc (in_out_spec): Add the new test RPMs above to the set of RPMs to use as test input. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
84ec784743 |
Bug 24157 - Wrong support of Ada ranges
In this problem report, the DWARF reader comes across an ADA subrange which lower bound is a negative signed integer. The problem is that the internal representation of libabigail expects the bounds of the subrange to be unsigned integer. This incompatibility leads to an assertion failure. Further down the road I realized that the function types_have_similar_structure doesn't support subrange types. This patch thus introduces a new array_type_def::subrange_type::bound_value class that captures the signedness of the bound value. This allows the internal representation to keep the sign information of the bound value, and yet be able to treat the bound value as either a signed or unsigned value depending on the contexts. The patch also extends the function types_have_similar_structure to make it support subrange types. * include/abg-ir.h (array_type_def::subrange_type::bound_value): Define new class. (array_type_def::subrange_type::subrange_type): Adjust to use the new bound_value type for bound values. (array_type_def::subrange_type::{get_upper_bound, get_lower_bound, set_upper_bound, set_lower_bound}): Return or take int64_t rather than size_t. (array_type_def::subrange_type::get_length): Return uint64_t rather than size_t. * src/abg-dwarf-reader.cc (die_signed_constant_attribute) (die_constant_attribute, die_attribute_has_form) (die_attribute_is_signed, die_attribute_is_unsigned) (die_attribute_has_no_signedness): Define new static functions. (get_default_array_lower_bound): Return uint64_t rather than int. (build_subrange_type): Use the new array_type_def::subrange_type::bound_value type for bound values. Use the new die_constant_attribute function, rather than die_unsigned_constant_attribute to fecth the bound values. * src/abg-ir.cc (array_type_def::subrange_type::bound_value::{bound_value, get_signedness, set_signedness, get_signed_value, get_unsigned_value, set_unsigned, set_signed}): Define new member functions. (array_type_def::subrange_type::priv::{lower_bound_, upper_bound}): Use the new class bound_value. (array_type_def::subrange_type::priv::priv): Adjust to use the new bound_value class to hold bound values. (array_type_def::subrange_type::subrange_type): Likewise. (array_type_def::subrange_type::{get_upper_bound, get_lower_bound, set_upper_bound, set_lower_bound}): Return or take int64_t rather than size_t. (array_type_def::subrange_type::get_length): Return uint64_t rather than size_t. (types_have_similar_structure): Handle array_type_def::subrange_type * src/abg-reader.cc (build_subrange_type): Use the new array_type_def::subrange_type::bound_value to hold bound values. * tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-29.fc29.x86_64.rpm: New binary RPM as test input. * tests/data/test-diff-pkg/GtkAda-debuginfo-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-devel-2.24.2-29.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-devel-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64--2.24.2-30.fc30.x86_64-report-0.txt: New expected test output. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-29.fc29.x86_64.rpm: New binary RPM as test input. * tests/data/test-diff-pkg/GtkAda-gl-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-29.fc29.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/GtkAda-gl-debuginfo-2.24.2-30.fc30.x86_64.rpm: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new input testing RPMs in here. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
7d639aef70 |
Bug 20175 - Classify CV qual changes in variable type as harmless
When the type of a variable changes and that change is only a CV qual change, we want libabigail to automatically classify that change as being harmless. This patch thus introduces a new VAR_TYPE_CV_CHANGE_CATEGORY change category (enumerator of the abigail::comparison::diff_category enum) for this kind of changes and classifies that category as being harmless. The patch then detects diff nodes that carry CV qualifiers change on variable types and flags them as belonging to the new VAR_TYPE_CV_CHANGE_CATEGORY. * include/abg-comparison.h (VAR_TYPE_CV_CHANGE_CATEGORY): Add new enumerator to diff_category enum. (EVERYTHING_CATEGORY): Update this enumerator. * src/abg-comp-filter.cc (type_diff_has_cv_qual_change_only): Support array diff nodes carrying a cv qual change on the element type. (has_var_type_cv_qual_change): Define new static function. (categorize_harmless_diff_node): Use the new has_var_type_cv_qual_change to categorize variable diff node with cv qual change on its type as harmless. * src/abg-comparison.cc (get_default_harmless_categories_bitmap): Update this. (operator<<(ostream& o, diff_category c)): Likewise. * include/abg-ir.h (equals_modulo_cv_qualifier): Declare new ... * src/abg-ir.cc (equals_modulo_cv_qualifier): ... function. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: Update expected test output. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise. * tests/data/Makefile.am: Add the new test material below to source distribution. * tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt: New expecte test output. * tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64.rpm: New test input. * tests/data/test-diff-pkg/nss-3.24.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-debuginfo-3.23.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-debuginfo-3.24.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-devel-3.23.0-1.0.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/nss-devel-3.24.0-1.0.fc23.x86_64.rpm: Likewise. * tests/test-diff-pkg.cc (in_out_specs): Add the test input above to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ad8732316a |
Bug 23044 - Assertions with side effects
There are lots of spots in libabigail's source code where the argument of the assert() call does have side effects. This is a problem because when the code is compiled with the NDEBUG macro defined, the assert call does nothing, so the side effects of its argument are then suppressed, changing the behaviour of the program. To handle this issue, this patch introduces the ABG_ASSERT macro which is a wrapper around the assert call that enable the use of side effects in its argument. The patch now uses that ABG_ASSERT macro instead of using the assert call directly. The patch also makes it so that the configure option accepts the --disable-assert option so that the user can build libabigail with the NDEBUG macro defined. Tested by running the testsuite with and without the --disable-assert option to configure. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
047342467c |
Update copyright for 2019
* include/abg-comp-filter.h: Update copyright for 2019 * include/abg-comparison.h: Update copyright for 2019 * include/abg-config.h: Update copyright for 2019 * include/abg-corpus.h: Update copyright for 2019 * include/abg-diff-utils.h: Update copyright for 2019 * include/abg-dwarf-reader.h: Update copyright for 2019 * include/abg-fwd.h: Update copyright for 2019 * include/abg-hash.h: Update copyright for 2019 * include/abg-ini.h: Update copyright for 2019 * include/abg-interned-str.h: Update copyright for 2019 * include/abg-ir.h: Update copyright for 2019 * include/abg-libxml-utils.h: Update copyright for 2019 * include/abg-libzip-utils.h: Update copyright for 2019 * include/abg-reader.h: Update copyright for 2019 * include/abg-reporter.h: Update copyright for 2019 * include/abg-sptr-utils.h: Update copyright for 2019 * include/abg-suppression.h: Update copyright for 2019 * include/abg-tools-utils.h: Update copyright for 2019 * include/abg-traverse.h: Update copyright for 2019 * include/abg-viz-common.h: Update copyright for 2019 * include/abg-viz-dot.h: Update copyright for 2019 * include/abg-viz-svg.h: Update copyright for 2019 * include/abg-workers.h: Update copyright for 2019 * include/abg-writer.h: Update copyright for 2019 * src/abg-comp-filter.cc: Update copyright for 2019 * src/abg-comparison-priv.h: Update copyright for 2019 * src/abg-comparison.cc: Update copyright for 2019 * src/abg-config.cc: Update copyright for 2019 * src/abg-corpus-priv.h: Update copyright for 2019 * src/abg-corpus.cc: Update copyright for 2019 * src/abg-default-reporter.cc: Update copyright for 2019 * src/abg-diff-utils.cc: Update copyright for 2019 * src/abg-dwarf-reader.cc: Update copyright for 2019 * src/abg-hash.cc: Update copyright for 2019 * src/abg-ini.cc: Update copyright for 2019 * src/abg-internal.h: Update copyright for 2019 * src/abg-ir-priv.h: Update copyright for 2019 * src/abg-ir.cc: Update copyright for 2019 * src/abg-leaf-reporter.cc: Update copyright for 2019 * src/abg-libxml-utils.cc: Update copyright for 2019 * src/abg-libzip-utils.cc: Update copyright for 2019 * src/abg-reader.cc: Update copyright for 2019 * src/abg-reporter-priv.cc: Update copyright for 2019 * src/abg-reporter-priv.h: Update copyright for 2019 * src/abg-sptr-utils.cc: Update copyright for 2019 * src/abg-suppression-priv.h: Update copyright for 2019 * src/abg-suppression.cc: Update copyright for 2019 * src/abg-tools-utils.cc: Update copyright for 2019 * src/abg-traverse.cc: Update copyright for 2019 * src/abg-viz-common.cc: Update copyright for 2019 * src/abg-viz-dot.cc: Update copyright for 2019 * src/abg-viz-svg.cc: Update copyright for 2019 * src/abg-workers.cc: Update copyright for 2019 * src/abg-writer.cc: Update copyright for 2019 * tests/print-diff-tree.cc: Update copyright for 2019 * tests/test-abicompat.cc: Update copyright for 2019 * tests/test-abidiff-exit.cc: Update copyright for 2019 * tests/test-abidiff.cc: Update copyright for 2019 * tests/test-alt-dwarf-file.cc: Update copyright for 2019 * tests/test-core-diff.cc: Update copyright for 2019 * tests/test-diff-dwarf-abixml.cc: Update copyright for 2019 * tests/test-diff-dwarf.cc: Update copyright for 2019 * tests/test-diff-filter.cc: Update copyright for 2019 * tests/test-diff-pkg.cc: Update copyright for 2019 * tests/test-diff-suppr.cc: Update copyright for 2019 * tests/test-diff2.cc: Update copyright for 2019 * tests/test-ini.cc: Update copyright for 2019 * tests/test-ir-walker.cc: Update copyright for 2019 * tests/test-lookup-syms.cc: Update copyright for 2019 * tests/test-read-dwarf.cc: Update copyright for 2019 * tests/test-read-write.cc: Update copyright for 2019 * tests/test-types-stability.cc: Update copyright for 2019 * tests/test-utils.cc: Update copyright for 2019 * tests/test-utils.h: Update copyright for 2019 * tests/test-write-read-archive.cc: Update copyright for 2019 * tools/abiar.cc: Update copyright for 2019 * tools/abicompat.cc: Update copyright for 2019 * tools/abidiff.cc: Update copyright for 2019 * tools/abidw.cc: Update copyright for 2019 * tools/abilint.cc: Update copyright for 2019 * tools/abipkgdiff.cc: Update copyright for 2019 * tools/abisym.cc: Update copyright for 2019 * tools/binilint.cc: Update copyright for 2019 * tools/kmidiff.cc: Update copyright for 2019 * update-copyright.sh: Update new year to 2019 Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
4ce7f69dac |
Identify a function using its symbol name and version
When a function symbol S has several versions and several different functions with different names have those different versions of S as underlying symbols, libabigail could mistakenly take one function for another. This is because there are cases where libabigail identifies the function using its symbol name without taking the version name into account. This patch fixes that. * src/abg-default-reporter.cc (default_reporter::report): In C, tell the user about the underlying function symbol name only if said symbol name is different from the name of the function. * src/abg-ir.cc (function_decl::get_id): If the function has an underlying symbol, use the symbol name and version as the function ID. But if the function symbol has an alias then use the linkage name as the ID. * tests/data/test-diff-pkg/elfutils-debuginfo-0.170-4.el7.x86_64.rpm: New binary test input. * tests/data/test-diff-pkg/elfutils-debuginfo-0.171-1.el7.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/elfutils-devel-0.170-4.el7.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/elfutils-devel-0.171-1.el7.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/elfutils-libs-0.171-1.el7.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/elfutils-libs-0.170-4.el7.x86_64-multiple-sym-vers-report-0.txt: New reference test output. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Integrate the new test inputs above into the harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2939397c13 |
Make abipkgdiff avoid comparing private DSOs from RPMs
When an RPM contains a DSO which SONAME is not listed in the "provides" property of the package, abipkgdiff ought to consider that DSO as private to the RPM. It should thus *NOT* consider that DSO when comparing ABIs, at least, by default. This is as per the discussion that was held at https://pagure.io/task-abicheck/issue/8 and that led to the proposal https://pagure.io/task-abicheck/issue/8#comment-492466. This patch implements that scheme. Basically, the patch looks at the SONAMEs listed in the "provides" property of the RPM and consider them as the SONAMEs of the set of "public" DSOs of the RPM. Thus, if the RPM has a DSO that has no SONAME of one that is not listed in the set of public SONAMEs of the package, then that DSO is not considered for ABI comparison. The patch also introduces a new --private-dso option that disables this behaviour and compares all DSOs, including those that would be meant to be private. * doc/manuals/abipkgdiff.rst: Add documentation for the new --private-dso option. * include/abg-tools-utils.h (execute_command_and_get_output) (execute_command_and_get_output, remove_trailing_white_spaces): Declare new functions. * src/abg-tools-utils.cc (execute_command_and_get_output) (get_dsos_provided_by_rpm, remove_trailing_white_spaces): Define new functions. * tests/test-diff-pkg.cc (in_out_specs): Add the new --private-dso option where it makes sense. * tools/abipkgdiff.cc (options::compare_private_dsos): Add new data member. (options::options): Initialize it. (package::public_dso_sonames_): Add new data member. (package::public_dso_sonames): Add new accessors pair. (display_usage): Add a help string for the new --private-dso option. (maybe_create_public_dso_sonames_set) (must_compare_public_dso_only): Define new static functions. (create_maps_of_package_content): Call the new maybe_create_public_dso_sonames_set. Skip packages which SONAME is not in the set of public SONAMES. (parse_command_line): Parse the new --private-dso option. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b3c3049fdd |
Update copyright notice for all source files
Happy New Year 2018, I guess :-) * update-copyright.sh: New sed-based script to update the year in the copyright notice. * include/abg-comp-filter.h: Updated the year in the copyright notice. * include/abg-comparison.h: Likewise. * include/abg-config.h: Likewise. * include/abg-corpus.h: Likewise. * include/abg-diff-utils.h: Likewise. * include/abg-dwarf-reader.h: Likewise. * include/abg-fwd.h: Likewise. * include/abg-hash.h: Likewise. * include/abg-ini.h: Likewise. * include/abg-interned-str.h: Likewise. * include/abg-ir.h: Likewise. * include/abg-libxml-utils.h: Likewise. * include/abg-libzip-utils.h: Likewise. * include/abg-reader.h: Likewise. * include/abg-reporter.h: Likewise. * include/abg-sptr-utils.h: Likewise. * include/abg-suppression.h: Likewise. * include/abg-tools-utils.h: Likewise. * include/abg-traverse.h: Likewise. * include/abg-viz-common.h: Likewise. * include/abg-viz-dot.h: Likewise. * include/abg-viz-svg.h: Likewise. * include/abg-workers.h: Likewise. * include/abg-writer.h: Likewise. * src/abg-comp-filter.cc: Likewise. * src/abg-comparison-priv.h: Likewise. * src/abg-comparison.cc: Likewise. * src/abg-config.cc: Likewise. * src/abg-corpus-priv.h: Likewise. * src/abg-corpus.cc: Likewise. * src/abg-default-reporter.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-internal.h: Likewise. * src/abg-ir-priv.h: Likewise. * src/abg-ir.cc: Likewise. * src/abg-leaf-reporter.cc: Likewise. * src/abg-libxml-utils.cc: Likewise. * src/abg-libzip-utils.cc: Likewise. * src/abg-reader.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: Likewise. * src/abg-sptr-utils.cc: Likewise. * src/abg-suppression-priv.h: 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. * tests/print-diff-tree.cc: Likewise. * tests/test-abicompat.cc: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-diff2.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-types-stability.cc: Likewise. * tests/test-utils.cc: Likewise. * tests/test-utils.h: Likewise. * tests/test-write-read-archive.cc: Likewise. * tools/abiar.cc: Likewise. * tools/abicompat.cc: Likewise. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abilint.cc: Likewise. * tools/abipkgdiff.cc: Likewise. * tools/abisym.cc: Likewise. * tools/binilint.cc: Likewise. * tools/kmidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
eead00efb0 |
Bug 22436 - make abipkgdiff accept several debuginfo packages
Sometimes, the debug information for one given package P can have been split into several packages. In that case, we need abipkgdiff to consider several debug info packages for a given input binary package. This patch makes abipkgdiff to accept several --d{1,2} <debug-info-package> option, for a given input package. * doc/manuals/abipkgdiff.rst: Document the fact that --d{1,2} can be provided several times on the command line. * tools/abipkgdiff.cc (options::debug_packages{1,2}): Rename the debug_package{1,2} data members into this, and make them be vector of strings, rather than just strings. (package::debug_info_packages_): Renamed package::debug_info_package_ into this and make it be a vector of package_sptr, rather than just a package_sptr. (package::debug_info_packages): Renamed the method package::debug_info_package into this and -- for the getter overload -- make it return a vector of package_sptr, rather than just a package_sptr. Likewise for the setter overload. Add a non-const getter overload. (package::erase_extraction_directories) (extract_package_and_map_its_content): Adjust. (extract_rpm, extract_deb): Do not erase the content of the extraction directory (if it was pre-existing) prior to extracting the RPM/deb into it. (pkg_extraction::pkgs): Renamed pkg_extraction::pkg into this and make it be a vector of packages, rather than just a package. (pkg_extraction::pkg_extraction): Adjust to take a package_sptr rather than just a package. Add an overload to take a vector of packages_sptr. (pkg_extraction::perform): Extract the vector of package that the task is not responsible for, not just one random package. (extract_package_and_map_its_content): Adjust. (prepare_packages): Take smart pointers to package rather than just packages. Adjust accordingly. (compare_prepared_package): Make the overload that takes two packages to take two smart pointers of packages. (compare): Make the overload that takes two package take two package_sptr. (parse_command_line): Parse having --d{1,2} several times for a given input package. (main): Take several debug info packages for one input file. * include/abg-tools-utils.h (split_string): Declare ... * src/abg-tools-utils.cc (split_string): ... new function. * tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm: Add a new RPM test input file. * tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt: new reference output file. * tests/data/Makefile.am: Add the new test input files above to source distribution. * tests/test-diff-pkg.cc (in_out_spec): Add new test entry to specify two debug info packages for one input package. (test_task::perform): Support having several debug info package paths in the IntOutSpec::{first,second}_in_debug_package_path data member. The debug info packages paths are separated by either a white space or commas. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
933c744034 |
Bug 22438 - Emit a clear message when debug info is not found
The alternate debug info file referred to a binary can be missing, even though the rest of the debug info is not. In that case, libabigail starts loading the debug info and then it crashes when trying to get DIEs that are part of the missing alternate debug info. This patch detects when the alternate debug info is missing, so that abidiff and abipkgdiff can gracefully bail out, yielding a meaningful error message. * include/abg-dwarf-reader.h (enum abigail::dwarf_reader::status): Add a new STATUS_ALT_DEBUG_INFO_NOT_FOUND enumerator there. (refers_to_alt_debug_info): Declare new function. * src/abg-dwarf-reader.cc (read_corpus_from_elf): Detect when the referred-to alternate debug info file is not found and flip the STATUS_ALT_DEBUG_INFO_NOT_FOUND bit of the status accordingly. If the debug info was found but not the alternate debug info, then do not try to read the debug info at all. (refers_to_alt_debug_info): Define new function. * tools/abidiff.cc (handle_error): Define new static function. (main): Use it, rather than handling errors preventing libabigail from reading the corpus on a case by case basis. tools/abipkgdiff.cc (compare): Handle the case where no alternate debug info was found. * tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt: New test output reference. * tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm: New test input RPM. * tests/data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm: Likewise. * tests/data/Makefile.am: Add the new test files above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add a new test case from the new input files above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d3ddf609d9 |
Add a --leaf-changes-only option to abipkgdiff
This patch adds the --leaf-changes-only option to abipkgdiff, just like what we have for abidiff. The patch also emit leaf changes report by default when comparing two Linux Kernel packages. The patch also adds the --impacted-interfaces and --full-impact options. * doc/manuals/abipkgdiff.rst: Add documentation for the new --leaf-change-only, --impacted-interfaces and --full-impact options. * tools/abipkgdiff.cc (options::{leaf_changes_only, show_impacted_interfaces, show_full_impact_report): Add new data members. (options::options): Initialize them. (display_usage): Add help strings for the new --leaf-change-only, --impacted-interfaces and --full-impact|-f options. (set_diff_context_from_opts): Set the diff context for the 'leaf-changes-only' and 'show-impacted-interfaces' flags. (parse_command_line): Parse the --leaf-change-only, --impacted-interfaces and --full-impact options. Handle the case where the --linux-kernel-abi-whitelist|-w option is given a whitelist *package*. * tests/data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-3.txt: New test output reference. * tests/test-diff-pkg.cc (in_out_spec): Compare data/test-diff-pkg/spice-server-0.12.4-19.el7.x86_64.rpm and data/test-diff-pkg/spice-server-0.12.8-1.el7.x86_64.rpm with the new --leaf-changes-only and --impacted-interfaces options, using the new output reference above. * tests/data/Makefile.am: Add the new test material to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2e2c5ff1cb |
Bug 21153 - abipkgdiff reports undetermined interface subtype changes
When a type has a noop qualifier and that noop qualifier disapears in a subsequent version of that type, the two versions of the type have different internal pretty representations. And that leads to the type canonicalization code ending up with two different canonical types for the two versions, even if they should be considered equivalent. This patch makes a noop-qualified type have the same internal pretty representation as its non-qualified variant. * src/abg-ir.cc (get_name_of_qualified_type): A noop-qualified type has an empty string as reprsentation for its qualifier. * src/abg-dwarf-reader.cc (die_qualified_type_name): Adjust to comply with what is done in get_name_of_qualified_type. Adjust comment too. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Adjust. * tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64--libcdio-0.94-2.fc26.x86_64-report.1.txt: New reference test output. * tests/data/test-diff-pkg/libcdio-0.94-1.fc26.x86_64.rpm: New test binary input. * tests/data/test-diff-pkg/libcdio-0.94-2.fc26.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/libcdio-debuginfo-0.94-1.fc26.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/libcdio-debuginfo-0.94-2.fc26.x86_64.rpm Likewise. * tests/data/Makefile.am: Add the new test inputs to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Make this test harness run on the new test inputs above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
688d18dc71 |
Bug 21228 - Handle cloning union member functions
It turns out we allow member function cloning only for functions that are members of classes, not for functions that are member of unions. This patch fixes that by turning the method class_decl::add_member_function into the class_or_union::add_member_function. Note that there was already an overload of class_or_union::add_member_function; now, all the member functions add_member_function are members of the class_or_union type. The patch then modifies function_decl::clone to make that code avoid assuming that only member functions of classes can be cloned. * include/abg-ir.h (class_or_union::add_member_function): Move the class_decl::add_member_function overload declaration into the class class_or_union class. (class class_decl): Make the class class_or_union be a friend of class_decl. * src/abg-ir.cc (class_decl::add_member_function): Transform the definition of this overload into ... (class_or_union::add_member_function): ... this one. Make sure that when setting the virtual-ness attributes of the member function, we are effectively looking at the a function that is a member of a class. (function_decl::clone): Do not assert that a member function is necessarily a member of a class_decl. It can also a member of a union_decl!. So, rather, assert that the scope of the member function is of type class_or_union. * tests/data/test-diff-pkg/tbb-2017-8.20161128.fc26.x86_64.rpm: New test input RPM. * tests/data/test-diff-pkg/tbb-2017-9.20170118.fc27.x86_64.rpm: * tests/data/test-diff-pkg/tbb-debuginfo-2017-8.20161128.fc26.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/tbb-debuginfo-2017-9.20170118.fc27.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/tbb-2017-8.20161128.fc26.x86_64--tbb-2017-9.20170118.fc27.x86_64.txt: New reference test output. * tests/data/Makefile.am: Add the new test input RPMs to the source distribution. * tests/test-diff-pkg.cc (in_out_specs): Take the new input tests above into account. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
5aa38407ce |
Fix test-diff-pkg after commit 2dcc606
The runtestdiffpkg test has wrong paths to the spice-server packages. Fixed thus. * tests/test-diff-pkg.cc (in_out_specs): Fix paths to spice-server packages. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
2dcc6062f2 |
Fix suppression category propagation in diff node graph
Under certain circumstances, a diff node (which we shall name N) that belongs to the SUPPRESSED_CATEGORY category sees its belonging to that category been propagated to its parent diff node, effectively suppressing that parent diff node as well. This is how some function diff nodes ends up being suppressed just because some of their children diff nodes were suppressed. This suppression category propagation is performed by a pass that walks the diff nodes graph. To avoid infinite cycles, the pass avoids visiting a diff node that is equivalent to a node that has already been visited. As a result, diff nodes equivalent to N (the class of equivalence of N) are not traversed by the propagation pass. So their parent diff nodes are not suppressed. This leads to some functions not being suppressed as they should. This phenomenon can be observed by comparing the two packages that are provided in the regression test accompanying this patch using abipkgdiff with the --redundant option. Here is how the patch addresses the issue. When the suppression category propagation pass considers a parent diff node (named P) of a node N' (with N' being equivalent to N), it now looks at the category of the *class of equivalence of N'* to determine if that category should be propagated to P. Previously, that pass would just look at the at the category of N' (not the category of the class of equivalence of N') for the propagation. But as N' has not been visited (because N has already been visited and nodes equivalent to N are thus not visited) the belonging of N' to the SUPPRESSED_CATEGORY hasn't been updated. So N' isn't marked as being in SUPPRESSED_CATEGORY. So the SUPPRESSED_CATEGORY wouldn't be propagated to P as it should. So, with this patch abipkgdiff invoked with the --redundant option now correctly yields: $ abipkgdiff --redundant --d1 spice-debuginfo-0.12.4-19.el7.x86_64.rpm --d2 spice-debuginfo-0.12.8-1.el7.x86_64.rpm --devel1 spice-server-devel-0.12.4-19.el7.x86_64.rpm --devel2 spice-server-devel-0.12.8-1.el7.x86_64.rpm spice-server-0.12.4-19.el7.x86_64.rpm spice-server-0.12.8-1.el7.x86_64.rpm ================ changes of 'libspice-server.so.1.8.0'=============== Functions changes summary: 1 Removed, 2 Changed (62 filtered out), 8 Added functions Variables changes summary: 0 Removed, 0 Changed, 0 Added variable [...] 2 functions with some indirect sub-type change: [C]'function spice_image_compression_t spice_server_get_image_compression(SpiceServer*)' at reds.c:3618:1 has some indirect sub-type changes: return type changed: underlying type 'enum __anonymous_enum__' changed: type size hasn't changed 7 enumerator deletions: '__anonymous_enum__::SPICE_IMAGE_COMPRESS_INVALID' value '0' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_OFF' value '1' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_GLZ' value '2' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_LZ' value '3' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_QUIC' value '4' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_GLZ' value '5' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_LZ' value '6' 9 enumerator insertions: 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_INVALID' value '0' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_OFF' value '1' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_GLZ' value '2' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_LZ' value '3' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_QUIC' value '4' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_GLZ' value '5' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ' value '6' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ4' value '7' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_ENUM_END' value '8' [C]'function int spice_server_set_image_compression(SpiceServer*, spice_image_compression_t)' at reds.c:3602:1 has some indirect sub-type changes: parameter 2 of type 'typedef spice_image_compression_t' changed: underlying type 'enum __anonymous_enum__' changed: type size hasn't changed 7 enumerator deletions: '__anonymous_enum__::SPICE_IMAGE_COMPRESS_INVALID' value '0' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_OFF' value '1' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_GLZ' value '2' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_AUTO_LZ' value '3' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_QUIC' value '4' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_GLZ' value '5' '__anonymous_enum__::SPICE_IMAGE_COMPRESS_LZ' value '6' 9 enumerator insertions: 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_INVALID' value '0' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_OFF' value '1' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_GLZ' value '2' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_AUTO_LZ' value '3' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_QUIC' value '4' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_GLZ' value '5' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ' value '6' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_LZ4' value '7' 'SpiceImageCompression::SPICE_IMAGE_COMPRESSION_ENUM_END' value '8' ================ end of changes of 'libspice-server.so.1.8.0'=============== $ * include/abg-comparison.h (diff::get_class_of_equiv_category): Declare new member function. * src/abg-comparison.cc: Update copyright year. (diff::get_class_of_equiv_category): Define new member function. (suppression_categorization_visitor::visit_end): When considering children nodes category for propagation, consider the category of the class of equivalence of children nodes. * spice-debuginfo-0.12.4-19.el7.x86_64.rpm: New input test package. * spice-debuginfo-0.12.8-1.el7.x86_64.rpm: Likewise. * spice-server-0.12.4-19.el7.x86_64.rpm: Likewise. * spice-server-0.12.8-1.el7.x86_64.rpm: Likewise. * spice-server-devel-0.12.4-19.el7.x86_64.rpm: Likewise. * spice-server-devel-0.12.8-1.el7.x86_64.rpm: Likewise. * spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-0.txt: New reference test output. * spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-1.txt: Likewise. * spice-server-0.12.4-19.el7.x86_64-0.12.8-1.el7.x86_64-report-2.txt: Likewise. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new test inputs to the list of packages to test. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
ee00b09f21 |
Properly report missing files for abipkgdiff
Currently, if abipkgdiff is given a path to a nonexistent file, it propagates all the way until package classification and ends up being reported as "PKG should be a valid package file", which doesn't hint it's not there at all. * tools/abipkgdiff.cc: (class options): Add the "nonexistent_file" flag (parse_command_line): Check if the files given exist. (main): Check the nonexistent_file flag. If any of the input files don't exist, report it and exit. Also, for present and future test uniformity, only show the base names of the packages when using their names in error output. * tests/test-diff-pkg.cc: Add a new regression test. * tests/data/test-diff-pkg/test-nonexistent-report-0.txt: The expected output of the above regression test. * tests/data/Makefile.am: Add the above file to the list. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> |
||
Ondrej Oprala
|
125c0c3c7c |
Bug 19272 - abipkgdiff doesn't report arch change
Previously, architecture change wasn't included in the incompatible changes check. This patch makes corpus_diff::has_incompatible_changes take architecture change into account. It turns out corpus_diff::has_net_changes wasn't taking architecture or soname change into account either. This patch fixes that as well. The patch also updates abicompat.cc to make it use corpus_diff::has_net_changes() and corpus_diff::has_incompatible_changes(), instead of open-coding these member functions. * src/abg-comparison.cc (corpus_diff::has_incompatible_changes): The architecture change into account. (corpus_diff::has_net_changes): Take architecture and soname changes into account. * tools/abicompat.cc (perform_compat_check_in_normal_mode): Use corpus_diff::{has_net_changes, has_incompatible_changes}. * tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.armv7hl.rpm: New test input. * tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64--dbus-glib-0.104-3.fc23.armv7hl-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test material above to source distribution. * tests/test-diff-pkg.cc (in_out_spec): Compare the new package above against an x86_64 one. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d7faae38f6 |
Fix aborting when reading .foo symbols from a ppc64 binary
On ppc64, the value of a function symbol is *usually* the pointer to the function. That function pointer value refers to an index inside the ".opd" (Official Procedure Descriptor) section. That section is a record of tripplets values. One of these values is the address of the entry point of the function. A debug information entry for a function, in DWARF, refers to the entry point of the function; not to the function pointer address. So libabigail builds a table that associates a function entry point address to its function pointer address. So, if a function is named "foo", it has an entry in the symbol table for the symbol name "foo"; the value of that symbol is the function pointer address of foo, which refers to an offset in the ".opd" section. But then it turns out that there is also going to be an entry in the symbol table for an artificial symbol named ".foo". Pleast note the dot before the suffix "foo". The value of the ".foo" symbol is the address of the entry point of the function "foo"; it's an address in the ".text" section this time. Libabigail's ELF symbols reading code was (wrongly) expecting all entries in the symbol table that refer to function to have values that are offset in the ".opd" section. It wasn't expecting the ".foo" symbols whose value are an address in the ".text" section. This patch fixes the ELF symbol reading code to make it be aware of the ".foo" symbols too. * abg-dwarf-reader.cc (read_context::find_opd_section): Fix comment. (read_context::load_symbol_maps): If for a given function entry point (that we got by looking at the ".opd" section for a given function pointer value) we already had an entry in the function_entry_address -> symbol, maybe it means that the previous entry that we had was from an entry in the symbol table which value was directly the entry point address of a function. In that case, if the name of the symbol is "foo", the name of the symbol which value is directly the entry point address is ".foo". What we do in this case is that we just keep the reference to the "foo" symbol in the function_entry_address -> symbol map. (read_context::address_is_in_opd_section): Define new member function. * tests/data/test-diff-pkg/gmp-4.3.1-10.el6.ppc64.rpm: New test input. * tests/data/test-diff-pkg/gmp-4.3.1-7.el6_2.2.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/gmp-debuginfo-4.3.1-10.el6.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/gmp-debuginfo-4.3.1-7.el6_2.2.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/gmp-4.3.1-7.el6_2.2.ppc64--gmp-4.3.1-10.el6.ppc64-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test input and reference output to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new test inputs and reference output to the set of inputs that are compared. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Chenxiong Qi
|
1a00cad493 |
Make fedabipkgdiff consistent with Libabigail's other tests
In the libabigail project, almost all the tests for the tools follow a similar pattern. The test contains a set of input files to compare. The result of the comparison is thus compared to a set of reference comparison result. This approach is already documented in the CONTRIBUTING file. There are several interesting properties with this scheme. First, it capture the behaviour of the tools, including what is shown to the user. Second, it eases the job of a hacker who wants to add a new test for a new behaviour of a given tool. The user just has to provide: 1/ A new reference output of the new use case of the tool (that is easily constructed by using the tool itself and saving its output) and add an entry to array of entries that describe what to compare 2/ A new set of inputs to the tool And voila. Unfortunately, fedabipkgdiff tests don't follow this scheme. That make them surprising to hackers who read the source code of the existing tests, at very least. Also, the fedabipkgdiff tests were only unit tests. They were not testing the tool as used by users in general. This patch makes the fedabipkgdiff tests follow the general approach of the tests of the other Libabigail tools. The patch first craetes a program names tests/mockfedabipkgdiff. It's a wrapper around tools/fedabipkgdiff. It overloads the Koji client of fedabipkgdiff with a fake Koji client that gets the Fedora packages locally, from tests/data/test-fedabipkgdiff/packages. In other words, mockfedabipkgdiff is fedabipkgdiff without going to the network. I believe that in the future, tests/mockfedabipkgdiff should be killed when fedabipkgdiff is able to cache a local description of a local partial view of a Koji repository, along with the build packages that were already downloaded. That way, calling fedabipkgdiff twice with the same set of option should make the tool perform correctly without going to the netword on the second invocation. We should be able to save the local partial view of the Koji repository under e.g, tests/data/test-fedabipkgdiff/local-koji and tell fedabipkgdiff to use that, instead of using the network. But we are not there yet. So for now, I am using mockfedabipkgdiff. Then, tests/runtestfedabipkdiff.py.in has been re-written to use tests/mockfedabipkgdiff and to look like what is described in CONTRIBUTING as far as how Libabigail tools' tests are organized: mockfedabipkgdiff is called to perform a comparison. The result of the comparison is then compared (using GNU diff) to a reference comparison result file. Please note that tests/runtestfedabipkdiff.py is relatively fast for the moment. But when it contains much more tests and start becoming slow, then we'll need to change the code to run several comparisons in parallel, just like we do today in tests/test-diff-filter.cc. At that point, I believe I'll just re-write this in C++, just like tests/test-diff-filter.cc because that will allow us to have true concurrent code based on the abigail:workers API. For now, I am keeping this in Python also because I think that keeps Chenxiong happy ;-) To be sure that fedabipkgdiff (and its underlying abipkgdiff) are really comparing all the packages they are supposed to compare and also all the binaries in those packages, I have added a new --show-identical-binaries to abipkgdiff and fedabipkgdiff. That option shows the name of the binaries (and packages) that are compared, *even if* the ABI of those binaries are identical. Because otherwise, today, if two binaries (or packages) have the same ABI, nothing is displayed. For instance, here is the result of comparing a package against itself, using this new --show-identical-binaries options: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ./build/tools/abipkgdiff --show-identical-binaries dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: ================ changes of 'dbus-binding-tool'=============== No ABI change detected ================ end of changes of 'dbus-binding-tool'=============== ================ changes of 'libdbus-glib-1.so.2.1.0'=============== No ABI change detected ================ end of changes of 'libdbus-glib-1.so.2.1.0'=============== dodji@adjoa:patches$ And here is what this command before that patch would do: dodji@adjoa:patches$ ./tools/fedabipkgdiff --abipkgdiff ../master/build/tools/abipkgdiff dbus-glib-0.80-3.fc12.x86_64.rpm dbus-glib-0.80-3.fc12.x86_64.rpm Comparing the ABI of binaries between dbus-glib-0.80-3.fc12.x86_64.rpm and dbus-glib-0.80-3.fc12.x86_64.rpm: dodji@adjoa:patches$ The rest of the patch is mostly new test inputs material and the necessary adjustments following all the changes above. * configure.ac: Do not require Python dependencies itertools, unittest and StringIO anymore as they are not used anymore. Require new module tempfile now. Generate new executable script tests/mockfedabipkgdiff from tests/mockfedabipkgdiff.in. * doc/manuals/abipkgdiff.rst: Add doc for new option --show-identical-binaries to abipkgdiff * doc/manuals/fedabipkgdiff.rst: Add doc for new options --show-identical-binaries to fedabipkgdiff. * tools/abipkgdiff.cc (options::show_identical_binaries): New data member. (options::options): Initialize new data member. (display_usage): Add a new help string for the new --show-identical-binaries option. (parse_command_line): Parse the newq --show-identical-binaries command line switch. (pthread_routine_compare): When the comparison of two binaries is empty, if --show-identical-binaries was provided, then emit some output saying the comparison did yield the empty set. * tools/fedabipkgdiff (DEFAULT_ABIPKGDIFF): Store the default path to abipkgdiff in this new global variable. Naming this default path is useful because it can then be cleanly overloaded when using mock.patch. (build_path_to_abipkgdiff): Return the new DEFAULT_ABIPKGDIFF global variable. (cmd): Parse the new --show-identical-binaries command line switch. * tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt: New reference output. * tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt: Likewise. * tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt: Likewise. * tests/mockfedabipkgdiff.in: New uninstalled script template. * tests/runtestfedabipkgdiff.py.in (counter) (temp_file_or_dir_prefix, UtilsTest, RPMTest, LocalRPMTest) (RunAbipkgdiffTest, GetPackageLatestBuildTest, DownloadRPMTest) (BrewListRPMsTest, AssertionHelper, MockGlobalConfig) (BUILT_ABIPKGDIFF, CompareABIFromCommandLineTest): Remove these classes, global variables and functions. (FEDABIPKGDIFF, TEST_SRC_DIR, TEST_BUILD_DIR, INPUT_DIR) (OUTPUT_DIR, FEDABIPKGDIFF_TEST_SPECS): New global variables. (ensure_output_dir_created, run_fedabipkgdiff_tests, main): New functions. * tests/test-diff-pkg.cc (in_out_specs): Add tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt to the set of reference outputs to consider. * tests/Makefile.am: Add non-installed script mockfedabipkgdiff to source distribution. Also added tests/data/test-diff-pkg/test-dbus-glib-0.80-3.fc12.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt, tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt, tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt and tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt to source distribution. Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
b36ca1501e |
Bug 20180 - Support system-wide suppression specifications
This patch adds support for loading system and user level suppression specifications for libabigail tools. At launch time, relevant libabigail tools (abidiff, abipkgdiff fedabipkgdiff for now) read the default system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_SYSTEM_SUPPRESSION_FILE, if set, or from the file $libdir/libabigail/default.abignore. Then it reads the user system suppression specification file, if it's present, from a file which path is the value of the environment variable LIBABIGAIL_DEFAULT_USER_SUPPRESSION_FILE, if set, or from the file $HOME/.abignore. The content of the user system suppression file is merged with the content of default system suppression file. That content is also merged with the content of the suppression specification files that might be provided by the --suppressions command line option of the invoked tools. The resulting set of all these suppression specifications is thus used to filter the ABI change reports that are emitted. abidiff, abipkgdiff and abipkgdiff gain a --no-default-suppression option to avoid loading any of these default suppression specification files. The patch also installs a default.abignore file into $(pkglibdir). Note that on x86_64, that directory is /usr/lib64/libabigail. Now we just need to think about the content of that default.abignore file. * doc/manuals/abidiff.rst: Document the default suppression scheme, its interaction with the --supprs option and the new --no-default option. * doc/manuals/abipkgdiff.rst: Likewise. * doc/manuals/fedabipkgdiff.rst: Likewise. * configure.ac: Generate the tests/runtestdefaultsupprs.py file from the new tests/runtestdefaultsupprs.py.in template. * default.abignore: New file. * Makefile.am: Add it to source distribution. * src/Makefile.am: Define the ABIGAIL_ROOT_SYSTEM_LIBDIR preprocessor macro that is set the value of the $libdir autotools macro. * include/abg-tools-utils.h: Update copyright years. (get_system_libdir, get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Declare new functions * src/abg-tools-utils.cc (get_system_libdir) (get_default_system_suppression_file_path) (get_default_user_suppression_file_path) (load_default_system_suppressions) (load_default_user_suppressions): Define new functions. (is_regular_file): Amend this so that it return true for symlinks to regular files too. (is_dir): Amend this so that it returns true for symlinks to directories too. * tools/abidiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (display_usage): Display a new help string for the new --no-default-suppression command line option. (parse_command_line): Parse this new command line option. (set_diff_context_from_opts): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/abipkgdiff.cc (options::no_default_supprs): New data member. (options::options): Initialize the new data member. (parse_command_line): Parse the new --no-default-suppression command line option. (main): Load the default suppression specifications, unless --no-default-suppression or --supprs was provided. * tools/fedabipkgdiff (abipkgdiff): Add --no-default-suppression to the invocation of abipkgdiff if it was provided on the command line. (build_commandline_args_parser): Parse the new --no-default-suppression command line option. * tests/runtestdefaultsupprs.py.in: New test harness template. * tests/Makefile.am: Add the new runtestdefaultsupprs.py to the set of tests. * tests/data/test-default-supprs/test0-type-suppr-0.suppr: New test input. * tests/data/test-default-supprs/test0-type-suppr-report-0.txt: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v0.o: Likewise. * tests/data/test-default-supprs/test0-type-suppr-v1.o: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir-report-0.txt: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir1: Likewise. * tests/data/test-default-supprs/dirpkg-1-dir2: Likewise. * tests/data/Makefile.am: Add new the new tests input above to Makefile.am. * tests/runtestcanonicalizetypes.sh.in: Pass --no-default-suppression to abidiff invocations. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/test-abidiff-exit.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abidiff.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
e19bf5627a |
Make abi{pkg}diff filter out changes about private types
This is to address the following enhancement requests: #19588 - Add a --headers-dir1 and --headers-dir2 option to abidiff #19948 - Add --devel-pkg1 and --devel-pkg2 options to abipkgdiff When the user specifies where to find header files for two binaries (or packages) being compared, this patch generates a type suppression specification that filters out change reports about types that are defined in files that are not in the set of header files specified. The type suppression specification also suppresses change reports about changed/added/removed virtual member functions which enclosing class type matches the type suppression specification. There is a corner case that the patch handles too, and that is exhibited by the accompanying test case for abidiff. There can be a class defined by DWARF as having no source location and as being a pure declaration. This can be a class declaration that has inline virtual members only, and one or several non-defined virtual methods too. When that declaration is included in a source file, GCC generates debug info that describes that class as being a declaration-only class with no source declaration. This patch considers such a class as being non defined; you know, like a true opaque type. So it's considered being not defined in any public header file. Changes to this kind of class are thus filtered out. * include/abg-comp-filter.h: Update copyright year. * src/abg-comp-filter.cc (has_virtual_mem_fn_change): Make this static function become exported. (has_virtual_mem_fn_change): Declare new function. * include/abg-suppression.h (suppression_base::{get,set}_is_artificial): Declare new accessors. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Add a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. * src/abg-suppression.cc (suppression_base::priv::is_artificial_): New data member. (suppression_base::priv::priv): Initialize the new data member. (suppression_base::{get,set}_is_artificial): Define new accessors. (type_suppression::priv::source_locations_to_keep_): Change the vector of strings representing source file names into unordered set of string. (type_suppression::get_source_locations_to_keep): Return an unordered set of strings, not a vector. Define a non-const overload. (type_suppression::set_source_locations_to_keep): Set an unordered set of strings, not a vector. (type_suppression::suppresses_diff): Make this suppress virtual member function diffs if the enclosing type of the changed virtual member is suppressed by the current type_suppression. (read_type_suppression): Adjust to use the fact that the source locations are not stored in an unordered set, not in a vector anymore. Otherwise, using a vector here make things too slow. (type_suppression::suppresses_type): Likewise. Also, If the type we are looking at has no location because it's a true opaque type and if the current suppression is an artificial suppression that is meant to suppress change reports about non-public types, then suppress the type. * include/abg-tools-utils.h (gen_suppr_spec_from_headers): Declare new public function. * src/abg-tools-utils.cc (PRIVATE_TYPES_SUPPR_SPEC_NAME): Define a new constant variable. (handle_fts_entry): Define new static function. (gen_suppr_spec_from_headers): Define new public function. * src/abg-comparison.cc (corpus_diff::priv::apply_suppressions_to_added_removed_fns_vars): If a type suppression suppresses a given class C, make it change added/removed virtual functions whose enclosing type is C. * tools/abidiff.cc (options::{headers_dir1, headers_dir2}): New data members. (display_usage): Add help strings for --headers-dir1 and --headers-dir2. (parse_command_line): Parse the new --headers-dir1 and --headers-dir2 options. (set_diff_context_from_opts): Generate suppression specifications to filter out changes on private types, if --headers-dir1 or --headers-dir2 is given. * tools/abipkgdiff.cc (options::{devel_package1, devel_package2}): New data members. (typedef package_sptr): New typedef. (enum package::kind): New enum. (package::kind_): New data member. This replaces ... (package::is_debug_info_): ... this data member. (package::{devel_package_, private_types_suppressions_}): New data members. (package::package): Adjust. (package::get_kind): Define new member function. This replaces ... (package::is_debug_info): ... this member function overload. (package::set_kind): Define new member functin. It replaces ... (package::is_debug_info): ... this member function overload. (package::{devel_package, private_types_suppressions}): Define new accessors. (package::erase_extraction_directies): Erase the sub-directory where development packages are extracted to. (compare_args::private_types_suppr{1,2}): New data members. (compare_args::compare_args): Adjust. (display_usage): Add help strings for --devel-pkg1/--devel-pkg2. (compare): Make the overload that compares elf files take private types suppressions. Add the private types suppressions to the diff context. (pthread_routine_compare): Adjust the call to compare. (maybe_create_private_types_suppressions): Define new static function. (pthread_routine_extract_pkg_and_map_its_content): If a devel package was specified for the main package then extract it in parallel with the other package extraction. When the extraction is done, create private types suppressions by visiting the directories that contain the header files. (compare): In the overload that compares packages by scheduling comparison of individual elf files that are in the packages, pass in the private type suppressions too. (parse_command_line): Parse the new --devel-pkg{1,2} command line options. (main): Associate the devel package to the main package, if the --devel-pkg{1,2}. * doc/manuals/abidiff.rst: Add documentation about the new --headers-dir1 and --headers-dir2 options. * doc/manuals/abipkgdiff.rst: Likewise, add documentation about the new --devel-pkg1 and --devel-pkg2 libraries. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt: New test reference output. * tests/data/test-diff-pkg/tbb-devel-4.1-9.20130314.fc22.x86_64.rpm: New test input package. * tests/data/test-diff-pkg/tbb-devel-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/test-diff-pkg.cc b/tests/test-diff-pkg.cc (InOutSpec::{first,second}_in_devel_package_path): New data members. (in_out_specs): Adjust. Also, add a new entry describing the new test inputs above. (test_task::perform): When the new test entry contains devel packages, pass them to abipkgdiff using the --devel1 and --devel2 options. * tests/data/test-diff-suppr/test30-include-dir-v0/test30-pub-lib-v0.h: A new test input source code. * tests/data/test-diff-suppr/test30-include-dir-v1/test30-pub-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v0.h: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.cc: Likewise. * tests/data/test-diff-suppr/test30-priv-lib-v1.h: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.cc: Likewise. * tests/data/test-diff-suppr/test30-pub-lib-v0.so: Add new test binary input. * tests/data/test-diff-suppr/test30-pub-lib-v1.cc: Add new test input source code. * tests/data/test-diff-suppr/test30-pub-lib-v1.so: Add new test binary input. * tests/data/test-diff-suppr/test30-report-0.txt: Add new test reference output. * tests/data/test-diff-suppr/test30-report-1.txt: Add new test reference output. * tests/test-diff-suppr.cc (InOutSpec::headers_dir{1,2}): New data members. (InOutSpec::abidiff_options): Renamed the bidiff_options data member into this. (in_out_specs): Adjust. Also, added the new test input above to this. (main): Adjust to invoke abidiff with the new --hd1 and --hd2 options if the input specs for the tests has the new InOutSpec::headers_dir{1,2} data member set. Renamed bidiff into abidiff. * tests/data/Makefile.am: Add the new test inputs to the source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Sinny Kumari
|
8944ceb9ef |
Bug 19961 - Distinguish between PI executable and shared library
In the ELF format, Position Independent Executables (aka PIE) and shared libraries are marked as being of type ET_DYN. So just looking at the type of the ELF file is not enough to discriminate a position independent executable from a shared library. And this is the problem. Libabigail just looks at the type of the ELF file to discriminate PIE binaries from shared libraries binaries. So it treats both kinds of binaries as being shared libraries. When we run abipkgdiff with the --dso-only option, the tool considers both PIEs and shared libraries, even though the intent of the --dso-only option is have the tool consider shared libraries only. With this patch, we introduce a new enumerator ELF_TYPE_PI_EXEC (to the elf_type enum) for PIE binaries. From now on, a file will be properly recognized as being of the ELF_TYPE_DSO kind only if it is a shared library. * include/abg-dwarf-reader.h (elf_type): Add new enumerator ELF_TYPE_PI_EXEC. * src/abg-dwarf-reader.cc (lookup_data_tag_from_dynamic_segment): New function for data tag lookup in dynamic segment of an elf (elf_file_type): Return ELF_TYPE_PI_EXEC file type for a PI executable. (get_elf_file_type): Change this to take an elf handle. (get_type_of_elf_file): New function that got factorized out of ... (load_dt_soname_and_needed): ... this one. * tools/abipkgdiff.cc (create_maps_of_package_content): Also consider ELF_TYPE_PI_EXEC file type. (compare): Likewise. * tests/test-diff-pkg.cc (in_out_specs): Test case additions * tests/data/Makefile.am: Include test files * tests/data/test-diff-pkg/tarpkg-1-dir1.tar.gz: New test data * tests/data/test-diff-pkg/tarpkg-1-dir2.tar.gz: New test data * tests/data/test-diff-pkg/tarpkg-1-report-0.txt: New test result Signed-off-by: Sinny Kumari <sinny@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d06c4cd2ca |
Fix comments in tests/test-diff-pkg.cc
* tests/test-diff-pkg.cc: Fix the wording of the introductory comments. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
67435cf6cd |
Bug 19867 - abipkgdiff skips symbolic links
When comparing two directories, abipkgdiff skips symbolic links pointing to ELF binaries altogether. It only consider regular files. This is a problem when abipkgdiff is given two directories that only contain symbolic links. In that case, abipkgdiff just performs no comparison. This patch makes abipkgdiff resolve the symbolic link to its target file. * include/abg-tools-utils.h (maybe_get_symlink_target_file_path): Declare new function. * src/abg-tools-utils.cc (get_stat): Use lstat here, not stat. Update comment. * tools/abipkgdiff.cc (first_package_tree_walker_callback_fn) (second_package_tree_walker_callback_fn): Follow symbolic links to elf files to get their target paths, and only work with that target path. (maybe_get_symlink_target_file_path): Define new function. * test-diff-pkg/symlink-dir-test1-report0.txt New test material. * test-diff-pkg/symlink-dir-test1/dir1/symlinks/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/symlinks/libfoo.so: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/targets/foo.c: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/targets/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir1/targets/libfoo.so: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/symlinks/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/symlinks/libfoo.so: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/targets/foo.c: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/targets/foo.o: Likewise. * test-diff-pkg/symlink-dir-test1/dir2/targets/libfoo.so: Likewise. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-pkg.cc (in_out_spec): Run this test harness over the new test material above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
10b029b385 |
Bug 19844 - Cannot try to canonicalize a type that is being constructed
maybe_canonicalize_type aborts because the assertion that read_context::lookup_type_from_die_offset should always return a type is violated. read_context::lookup_type_from_die_offset is called on the offset of a DIE of a type that is being constructed. The problem is that that fonction only looks in the map of types that are fully constructed. This patch addresses the issue by making read_context::lookup_type_from_die_offset look up class and function types being constructed as well. While doing that I had to add maps for class and function types being constructed and that are in the alternate debug info section. I adjusted the accessors for class and function types accordingly. The code using those accessors was adjusted accordingly as well. The patch also prevents maybe_canonicalize_type for DIEs which no type was built for, in buid_ir_node_from_die. This is particularly for DW_TAG_class_type and DW_TAG_structure_type DIEs. * src/abg-dwarf-reader.cc (read_context::{alternate_die_wip_classes_map_, alternate_die_wip_function_types_map_}): New data members. (read_context::lookup_type_from_die_offset): Lookup WIP class and function types too. (read_context::{die_wip_classes_map, die_wip_function_types_map}): Take a flag saying if we should get the map for the alternate debug info section or not. (read_context::{is_wip_class_die_offset, is_wip_function_type_die_offset}): Take a flagy saying if the DIE is in the alternate debug info section or not. (build_class_type_and_add_to_ir, build_function_type) (maybe_canonicalize_type): Adjust. (build_ir_node_from_die): Do not call maybe_canonicalize_type on type DIEs which no type has been constructed for. * tests/data/test-diff-pkg/gtk2-debuginfo-2.24.22-5.el7.i686.rpm: New test input. * tests/data/test-diff-pkg/gtk2-debuginfo-2.24.28-8.el7.i686.rpm: Likewise. * tests/data/test-diff-pkg/gtk2-immodule-xim-2.24.22-5.el7.i686.rpm: Likewise. * tests/data/test-diff-pkg/gtk2-immodule-xim-2.24.28-8.el7.i686.rpm: Likewise. * tests/data/test-diff-pkg/gtk2-immodule-xim-2.24.22-5.el7.i686--gtk2-immodule-xim-2.24.28-8.el7.i686-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-pkg.cc (in_out_spec): Make this test harness run on the new test input above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d611e96460 |
Fix potential race condition in test-diff-pkg.cc
The output of several tar file tests for abipkgdiff have the same name. This is can be a race condition now that these tests are run in parallel, potentially. This patch fixes the issue by giving each test output file a different name. * tests/test-diff-pkg.cc (in_out_spec): Make the tar format tests output have different names. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
326992f0e1 |
Bug 19780 - abipkgdiff doesn't support parallel execution
package::extracted_packages_parent_dir() is not returning a unique directory path. So several abipkgdiff processes end up using the same temporary directory. Ooops. This patch addresses the issue by making that function use mkdtemp(). The patch also makes the unit tests for abipkgdiff run the instances of abipkgdiff in parallel so that we test this once and for all. * tools/abipkgdiff.cc: Update copyright notice. (package::extracted_packages_parent_dir): Use mkdtemp to generate the unique root directory under which packages are extracted. * tests/test-diff-pkg.cc (struct test_task): New type. (main): Use worker threads to run abipkgdiff in parallel, depending on the number of CPUs advertised by the underlying machine. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
3cf729c3ee |
Bug 19778 - diff_has_ancestor_filtered_out() loops forever
It appears that there can be cycles in the path made of ancestors. In that case, diff_has_ancestors_filtered_out() just loops forever. Oops. This patch addresses that issue by making diff_has_ancestors_filtered_out() detect cycles. * src/abg-comparison.cc (diff_has_ancestor_filtered_out): Add an overload that takes an additional map of pointer values. Make the older overload call the new one. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm: New test material. * tests/data/test-diff-pkg/libICE-1.0.6-1.el6.x86_64.rpm--libICE-1.0.9-2.el7.x86_64.rpm-report-0.txt: New reference output. * tests/data/test-diff-pkg/libICE-1.0.9-2.el7.x86_64.rpm: New test material. * tests/data/test-diff-pkg/libICE-debuginfo-1.0.6-1.el6.x86_64.rpm: New test material. * tests/data/test-diff-pkg/libICE-debuginfo-1.0.9-2.el7.x86_64.rpm: New test material. * tests/data/Makefile.am: Add the new test material to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Run this test harness over the new tests material above. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
ef2211831f |
Use proper WIFEXITED and WEXITSTATUS macros to get exit code
It turns out we were wrongly getting the exit code of some processes being executed by the "system()" invocation. The patch uses the WIFEXITED and WEXITSTATUS macro as documented in the man page for "system". * tests/test-diff-dwarf-abixml.cc (main): Use WIFEXITED and WEXITSTATUS macros to get the return code of the abidiff program. * tests/test-diff-filter.cc (test_task::perform): Likewise. * tests/test-diff-pkg.cc (main): Likewise. * tests/test-diff-suppr.cc (main): Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
f275939df2 |
Use worker threads pattern to speed up some tests
We are going to need to speed up more and more tests, and coding directly with libpthread for that can be tedious and bug-prone. So I devised an implementation for the worker threads design pattern instead, and used it to speed up some tests. * include/Makefile.am: Add the new abg-workers.h to source distribution. * include/abg-workers.h: New file. * src/Makefile.am: Add the new abg-worker.cc to source distribution. * src/abg-workers.cc: New file. * tests/test-utils.cc: Update copyright. Make get_src_dir() and get_build_dir() return a const char*, as opposed to returning a string. Make that const char reside in thread local storage, so that two concurrent threads can safely call these functions in parallel, without any race. * tests/test-utils.h: Make get_src_dir() and get_build_dir() return a const char*, as opposed to returning a string. * tests/test-abicompat.cc: Update copyright. Adjust for get_src_dir() and get_build_dir() change. * tests/test-abidiff.cc: Likewise. * tests/test-alt-dwarf-file.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-diff-dwarf-abixml.cc: Likewise. * tests/test-diff-dwarf.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-types-stability.cc: Likewise. Use the new task queue type to run these tests in parallel. * tests/test-diff-filter.cc: Likewise. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
6f00afe353 |
Fix regression on the support for alternate debug info files
My commit "5a8c000 Bug 19355 - Libabigail slow on r300_dri.so" introduced a faster way of getting the logical parent of a DIE, when one of its ancestor DIEs has been imported into a the current translation unit. But then that commit broke the support for alternate debug info files. Oops. This commit brings back the support for alternate debug info files. * src/abg-dwarf-reader.cc (imported_unit_point::imported_unit_from_alt_di): New data member. (imported_unit_point::imported_unit_point): Adjust. (read_context::alt_tu_die_imported_unit_points_map_): New data member. (read_context::alt_tu_die_imported_unit_points_map): New accessor. (die_die_attribute): Remove the overload which doesn't say if the resulting DIE comes from alternate debug info. (build_die_parent_relations_under): Take a new flag which says if we are building the relations about DIEs in the alternate debug info section or not. Use that flag to know if the imported unit trace we are building is for an alternate debug info file or not. (build_die_parent_maps): Build two different imported unit point trace vectors: one for the main debug info file, and another one for the alternate debug info file. (find_import_unit_point_between_dies): Take a flag that says if the beginning of the search is a DIE in the alternate debug info file or not. Use it to know if we should use the import point trace vectors from alternate debug info or from the main debug info file. When the import point trace vector is empty, return immediatly. (get_parent_die): If the parent DIE is a DW_TAG_partial_unit which hasn't been imported into this TU, then assume the logical parent is the DIE for the current translation unit. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Reference test output. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64.rpm: New input test rpm. * tests/data/test-diff-pkg/tbb-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/tbb-debuginfo-4.1-9.20130314.fc22.x86_64.rpm: Likewise. * tests/data/test-diff-pkg/tbb-debuginfo-4.3-3.20141204.fc23.x86_64.rpm: Likewise. * tests/data/Makefile.am: Add the new test materials to the source distribution. * tests/test-diff-pkg.cc (int_out_specs): Add the new rpms to the list of rpms to test against. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
6a7566d513 |
Add the option of printing the file, line and column information about a type being reported.
* bash-completion/abicompat: Complete the new "--no-show-locs" option. * bash-completion/abidiff: Likewise. * bash-completion/abidw: Likewise. * bash-completion/abipkgdiff: Likewise. * doc/manuals/abicompat.rst: Mention the new "--no-show-locs" option. * doc/manuals/abidiff.rst: Likewise. * doc/manuals/abidw.rst: Likewise. * doc/manuals/abipkgdiff.rst: Likewise. * include/abg-comparison.h (show_locs): Add declarations. * src/abg-comparison.cc: (diff_context::priv): Add a new switch called "show_locs_" and set its default value to false. (report_loc_info): New function. Outputting the extra information is conditionalized based on the associated diff contexts settings. (show_locs): define a getter/setter for diff_context::priv::show_locs_. ({distinct,pointer,reference,qualified_type,enum,class,scope,fn_parm, typedef,corpus}_diff::report): Call report_loc_info when appropriate. (maybe_report_diff_for_member): Likewise. (represent): Accept a const reference to a diff_context_sptr as a first argument and call report_loc_info on its second argument. * src/abg-dwarf-reader.cc: * tests/data/Makefile.am: Add the new test reference files. * tests/data/test-abicompat/test0-fn-changed-report-2.txt: New test reference output. * tests/data/test-abicompat/test5-fn-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test6-var-changed-report-1.txt: Likewise. * tests/data/test-abicompat/test7-fn-changed-report-2.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt: Likewise. * tests/data/test-diff-filter/test31-pr18535-libstdc++-report-1.txt: Likewise. * tests/data/test-diff-pkg/dirpkg-3-report-2.txt: Likewise. * tests/data/test-diff-suppr/test6-fn-suppr-report-0-1.txt: Likewise. * tests/test-abidiff.cc: Explicitly create a diff context and turn off location emitting. * tests/test-diff-dwarf.cc: Likewise. * tests/test-abicompat.cc: Add --no-show-locs to all existing test arguments. Run a few of the existing tests again, but without this option. * tests/test-diff-filter.cc: Likewise. * tests/test-diff-pkg.cc: Likewise. * tests/test-diff-suppr.cc: Likewise. * tools/abicompat.cc: Handle the new "--no-show-locs" option. * tools/abidiff.cc: Likewise. * tools/abidw.cc: Likewise. * tools/abipkgdiff.cc: Likewise. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> |
||
Dodji Seketeli
|
7722e27a89 |
Do not abort when there is no binary to compare in a package
When given a package which has no binary to compare, abipkgdiff aborts. This patch fixes that. * tests/data/test-diff-pkg/empty-pkg-libvirt-0.9.11.3-1.el7.ppc64.rpm: New input test package. * tests/data/test-diff-pkg/empty-pkg-libvirt-1.2.17-13.el7_2.2.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/empty-pkg-report-0.txt: New test reference output. * data/Makefile.am: Add the new test material above to the build system. * tests/test-diff-pkg.cc (int_out_specs): Add the new test inputs to the set of tests. * tools/abipkgdiff.cc (compare): Do not abort if there is no binary to compare. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
18c3ce3e56 |
Correctly handle fn DIE with abstract_origin in alt debug info
When a function decl DIE is in the main DWARF file but has an abstract origin that is in the alternate DWARF file, the dwarf reader mistakenly considers the resulting function decl as being for a DIE that is in the alternate DWARF file. Fixed thus. * src/abg-dwarf-reader.cc (build_ir_node_from_die): Consider that the function decl is for a DIE in the alternate debug info file only if the DIE itself comes from the alternate debug info file, not if the specification or the origin of the function comes from the alternate debug info file. * tests/data/test-diff-pkg/qemu-img-rhev-2.3.0-20.el7.ppc64.rpm: New test input rpm. * tests/data/test-diff-pkg/qemu-img-rhev-2.3.0-7.el7.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/qemu-kvm-rhev-debuginfo-2.3.0-20.el7.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/qemu-kvm-rhev-debuginfo-2.3.0-7.el7.ppc64.rpm: Likewise. * tests/data/test-diff-pkg/qemu-img-rhev-2.3.0-7.el7.ppc64--qemu-img-rhev-2.3.0-20.el7.ppc64-report-0.txt: New test reference output. * tests/data/Makefile.am: Add the new test material to the source distribution. * tests/test-diff-pkg.cc (in_out_specs): Use the new test rpm inputs. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Ondrej Oprala
|
b2a5bf6389 |
Bug 19082 - Recognize suppression spec files
When abipkgdiff is invoked on a set of packages, the newer (second) one is also inspected for files matching the pattern '*.abignore', whose contents are read and interpreted as suppression specifications. * tests/data/Makefile.am: Add new test material to the build system. * tests/data/test-diff-pkg/dirpkg-{0-dir1,{1,2}-dir2}/dir.abignore: A test suppression specification. * tests/data/test-diff-pkg/dirpkg-{2,3}-dir2/.abignore: Likewise. * tests/data/test-diff-pkg/dirpkg-3.suppr: Likewise. * tests/data/test-diff-pkg/dirpkg-{1,2,3}-dir{1,2}/libobj-v0.so: New binary test inputs. * tests/data/test-diff-pkg/dirpkg-{1,2,3}-dir{1,2}/obj-v0.cc: New test source files * tests/data/test-diff-pkg/dirpkg-{1,2,3}-report-{0,1}.txt: New reference outputs * tests/test-diff-pkg.cc: Adjust to run the new tests. * tools/abipkgdiff.cc (prog_options): New static pointer to struct opts. (file_tree_walker_callback_fn): Rename to first_package_tree_walker_callback_fn. (second_package_tree_walker_callback_fn): Check for ELF files just like the previous function but additionally check for files ending with ".abignore", unless disabled from the command line. ({create_maps_of_package,extract_package_and_map_its}_content): Add a callback as a new argument. (main) handle the new "--no-abignore" option, which turns off the search for suppression files within the new package. Signed-off-by: Ondrej Oprala <ooprala@redhat.com> |
||
Dodji Seketeli
|
72b42c3090 |
Misc style cleanups
* configure.ac: Fix some spelling typos. * src/abg-tools-utils.cc (guess_file_type): Fix indentation. * tests/test-diff-pkg.cc (int_out_specs): Add some vertical spaces for better legibility. * tools/abidiff.cc (main): Add a missing space. * tools/abipkgdiff.cc (extract_deb): Fix a typo in the comment. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
585fc4c33c |
Make abipkgdiff compare tar archives containing binaries
This patch adds support for comparing the ABI of binaries contained in a tar archive. If the archive is compressed with gzip, bzip2, lzip, lzma or xz, then abipkgdiff recognizes the usual relevant file extensions and lets the GNU tar program handle the decompression. If the archive is not compressed, abipkgdiff recognizes the UStar (Uniform Standard Tape ARchive) format, even if the archive file name doesn't end with the .tar extension, and lets the GNU tar program handle the extraction. If the file ends up with the .tar extension anyway (even if it's not in the UStar format, abipkgdiff lets the GNU tar program handle its extraction. * config.h.in (WITH_TAR): New configuration preprocessor macro. * configure.ac: Add a new --enable-tar option. It's turned on automatically if the tar program is found in the PATH. Adjust the build configuration report to add the tar archive support. * include/abg-tools-utils.h (string_ends_with): Declare new function. (enum file_type): Add a new FILE_TYPE_TAR enumerator. * src/abg-tools-utils.cc (string_ends_with): Define new function. (operator<<(ostream&, file_type)): Serialize the new FILE_TYPE_TAR enumerator. (guess_file_type): Detect UStar format file by reading its magic number. Detect compressed tar files based on the file path extension. * tools/abipkgdiff.cc (extract_tar): Define new function. (extract_package): Handle tar packages. (main): Handle tar archives. * tools/abidiff.cc (main): Handle the new FILE_TYPE_TAR enumerator. * tools/abilint.cc (main): Likewise. * tests/data/test-diff-pkg/tarpkg-0-dir{1,2}.ta{,r,.bz2, gz}: New test input tarballs. * tests/data/test-diff-pkg/tarpkg-0-report-0.txt: New test output reference. * tests/data/Makefile.am: Add the new test data file above to source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add new tests cases. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
d7dbbf0d50 |
Make abipkgdiff compare directories containing binaries
abipkgdiff knows how to compare the ABI of binaries contained in .deb and .rpm files. This patch adds support for comparing the ABI of binaries contained in two directories. * include/abg-tools-utils.h (enum file_type): Add a new FILE_TYPE_DIR enumerator. * src/abg-tools-utils.cc (operator<<(ostream&, file_type)): Support serialization of the new FILE_TYPE_DIR enumerator. (guess_file_type): Detect that the path given is a directory. * tools/abipkgdiff.cc (package::package): If the package is a directory, then set its extracted directory path to the path of the directory. (package::erase_extraction_directory): Do not erase the extraction directory if the package is a directory provided by the user. (extract_package): If the package is a directory provided by the user, then there is nothing to extract. (main): If the first package is a directory, then the second one should be a directory as well. * tools/abidiff.cc (main): Support directories as input. * tools/abilint.cc (main): Likewise. * tests/data/test-diff-pkg/dirpkg-0-dir{1,2}/libobj-v0.so: New binary test inputs. * test/data/test-diff-pkg/dirpkg-0-report-0.txt: New input test file. * tests/data/test-diff-pkg/dirpkg-1-dir{1,2}/obj-v0.cc: Source code of the binary test inputs above. * tests/data/Makefile.am: Add the new files above to the source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the new test input files above to the set of tests this harness has to run over. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
28090bad1b |
Make the support of RPM and DEB package formats conditional
If at configure time the libabigail source tarball detects that rpm2cpio and cpio are present then it enables the support for rpm files. Users can explicitly enable or disable that support by passing --enable-rpm or --disable-rpm to configure. Similarly if it detects that dpkg is present at configure time then it enables the support for deb files. Users can explicitly enable or disable that support by passing --enable-deb or --disable-deb to configure. * config.h.in: Define WITH_DEB and WITH_RPM pre-processor macros. * configure.ac: Add --enable-{rpm,deb} switches. Check for rpm2cpio and cpio programs, unless --disable-rpm was provided. If they are found and if --enable-rpm=auto was provided, then consider that --enable-rpm=yes was provided. In that case, set the WITH_RPM macro to 1. Otherwise, undefine that macro. Similarly, check for dpkg unless --disable-deb was provided. If it's found and if --enable-deb=auto was provided, consider that --enable-deb=yes was provided. In that case, set the WITH_DEB macro to 1. Otherwise, undefine that macro. Define the ENABLE_RPM and ENABLE_DEB conditional automake variables, if the rpm resp. deb support is enabled. Emit a notice about the rpm and deb features being enabled or not, at the end of the configure process. * tests/test-diff-pkg.cc: Include the config.h header. (in_out_spec): Guard rpm tests by the WITH_RPM macro. Similarly, guard deb tests by the WITH_DEB macro. * tools/abipkgdiff.cc: Include the config.h header. (extract_rpm): Guard this function definition with the WITH_RPM macro. (extract_deb): Guard this function definition with the WITH_DEB macro. (extract_package): Guard the handling of rpm packages with the WITH_RPM macro and the handling of deb package with the WITH_DEB macro. If a package not-support package format is encountered, emit an appropriate error message and error out. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Matthias Klose
|
4df0a4d952 |
Add support for .deb files to abipkgdiff
This lets abipkgdiff compare debian binary packages. The patch contains test cases for debian package with split debug info that is referenced by the build-id scheme. These test cases come from the bug report https://sourceware.org/bugzilla/show_bug.cgi?id=18792, more particularly from the attachment https://sourceware.org/bugzilla/attachment.cgi?id=8516. * include/abg-tools-utils.h (file_type): Add FILE_TYPE_DEB. * tools/abipkgdiff.cc (extract_deb): New. (extract_package, main): Handle FILE_TYPE_DEB. * src/abg-tools-utils.cc (operator<<): Handle FILE_TYPE_DEB. (guess_file_type): Detect FILE_TYPE_DEB. * tools/abidiff.cc (main): Handle FILE_TYPE_DEB. * tools/abilint.cc (main): Handle FILE_TYPE_DEB. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a-dbgsym_2.4.0-1_amd64.ddeb: Input debian debug info package; to be compared by the test harness runtestdiffpkg. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64.deb: Input debian package; to be compared by the test harness runtestdiffpkg. * tests/data/test-diff-pkg/libsigc++-2.0-0v5-dbgsym_2.4.1-1ubuntu2_amd64.ddeb: Input debug info package * tests/data/test-diff-pkg/libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64.deb: Input debian package; to be compared by the test harness runtestdiffpkg. * tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt: Reference output for the comparison of the packages above. * tests/data/Makefile.am: Add the new files above to the source distribution. * tests/test-diff-pkg.cc (in_out_specs): Add the input packages above to the set of files to be compared by this test harness. Signed-off-by: Matthias Klose <doko@debian.org> Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Dodji Seketeli
|
9f7c07460d |
Add --no-added-syms to abipkgdiff
With this new option the tool ignores added functions, variables and their symbols. * tools/abipkgdiff.cc (options::show_added_syms): New data member. (options::options): Initialize it. (parse_command_line): Parse the new --no-added-syms option and set the options::show_added_syms flag accordingly. (display_usage): Add a help string for the new option. (set_diff_context_from_opts): Set the diff context according to the state of the new options::show_added_syms flag. * doc/manuals/abipkgdiff.rst: Add manual entry for the new --no-added-syms options. * tests/data/test-diff-pkg/test-rpm-report-5.txt: New test reference input file. * tests/data/Makefile.am: Add the new file above to source distribution. * tests/test-diff-pkg.cc (InOutSpec::prog_options): New data member. (in_out_specs): Adjust. Add a new input to run the test again with --no-added-syms. (main): Adjust to pass the program options contained in InOutSpec::prog_options to abipkgdiff. Signed-off-by: Dodji Seketeli <dodji@redhat.com> fixup! Add --no-added-syms to abipkgdiff Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
Sinny Kumari
|
260b92f5df |
Add regression tests for abipkgdiff tool
Add tests for the abipkgdiff tool. The tests runs abipkgdiff on RPM packages. RPMs for test data are taken from Fedora koji build with build id - 106158 and 648058 * tests/Makefile.am: Build new runtestdiffpkg regression test * tests/data/Makefile.am: Add new test files to source * tests/data/test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm: Test data for abipkgdiff tool * tests/data/test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm: Likewise * tests/data/test-diff-pkg/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm: Likewise * tests/data/test-diff-pkg/dbus-glib-debuginfo-0.80-3.fc12.x86_64.rpm: Likewise * tests/data/test-diff-pkg/test-rpm-report-0.txt: Expected test output * tests/data/test-diff-pkg/test-rpm-report-1.txt: Likewise * tests/data/test-diff-pkg/test-rpm-report-2.txt: Likewise * tests/data/test-diff-pkg/test-rpm-report-3.txt: Likewise * tests/data/test-diff-pkg/test-rpm-report-4.txt: Likewise * tests/test-diff-pkg.cc: New file Signed-off-by: Sinny Kumari <sinny@redhat.com> |