libabigail/tests
Matthias Maennich 53d10a789d abg-reader: handle empty corpus nodes in xml representation
An abi-corpus might be part of the representation, but might (due to
filters like whitelisting) not contain actual symbols to be considered.
In that case, `abidw` produces an empty abi-corpus node.

Valid ways of representing this in XML are

 -  <abi-corpus path='vmlinux' architecture='elf-arm-aarch64'/>

 -  <abi-corpus path='vmlinux' architecture='elf-arm-aarch64'></abi-corpus>

 -  <abi-corpus path='vmlinux' architecture='elf-arm-aarch64'>
    </abi-corpus>

abg-reader could currently only handle the last format and crashed upon
processing the first two ones. The crash happened due to the XMLNode
having no children, but that was assumed. The last case succeeded so
far as this form actually contains a text node (with the newline
character) as a child.

Fix this by handling the case of a node not having children by exiting
early with an empty node.

	* src/abg-reader.cc (read_corpus_from_input): when assigning a
	corpus node, assure the node actually has children.
	* tests/test-abidiff.cc (main): Add test for variants of empty
	xml nodes to the test harness.
	* tests/data/test-abidiff/test-empty-corpus-0.xml: Test input
	containing an empty xml node that closes immediately.
	* tests/data/test-abidiff/test-empty-corpus-0.xml: Test input
	containing an empty xml node that closes immediately with a tag.
	* tests/data/test-abidiff/test-empty-corpus-0.xml: Test input
	containing an empty xml node that closes with a tag on a new line.
	* tests/data/test-abidiff/test-empty-corpus-report.txt:
	Expected test output (empty abidiff) for diffing xml with itself.
	* tests/data/Makefile.am: Add the new test input material above
	to source distribution.

Reviewed-by: Dodji Seketeli <dodji@seketeli.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
2020-01-20 12:20:09 +00:00
..
data abg-reader: handle empty corpus nodes in xml representation 2020-01-20 12:20:09 +00:00
.gitignore Update tests/.gitignore to ignore runtesttoolsutils 2019-07-09 17:33:58 +02:00
Makefile.am Ensure a consistent C++ standard use 2019-07-22 11:18:13 +02:00
mockfedabipkgdiff.in
print-diff-tree.cc abilint: fix return types bool -> int 2019-04-16 16:11:01 +02:00
runtestcanonicalizetypes.sh.in
runtestdefaultsupprs.py.in Fix typo in tests/runtestdefaultsupprs.py 2018-05-24 10:48:56 +02:00
runtestdefaultsupprspy3.sh.in
runtestfedabipkgdiff.py.in
runtestfedabipkgdiffpy3.sh.in
test-abicompat.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-abidiff-exit.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-abidiff.cc abg-reader: handle empty corpus nodes in xml representation 2020-01-20 12:20:09 +00:00
test-alt-dwarf-file.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-annotate.cc Handle several member anonymous types of the same kind 2019-05-07 14:31:16 +02:00
test-core-diff.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-diff2.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-diff-dwarf-abixml.cc Bug 25409 - Fix reading layout-offset-in-bits attribute of data-member 2020-01-17 16:35:29 +01:00
test-diff-dwarf.cc PR25058 - Support decl DIEs referring to symbols using DW_AT_ranges 2019-10-03 17:42:30 +02:00
test-diff-filter.cc Bug 24787 - Filter out enum changes into compatible integer types 2019-07-19 18:22:12 +02:00
test-diff-pkg.cc Bug 24690 - Support comparing non-reachable types of a binary 2020-01-06 14:26:00 +01:00
test-diff-suppr.cc abidiff/kmidiff: do not default-suppress added symbols 2020-01-17 12:40:27 +00:00
test-dot.cc
test-ini.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-ir-walker.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-lookup-syms.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-read-dwarf.cc PR25042 - Support string form DW_FORM_strx{1,4} from DWARF 5 2019-10-01 14:14:41 +02:00
test-read-write.cc Add compatibility layer for C++11 mode 2019-07-09 18:05:28 +02:00
test-svg.cc
test-tools-utils.cc Fully account for anonymous-ness of scopes when comparing decl names 2019-06-21 11:42:44 +02:00
test-types-stability.cc Add compatibility layer for C++11 mode 2019-07-09 18:05:28 +02:00
test-utils.cc Update copyright for 2019 2019-01-07 14:54:47 +01:00
test-utils.h Conditionalize the Rust support regression test 2019-01-24 11:06:57 +01:00
test-valgrind-suppressions.supp
test-write-read-archive.cc Add compatibility layer for C++11 mode 2019-07-09 18:05:28 +02:00
update-test-output.py