diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2021-01-05 13:25:56 +0000 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2021-01-05 14:53:40 +0000 |
commit | c59e30ed1727135f8efb79890f2c458f73709757 (patch) | |
tree | ed4d06b6438829589f49f3141791debf18b95149 /libctf/Makefile.am | |
parent | 1038406a8f6609ad0a449746da70393b0835f699 (diff) | |
download | fsf-binutils-gdb-c59e30ed1727135f8efb79890f2c458f73709757.zip fsf-binutils-gdb-c59e30ed1727135f8efb79890f2c458f73709757.tar.gz fsf-binutils-gdb-c59e30ed1727135f8efb79890f2c458f73709757.tar.bz2 |
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.
Diffstat (limited to 'libctf/Makefile.am')
-rw-r--r-- | libctf/Makefile.am | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/libctf/Makefile.am b/libctf/Makefile.am index a66ccc1..3fe1994 100644 --- a/libctf/Makefile.am +++ b/libctf/Makefile.am @@ -19,7 +19,7 @@ ACLOCAL_AMFLAGS = -I .. -I ../config -I ../bfd -AUTOMAKE_OPTIONS = foreign no-texinfo.tex +AUTOMAKE_OPTIONS = dejagnu foreign no-texinfo.tex # This is where we get zlib from. zlibdir is -L../zlib and zlibinc is # -I../zlib, unless we were configured with --with-system-zlib, in which @@ -54,3 +54,36 @@ libctf_la_LIBADD = ../bfd/libbfd.la $(libctf_nobfd_la_LIBADD) libctf_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=0 libctf_la_LDFLAGS = $(libctf_nobfd_la_LDFLAGS) libctf_la_SOURCES = $(libctf_nobfd_la_SOURCES) ctf-open-bfd.c + +# Setup the testing framework, if you have one +EXPECT = expect +RUNTEST = runtest +RUNTESTFLAGS = + +CC_FOR_TARGET = ` \ + if [ -f $$r/../gcc/xgcc ] ; then \ + if [ -f $$r/../newlib/Makefile ] ; then \ + echo $$r/../gcc/xgcc -B$$r/../gcc/ -idirafter $$r/../newlib/targ-include -idirafter $${srcroot}/../newlib/libc/include -nostdinc; \ + else \ + echo $$r/../gcc/xgcc -B$$r/../gcc/; \ + fi; \ + else \ + if [ "@host@" = "@target@" ] ; then \ + echo $(CC); \ + else \ + echo gcc | sed '$(transform)'; \ + fi; \ + fi` + +check-DEJAGNU: site.exp + srcroot=`cd $(srcdir) && pwd`; export srcroot; \ + r=`pwd`; export r; \ + LC_ALL=C; export LC_ALL; \ + EXPECT=$(EXPECT); export EXPECT; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ + CC="$(CC_FOR_TARGET)" CFLAGS="$(CFLAGS) -I$(INCDIR) -I$(srcdir) -I$(builddir) -I$(builddir)/../bfd $(ZLIBINC)" \ + CC_FOR_HOST="$(CC)" LIBS="$(LIBS)" $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi |