libctf: new testsuite
authorNick Alcock <nick.alcock@oracle.com>
Tue, 5 Jan 2021 13:25:56 +0000 (13:25 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 5 Jan 2021 14:53:40 +0000 (14:53 +0000)
commitc59e30ed1727135f8efb79890f2c458f73709757
treeed4d06b6438829589f49f3141791debf18b95149
parent1038406a8f6609ad0a449746da70393b0835f699
libctf: new testsuite

This introduces a new lookup testsuite under libctf, which operates by
compiling (with libtool) a "lookup" .c file that uses libctf to analyze
some other program, then compiling some number of test object files with
CTF and optionally linking them together and running the lookup program
on the test object files (or linked test binary), before diffing the
result much as run_dump_test does.

This lets us test the portions of libctf that are not previously
testable, notably the portions that do lookup on linked output and
that create dynamic dictionaries and then do lookup on them before
writing them out, something that is not tested by the ld-ctf testsuite
because the linker never does this.

A couple of simple tests are added: one testing the functionality of
enum lookups, and one testing that the recently-added commit adding
extra paranoia to incomplete type handling doesn't break linking and
that the result of the link is an (otherwise-impossible) array of
forward type in the shared CTF dict.

ChangeLog
2021-01-05  Nick Alcock  <nick.alcock@oracle.com>

* Makefile.def (libctf): No longer no_check.  Checking depends on
all-ld.
* Makefile.in: Regenerated.

libctf/ChangeLog
2021-01-05  Nick Alcock  <nick.alcock@oracle.com>

* Makefile.am (EXPECT): New.
(RUNTEST): Likewise.
(RUNTESTFLAGS): Likewise.
(CC_FOR_TARGET): Likewise.
(check-DEJAGNU): Likewise.
(AUTOMAKE_OPTIONS): Add dejagnu.
* Makefile.in: Regenerated.
* testsuite/config/default.exp: New.
* testsuite/lib/ctf-lib.exp: Likewise.
* testsuite/libctf-lookup/enum.lk: New test.
* testsuite/libctf-lookup/enum-ctf.c: New CTF input.
* testsuite/libctf-lookup/enum.c: New lookup test.
* testsuite/libctf-lookup/ambiguous-struct*.c: New test.
* testsuite/libctf-lookup/lookup.exp: New.
16 files changed:
ChangeLog
Makefile.def
Makefile.in
libctf/ChangeLog
libctf/Makefile.am
libctf/Makefile.in
libctf/testsuite/config/default.exp [new file with mode: 0644]
libctf/testsuite/lib/ctf-lib.exp [new file with mode: 0644]
libctf/testsuite/libctf-lookup/ambiguous-struct-A.c [new file with mode: 0644]
libctf/testsuite/libctf-lookup/ambiguous-struct-B.c [new file with mode: 0644]
libctf/testsuite/libctf-lookup/ambiguous-struct.c [new file with mode: 0644]
libctf/testsuite/libctf-lookup/ambiguous-struct.lk [new file with mode: 0644]
libctf/testsuite/libctf-lookup/enum-ctf.c [new file with mode: 0644]
libctf/testsuite/libctf-lookup/enum.c [new file with mode: 0644]
libctf/testsuite/libctf-lookup/enum.lk [new file with mode: 0644]
libctf/testsuite/libctf-lookup/lookup.exp [new file with mode: 0644]