libabigail/tests/test-annotate.cc

193 lines
5.2 KiB
C++
Raw Normal View History

Re-license the project to Apache v2 With LLVM Exception Thanks to the previous work done, changing the license is just a matter of changing the SPDX identifer from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception". Note that for the abigail.m4, tests/test-dot.cc and tests/test-svg.cc the change was from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception". include/abg-cxx-compat.h was changed from "LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception". Source code of programs (as opposed to source code of the library) where generally licensed under GPL-3.0-or-later; they are also now licensed "Apache-2.0 WITH LLVM-exception". This is what this patch does. * abigail.m4: Change the SPDX identifier from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception" * include/abg-cxx-compat.h: Change the SPDX identifier from "LGPL-2.0-or-later" to "Apache-2.0 WITH LLVM-exception". * .clang-format: Change the SPDX identifier from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception". * Makefile.am: Likewise. * bash-completion/Makefile.am: Likewise. * bash-completion/abicompat: Likewise. * bash-completion/abidiff: Likewise. * bash-completion/abidw: Likewise. * bash-completion/abilint: Likewise. * bash-completion/abinilint: Likewise. * bash-completion/abipkgdiff: Likewise. * bash-completion/abisym: Likewise. * bash-completion/fedabipkgdiff: Likewise. * configure.ac: Likewise. * default.abignore: Likewise. * doc/Makefile.am: Likewise. * doc/api/libabigail.doxy: Likewise. * doc/manuals/Makefile.am: Likewise. * doc/website/libabigail-website.doxy: Likewise. * include/Makefile.am: Likewise. * include/abg-comp-filter.h: Likewise. * 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-regex.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-version.h.in: 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. * scripts/dot_to_png.sh: Likewise. * scripts/dot_to_svg.sh: Likewise. * scripts/make-verbose.sh: Likewise. * scripts/svg_to_plain_svg.sh: Likewise. * scripts/svg_to_png_and_pdf.sh: Likewise. * src/Makefile.am: 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-elf-helpers.cc: Likewise. * src/abg-elf-helpers.h: 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-regex.cc: Likewise. * src/abg-reporter-priv.cc: Likewise. * src/abg-reporter-priv.h: 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/Makefile.am: Likewise. * tests/data/Makefile.am: Likewise. * tests/lib/catch.cc: Likewise. * tests/mockfedabipkgdiff.in: Likewise. * tests/print-diff-tree.cc: Likewise. * tests/runtestcanonicalizetypes.sh.in: Likewise. * tests/runtestdefaultsupprs.py.in: Likewise. * tests/runtestdefaultsupprspy3.sh.in: Likewise. * tests/runtestfedabipkgdiff.py.in: Likewise. * tests/runtestfedabipkgdiffpy3.sh.in: 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-annotate.cc: Likewise. * tests/test-core-diff.cc: Likewise. * tests/test-cxx-compat.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-dot.cc: Change the SPDX identifier from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception" * tests/test-elf-helpers.cc: Change the SPDX identifier from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception" * tests/test-ini.cc: Likewise. * tests/test-ir-walker.cc: Likewise. * tests/test-kmi-whitelist.cc: Likewise. * tests/test-lookup-syms.cc: Likewise. * tests/test-read-dwarf.cc: Likewise. * tests/test-read-write.cc: Likewise. * tests/test-svg.cc: Change the SPDX identifier from "GPL-3.0-or-later WITH GCC-exception-3.1" to "Apache-2.0 WITH LLVM-exception". * tests/test-symtab.cc: Change the SPDX identifier from "LGPL-3.0-or-later" to "Apache-2.0 WITH LLVM-exception" * tests/test-tools-utils.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. * tests/update-test-output.py: Likewise. * tools/Makefile.am: 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/fedabipkgdiff: Likewise. * tools/kmidiff.cc: Likewise. * update-copyright.sh: Likewise. Signed-off-by: Benjamin De Kosnik <bkoz@gnu.org> Signed-off-by: Ben Woodard <woodard@redhat.com> Signed-off-by: Chenxiong Qi <cqi@redhat.com> Signed-off-by: Dodji Seketeli <dodji@redhat.com> Signed-off-by: Giuliano Procida <gprocida@google.com> Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Jessica Yu <jeyu@kernel.org> Signed-off-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Matthias Klose <doko@ubuntu.com> Signed-off-by: Matthias Maennich <maennich@google.com> Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> Signed-off-by: Roland McGrath <roland@hack.frob.com> Signed-off-by: Sinny Kumari <ksinny@gmail.com> Signed-off-by: Slava Barinov <v.barinov@samsung.com>
2020-05-29 14:26:04 +00:00
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
// -*- Mode: C++ -*-
//
// Author: Ondrej Oprala
/// @file
///
/// This program tests the annotation capabilities of the library.
#include <iostream>
#include <cstdlib>
#include "abg-tools-utils.h"
#include "test-utils.h"
using std::cerr;
using std::string;
using abigail::tests::emit_test_status_and_update_counters;
using abigail::tests::emit_test_summary;
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
struct InOutSpec
{
const char* in_elf_path;
const char* in_report_path;
const char* out_report_path;
};
InOutSpec in_out_specs[] =
{
{
"data/test-read-dwarf/test0",
"data/test-annotate/test0.abi",
"output/test-annotate/test0.abi"
},
{
"data/test-read-dwarf/test1",
"data/test-annotate/test1.abi",
"output/test-annotate/test1.abi"
},
{
"data/test-read-dwarf/test2.so",
"data/test-annotate/test2.so.abi",
"output/test-annotate/test2.so.abi"
},
{
"data/test-read-dwarf/test3.so",
"data/test-annotate/test3.so.abi",
"output/test-annotate/test3.so.abi"
},
{
"data/test-read-dwarf/test4.so",
"data/test-annotate/test4.so.abi",
"output/test-annotate/test4.so.abi"
},
{
"data/test-read-dwarf/test5.o",
"data/test-annotate/test5.o.abi",
"output/test-annotate/test5.o.abi"
},
{
"data/test-read-dwarf/test6.so",
"data/test-annotate/test6.so.abi",
"output/test-annotate/test6.so.abi"
},
{
"data/test-read-dwarf/test7.so",
"data/test-annotate/test7.so.abi",
"output/test-annotate/test7.so.abi"
},
{
"data/test-read-dwarf/test8-qualified-this-pointer.so",
"data/test-annotate/test8-qualified-this-pointer.so.abi",
"output/test-annotate/test8-qualified-this-pointer.so.abi"
},
{
"data/test-read-dwarf/test13-pr18894.so",
"data/test-annotate/test13-pr18894.so.abi",
"output/test-annotate/test13-pr18894.so.abi",
},
{
"data/test-read-dwarf/test14-pr18893.so",
"data/test-annotate/test14-pr18893.so.abi",
"output/test-annotate/test14-pr18893.so.abi",
},
{
"data/test-read-dwarf/test15-pr18892.so",
"data/test-annotate/test15-pr18892.so.abi",
"output/test-annotate/test15-pr18892.so.abi",
},
{
"data/test-read-dwarf/test17-pr19027.so",
"data/test-annotate/test17-pr19027.so.abi",
"output/test-annotate/test17-pr19027.so.abi",
},
{
"data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so",
"data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi",
"output/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi",
},
{
"data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so",
"data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi",
"output/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi",
},
{
"data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so",
"data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi",
"output/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi",
},
{
"data/test-read-dwarf/test21-pr19092.so",
"data/test-annotate/test21-pr19092.so.abi",
"output/test-annotate/test21-pr19092.so.abi",
},
{
"data/test-read-dwarf/libtest23.so",
"data/test-annotate/libtest23.so.abi",
"output/test-annotate/libtest23.so.abi",
},
{
"data/test-read-dwarf/libtest24-drop-fns.so",
"data/test-annotate/libtest24-drop-fns.so.abi",
"output/test-annotate/libtest24-drop-fns.so.abi",
},
{
"data/test-read-dwarf/libtest24-drop-fns.so",
"data/test-annotate/libtest24-drop-fns-2.so.abi",
"output/test-annotate/libtest24-drop-fns-2.so.abi",
},
Handle several member anonymous types of the same kind When there are several anonymous types (e.g, anonymous classes, unions or enums) in a given class or union, libabigail's internals do struggle. An anonymous class, for instance, is named __anonymous_struct__. When there are more than one of these inside a given class, then we can't name and look them up, because they all have the same name. Incidentally, when add_or_update_class_type completes a class type that was initially constructed before, it fails to determine that an anonymous member type of that class was already present in that context. It thus wrongly duplicates anonymous structs/unions/enums in there and that leads to spurious textual (abixml) representation differences later, where duplicated anonymous member types would appear intermittently, depending on the order in which the class was built. This patch addresses this general issue by naming anonymous member types in a way that allows several of them to exist. That is, if there are two anonymous structs in a class, they are going to be named __anonymous_struct__ and __anonymous_struct__1. We do follow a similar scheme for anonymous unions and enums. This is handled by the DWARF reader that builds the internal representation. While looking at this issue, I also fixed a tangent bug; some DWARF emitters wrongly *define* types in the scope of a DW_TAG_subroutine_type or DW_TAG_array_type. We handle that by actually defining those types in the scope of that subroutine or array. But then it appears that if that scope itself a class and if the type defined is an anonymous type, then putting that anonymous type in the class scope might interfere with the *naming* of the existing legit anonymous types of that scope. I decided to put those anonymous types in the containing namespace instead. We'll see how that goes in real time use. The patch also updates lots of existing tests and adds a new one. * include/abg-ir.h (class_or_union::get_num_anonymous_member_{classes, unions, enums}): Declare new member functions. * src/abg-dwarf-reader.cc (get_internal_anonynous_die_base_name) (build_internal_anonymous_die_name) (get_internal_anonymous_die_name, is_anonymous_type_die): Define new static functions. (die_qualified_type_name): Use the new get_internal_anonymous_die_name. (get_scope_for_die): Fix this to put anonymous types that were wrongly emitted into the scope of DW_TAG_subroutine_type or DW_TAG_array_type by buggy DWARF emitters into the enclosing namespace, rather than into the enclosing class/union. (build_enum_type): Take the scope of the enum to have a chance to properly name potential anonymous enums. (lookup_class_typedef_or_enum_type_from_corpus): Take an anonymous member type index for when the DIE we are lookup up represents an anonymous type. Support proper building of the internal anonymous name of the anonymous type we are lookup up. (add_or_update_class_type): Use the new get_internal_anonynous_die_base_name and build_internal_anonymous_die_name functions. Support making sure that the anonymous member type we are adding to the class wasn't already there, especially for cases where we are updating a class type. (add_or_update_union_type): Use the new get_internal_anonynous_die_base_name and build_internal_anonymous_die_name functions. (build_ir_node_from_die): Adjust the use of build_enum_type to pass it the scope of the enum type we are building. * src/abg-ir.cc (lookup_union_type): Add a new overload. (lookup_class_or_typedef_type): Use the new overload of lookup_union_type above to support looking up union types too. (class_or_union::get_num_anonymous_member_{classes, unions, enums}): Define new member functions. * src/abg-reporter-priv.cc (represent): Detect when anonymous types of anonymous data members have their internal names change, probably because anonymous member types were inserted in the scope. * tests/data/Makefile.am: Add the new test-anonymous-members-0.* test input files to the source distribution. * tests/data/test-annotate/test-anonymous-members-0.cc: New test input file. * tests/data/test-annotate/test-anonymous-members-0.o: Likewise. * tests/data/test-annotate/test-anonymous-members-0.o.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Adjust. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt: Likewise. * tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt * tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt: Likewise. * tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt: Likewise. * tests/data/test-read-dwarf/PR22122-libftdc.so.abi: Likewise. * tests/data/test-read-dwarf/test12-pr18844.so.abi: Likewise. * tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise. * tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise. * tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-read-dwarf/test21-pr19092.so.abi: Likewise. * tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/test-annotate.cc (int_out_specs): Add the new test inputs to this test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2019-05-07 08:22:29 +00:00
{
"data/test-annotate/test-anonymous-members-0.o",
"data/test-annotate/test-anonymous-members-0.o.abi",
"output/test-annotate/test-anonymous-members-0.o.abi",
},
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
// This should be the last entry.
{NULL, NULL, NULL}
};
int
main()
{
using abigail::tests::get_src_dir;
using abigail::tests::get_build_dir;
using abigail::tools_utils::ensure_parent_dir_created;
unsigned int total_count = 0, passed_count = 0, failed_count = 0;
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
string in_elf_path, ref_report_path, out_report_path;
string abidw;
abidw = string(get_build_dir()) + "/tools/abidw "
"--annotate --no-corpus-path";
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
for (InOutSpec* s = in_out_specs; s->in_elf_path; ++s)
{
bool is_ok = true;
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
in_elf_path = string(get_src_dir()) + "/tests/" + s->in_elf_path;
ref_report_path = string(get_src_dir()) + "/tests/" + s->in_report_path;
out_report_path =
string(get_build_dir()) + "/tests/" + s->out_report_path;
if (!ensure_parent_dir_created(out_report_path))
{
cerr << "could not create parent directory for "
<< out_report_path;
is_ok = false;
continue;
}
string cmd = abidw + " " + in_elf_path + " > " + out_report_path;
bool abidw_ok = true;
if (system(cmd.c_str()))
abidw_ok = false;
if (abidw_ok)
{
string diff_cmd =
"diff -u " + ref_report_path + " " + out_report_path;
if (system(diff_cmd.c_str()))
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
is_ok &=false;
}
else
{
is_ok &= false;
}
emit_test_status_and_update_counters(is_ok, cmd, passed_count,
failed_count, total_count);
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
}
emit_test_summary(total_count, passed_count, failed_count);
return failed_count;
Bug 20970 - Add a --annotate option to abidw This option annotates (read "pretty-prints") the types and elf symbols in the form of XML comments in the ABIXML output emitted by the abidw command. Signed-off-by: Ondrej Oprala <ondrej.oprala@gmail.com> * doc/manuals/abidiff.rst: Document the '--no-corpus-path' option. * doc/manuals/abidw.rst: Document the '--no-corpus-path' and '--annotate' options. * include/abg-libxml-utils.h ({un,}escape_xml_comment): Add new function declarations. * include/abg-writer.h: Add new annotate functions (write_{translation_unit,corpus_to_{archive,native_xml_file}}): Add an optional "annotate" parameter defaulting to "false". * src/abg-libxml-utils.cc ({un,}escape_xml_comment): Add new function definitions. * src/abg-writer.cc (annotate): Define new templatized function and specialize it for necessary cases. * tests/Makefile.am: Add runtestannotate as a new test. * tests/data/Makefile.am: Add paths to below reference test outputs. * tests/data/test-annotate/libtest23.so.abi: New reference test output. * tests/data/test-annotate/libtest24-drop-fns-2.so.abi: Likewise. * tests/data/test-annotate/libtest24-drop-fns.so.abi: Likewise. * tests/data/test-annotate/test0.abi: Likewise. * tests/data/test-annotate/test1.abi: Likewise. * tests/data/test-annotate/test10-pr18818-gcc.so.abi: Likewise. * tests/data/test-annotate/test11-pr18828.so.abi: Likewise. * tests/data/test-annotate/test12-pr18844.so.abi: Likewise. * tests/data/test-annotate/test13-pr18894.so.abi: Likewise. * tests/data/test-annotate/test14-pr18893.so.abi: Likewise. * tests/data/test-annotate/test15-pr18892.so.abi: Likewise. * tests/data/test-annotate/test16-pr18904.so.abi: Likewise. * tests/data/test-annotate/test17-pr19027.so.abi: Likewise. * tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi: Likewise. * tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi: Likewise. * tests/data/test-annotate/test2.so.abi: Likewise. * tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi: Likewise. * tests/data/test-annotate/test21-pr19092.so.abi: Likewise. * tests/data/test-annotate/test22-pr19097-libstdc++.so.6.0.17.so.abi: Likewise. * tests/data/test-annotate/test3.so.abi: Likewise. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-annotate/test5.o.abi: Likewise. * tests/data/test-annotate/test6.so.abi: Likewise. * tests/data/test-annotate/test7.so.abi: Likewise. * tests/data/test-annotate/test8-qualified-this-pointer.so.abi: Likewise. * tests/data/test-annotate/test9-pr18818-clang.so.abi: Likewise. * tests/test-annotate.cc: New test for ABIXML annotations. * tools/abidiff.cc: Add the new option '--no-corpus-path'. * tools/abidw.cc: Likewise. Also add the '--annotate' option. reviews round 1 Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2017-01-17 18:41:51 +00:00
}