Skip to content

Commit d0d7857

Browse files
committed
Enabling gcov production when debug is active
1 parent ba8e9bc commit d0d7857

File tree

7 files changed

+30
-4
lines changed

7 files changed

+30
-4
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ script:
1717
- ./bootstrap
1818
- mkdir build
1919
- cd build
20-
- ../configure --enable-gcov
20+
- ../configure --enable-debug
2121
- make
2222
- make check
2323
# - rm -rf build

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ SUBDIRS = src test examples
2828
DIST_SUBDIRS = src test examples
2929
EXTRA_DIST = libhttpserver.pc.in debian/changelog.in debian/control.in debian/copyright.in debian/rules.in debian/libhttpserver-dev.install.in debian/libhttpserver.install.in redhat/libhttpserver.SPEC.in $(DX_CONFIG)
3030

31-
MOSTLYCLEANFILES = $(DX_CLEANFILES) redhat/SOURCES/*
31+
MOSTLYCLEANFILES = $(DX_CLEANFILES) redhat/SOURCES/* *.gcda *.gcno *.gcov
3232
DISTCLEANFILES = redhat/SOURCES/* redhat/SPEC/* redhat/RPMS/* redhat/SRPMS/* redhat/* debian/* DIST_REVISION
3333

3434
pkgconfigdir = $(libdir)/pkgconfig

bootstrap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
#
33
# This file is part of libhttpserver
44
# Copyright (C) 2011, 2012, 2013, 2014 Sebastiano Merlino

configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ AC_ARG_ENABLE([debug],
122122
[debugit=no])
123123
AC_MSG_RESULT([$debugit])
124124

125+
AM_CONDITIONAL([COND_GCOV],[test x"$debugit" = x"yes"])
126+
125127
if test x"$debugit" = x"yes"; then
126128
AC_DEFINE([DEBUG],[],[Debug Mode])
127-
AM_CXXFLAGS="$AM_CXXFLAGS -DDEBUG -g -Wall -Wno-uninitialized -O0 -fprofile-arcs -ftest-coverage"
129+
AM_CXXFLAGS="$AM_CXXFLAGS -DDEBUG -g -Wall -Wno-uninitialized -O0 -fprofile-arcs -ftest-coverage --coverage --no-inline"
128130
LDFLAGS="-lgcov $LDFLAGS"
129131
else
130132
AC_DEFINE([NDEBUG],[],[No-debug Mode])

test/Makefile.am

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,23 @@ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/httpserver/
2121
METASOURCES = AUTO
2222
check_PROGRAMS = basic http_utils
2323

24+
MOSTLYCLEANFILES = *.gcda *.gcno *.gcov
25+
2426
basic_SOURCES = integ/basic.cpp
2527
http_utils_SOURCES = unit/http_utils_test.cpp
2628

2729
noinst_HEADERS = littletest.hpp
2830
AM_CXXFLAGS += -lcurl -Wall -fPIC
2931

32+
if COND_GCOV
33+
34+
TESTS = rmgcda $(check_PROGRAMS) gcov
35+
#basic.log: rmgcda.log
36+
#http_utils.log: rmgcda.log
37+
#gcov.log: basic.log http_utils.log
38+
39+
else
40+
3041
TESTS = $(check_PROGRAMS)
42+
43+
endif

test/gcov

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
for srcfile in ../src/*.cpp
4+
do
5+
( gcov -r $srcfile || gcov $srcfile ) > /dev/null 2> /dev/null
6+
done
7+
exit 0

test/rmgcda

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
rm -f *.gcov *.gcda
4+
exit 0

0 commit comments

Comments
 (0)