libabigail/tests
Guillermo E. Martinez via Libabigail b1bbb67b2f ctf-reader: Assert on ir::hash_as_canonical_type_or_constant
In some scenarios where we declare same data types `recursively' such
as: like linked list, functions that accept the same pointer to function
as arguments, forward types declarations to build structures with member
fields with mutual dependencies, etc., an assertion is trigger:

    abidw: ../../../libabigail-upstream/src/abg-ir.cc:25251: size_t
    abigail::ir::hash_as_canonical_type_or_constant(const
    abigail::ir::type_base*): Assertion `__abg_cond__' failed.

It is happening because the recursively behavior of `process_ctf_type'
and `process_ctf_*' used to register ctf types doesn't verify when a
ctf_type was processed and registered before by their subsequence
_recursive_ calls, so `type_base' object is built more than once and the
second time when it is inserted in `types_maps', it refuses in a silent
way, being that the key was already inserted, however
`add_decl_to_scope', `bind_function_type_life_time' successfully
registered the ctf type object. In this patch `process_ctf_type'
delegates register types task to `process_ctf_*' functions guaranteeing
a single ctf type registration, also it improves the performance looking
for the type before start to build it again.

	* src/abg-ctf-reader.cc (process_ctf_base_type): Add new
	`translation_unit_sptr' parameter. Add condition to validate
	success 'base_type' construction and register type object.
	(process_ctf_typedef): Add `lookup_type' to get a `type_base'
	object when this was previously created, if this is not the
	case, register ctf type. Add condition to validate success
	'base_type' construction and register type object.
	(process_ctf_function_type): Likewise.
	(process_ctf_array_type): Likewise.
	(process_ctf_qualified_type): Likewise.
	(process_ctf_pointer_type): Likewise.
	(process_ctf_struct_type): Add `add_decl_to_scope'.
	(process_ctf_union_type): Likewise.
	(process_ctf_type): Add `lookup_type' to get a `type_base'
	object when this was previously created. Delegate register
	type object to `process_ctf_*'.
	* tests/data/Makefile.am: Add tests I/O and expected files.
	* tests/data/test-read-ctf/test-array-of-pointers.[co]: New
	testcase.
	* tests/data/test-read-ctf/test-list-struct.[co]: Likewise.
	* tests/data/test-read-ctf/test-callback.[co]: Likewise.
	* tests/data/test-read-ctf/test-callback2.[co]: Likewise.
	* tests/data/test-read-ctf/test-functions-declaration.[co]: Likewise.
	* tests/data/test-read-ctf/test-forward-type-decl.[co]: Likewise.
	* tests/data/test-read-ctf/test-array-of-pointers.abi:
	Expected test output.
	* tests/data/test-read-ctf/test-callback.abi: Likewise.
	* tests/data/test-read-ctf/test-callback2.abi: Likewise.
	* tests/data/test-read-ctf/test-forward-type-decl.abi: Likewise.
	* tests/data/test-read-ctf/test-functions-declaration.abi: Likewise.
	* tests/data/test-read-ctf/test-list-struct.abi: Likewise.
	* tests/test-read-ctf.cc: Add testcases to CTF test harness.

Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2022-01-03 15:16:12 +01:00
..
data ctf-reader: Assert on ir::hash_as_canonical_type_or_constant 2022-01-03 15:16:12 +01:00
lib tests/catch.hpp: Add SPDX header back 2021-03-08 11:33:56 +01:00
.gitignore tests/.gitignore: ignore all files starting with runtest* 2020-05-13 11:26:28 +02:00
Makefile.am Add regression tests for ctf reading 2021-12-14 16:45:58 +01:00
mockfedabipkgdiff.in Replace Python 'import importlib' with 'import importlib.machinery' 2021-12-21 15:48:06 +01:00
print-diff-tree.cc Move dwarf_reader::status facilities to an abigail::elf_reader namespace 2021-11-15 11:08:53 +01:00
runtestcanonicalizetypes.sh.in Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
runtestdefaultsupprs.py.in Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
runtestdefaultsupprspy3.sh.in Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
runtestfedabipkgdiff.py.in Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
runtestfedabipkgdiffpy3.sh.in Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
runtestslowselfcompare.sh.in Bug 26769 - Fix missing types in abixml output 2020-11-23 13:02:34 +01:00
test-abicompat.cc test-abicompat: Make the test output more pleasant 2021-11-09 15:35:19 +01:00
test-abidiff-exit.cc Standardize and improve the output of several tests 2021-11-17 12:44:16 +01:00
test-abidiff.cc Bug 27985 - abidiff: bad array types in report 2021-09-03 11:08:01 +02:00
test-alt-dwarf-file.cc Standardize and improve the output of several tests 2021-11-17 12:44:16 +01:00
test-annotate.cc Add regression tests for ctf reading 2021-12-14 16:45:58 +01:00
test-core-diff.cc Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
test-cxx-compat.cc abg-cxx-compat: add simplified version of std::optional 2021-03-09 10:41:10 +01:00
test-diff2.cc Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
test-diff-dwarf-abixml.cc Standardize and improve the output of several tests 2021-11-17 12:44:16 +01:00
test-diff-dwarf.cc Move dwarf_reader::status facilities to an abigail::elf_reader namespace 2021-11-15 11:08:53 +01:00
test-diff-filter.cc Bug 27995 - Self comparison error from abixml file 2021-08-11 17:38:14 +02:00
test-diff-pkg.cc configure: Instead of for rpm 4.15+ version, test actual rpm/zstd support 2021-12-17 21:13:25 +01:00
test-diff-suppr.cc suppression: Fix has_data_member_inserted_between = {offset_of(), offset_of()} 2021-12-06 14:39:32 +01:00
test-dot.cc Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
test-elf-helpers.cc Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
test-ini.cc Standardize and improve the output of several tests 2021-11-17 12:44:16 +01:00
test-ir-walker.cc Move dwarf_reader::status facilities to an abigail::elf_reader namespace 2021-11-15 11:08:53 +01:00
test-kmi-whitelist.cc Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
test-lookup-syms.cc Standardize and improve the output of several tests 2021-11-17 12:44:16 +01:00
test-read-common.cc Add regression tests for ctf reading 2021-12-14 16:45:58 +01:00
test-read-common.h Add regression tests for ctf reading 2021-12-14 16:45:58 +01:00
test-read-ctf.cc ctf-reader: Assert on ir::hash_as_canonical_type_or_constant 2022-01-03 15:16:12 +01:00
test-read-dwarf.cc Add regression tests for ctf reading 2021-12-14 16:45:58 +01:00
test-read-write.cc symtab: Add support for MODVERSIONS (CRC checksums) 2021-04-02 16:13:13 +02:00
test-svg.cc Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
test-symtab-reader.cc dwarf-reader split: create abg-symtab-reader.{h,cc} and test case 2021-03-10 18:54:55 +01:00
test-symtab.cc Move dwarf_reader::status facilities to an abigail::elf_reader namespace 2021-11-15 11:08:53 +01:00
test-tools-utils.cc Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00
test-types-stability.cc Bug 28450 - Fix cloned member function handling in DWARF 2021-11-12 18:31:28 +01:00
test-utils.cc test-utils: Define test status reporting functions 2021-11-17 12:02:37 +01:00
test-utils.h test-utils: Define test status reporting functions 2021-11-17 12:02:37 +01:00
test-valgrind-suppressions.supp Shut down a helgrind false positive in the "system" libc call 2017-03-17 09:02:19 +01:00
update-test-output.py Re-license the project to Apache v2 With LLVM Exception 2020-12-02 11:49:13 +01:00