Rewrite test-coverage rules to accommodate multiple .o files per .c.

* src/Makefile.am (cov): Rewrite rule to merge gcov results corresponding
to two .o files: the libvirt_la- one, and the libvirt_test_la- one.
(tst): Remove unused rule.
* configure.in (LV_LIBTOOL_OBJDIR): Define and AC_SUBST.
This commit is contained in:
Jim Meyering 2008-02-28 17:07:37 +00:00
parent 9262d88e28
commit ba52fcbcdf
3 changed files with 25 additions and 12 deletions

View File

@ -1,5 +1,11 @@
Thu Feb 28 18:04:59 CET 2008 Jim Meyering <meyering@redhat.com>
Rewrite test-coverage rules to accommodate multiple .o files per .c.
* src/Makefile.am (cov): Rewrite rule to merge gcov results corresponding
to two .o files: the libvirt_la- one, and the libvirt_test_la- one.
(tst): Remove unused rule.
* configure.in (LV_LIBTOOL_OBJDIR): Define and AC_SUBST.
Avoid link errors with "configure --disable-shared".
* src/Makefile.am: Create a convenience library, libvirt_test.la,
and don't restrict access to *its* symbols.

View File

@ -913,6 +913,13 @@ AC_SUBST(MINGW_EXTRA_LDFLAGS)
AC_SYS_LARGEFILE
# Set LV_LIBTOOL_OBJDIR to "." or $lt_cv_objdir, depending on whether
# we're building shared libraries. This is the name of the directory
# in which .o files will be created.
test "$enable_shared" = no && lt_cv_objdir=.
LV_LIBTOOL_OBJDIR=${lt_cv_objdir-.}
AC_SUBST(LV_LIBTOOL_OBJDIR)
# very annoying
rm -f COPYING
cp COPYING.LIB COPYING

View File

@ -137,20 +137,20 @@ else
EXTRA_DIST += parthelper.c
endif
#
# target to ease building test programs
#
tst: tst.c
$(CC) $(CFLAGS) $(INCLUDES) -I../include -o tst tst.c .libs/libvirt.a $(LIBXML_LIBS) $(VIRSH_LIBS) $(GNUTLS_LIBS) $(LIBS)
COVERAGE_FILES = $(CLIENT_SOURCES:%.c=libvirt_la-%.cov)
cov: clean-cov $(COVERAGE_FILES)
cov: clean-cov
for i in $(CLIENT_SOURCES); do \
case $$i in *.c) ;; *) continue;; esac; \
b=$$(basename $$i .c); \
o_files=; \
for i in '' _test; do \
o="$(LV_LIBTOOL_OBJDIR)/libvirt$${i}_la-$$b.o"; \
test -f "$$o" \
&& o_files="$$o_files $$o"; \
done; \
gcov -b -f $$o_files > $$b.cov; \
done
clean-cov:
rm -f *.cov *.gcov
%.cov: .libs/%.o
gcov -b -f -o .libs $< > $@
CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda