Skip to content

Commit cf48cc5

Browse files
authored
Merge pull request #83 from farsightsec/reed-1.6.1
mtbl 1.6.1 release with configure/make code coverage
2 parents 3018ac5 + 7fb5dd0 commit cf48cc5

File tree

7 files changed

+95
-3
lines changed

7 files changed

+95
-3
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
*~
22
.*swp
3+
*.gcda
4+
*.gcno
35
*.la
46
*.lo
57
*.log
@@ -16,6 +18,9 @@
1618
/configure
1719
/libtool
1820
/stamp-h1
21+
all.coverage
22+
coverage-html
1923
Makefile
2024
Makefile.in
25+
report.coverage
2126
TAGS

ChangeLog

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
mtbl (1.6.1)
2+
3+
* Add ./configure --with-coverage option to build with code coverage
4+
and make targets: clean-coverage to remove the coverage data and results
5+
and report-coverage to generate report (after running the code such as
6+
with "make check").
7+
8+
mtbl (1.6.0)
9+
10+
* Return mtbl_iter_init() to public API
11+
* Further optimizations to mtbl_iter_seek() for mtbl_reader and mtbl_merger
12+
* Streamline mtbl varint decoding
13+
114
mtbl (1.5.1)
215

316
* Skip unnecessary seeks when seeking forward on a merger iterator.

Makefile.am

+35
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,41 @@ AM_CFLAGS = \
1717
$(libzstd_CFLAGS)
1818
AM_LDFLAGS =
1919

20+
#
21+
##
22+
### code coverage
23+
##
24+
#
25+
26+
USE_LCOV=@USE_LCOV@
27+
LCOV=@LCOV@
28+
GENHTML=@GENHTML@
29+
30+
clean-coverage:
31+
@if [ $(USE_LCOV) = yes ] ; then \
32+
$(LCOV) --directory . --zerocounters ; \
33+
echo "Removing coverage info files and generated $(abs_top_builddir)/coverage-html/ directory" ; \
34+
rm -rf all.coverage report.coverage ; \
35+
rm -rf $(abs_top_builddir)/coverage-html/ ; \
36+
else \
37+
echo "Code coverage not enabled at configuration time." ; \
38+
echo "Use: ./configure --with-coverage" ; \
39+
fi
40+
41+
report-coverage:
42+
@if [ $(USE_LCOV) = yes ] ; then \
43+
$(LCOV) --capture --directory . --output-file all.coverage ; \
44+
$(LCOV) --remove all.coverage \
45+
$(abs_top_srcdir)/t/\* \
46+
/usr/include/\* \
47+
--output report.coverage ; \
48+
$(GENHTML) --legend -o $(abs_top_builddir)/coverage-html report.coverage ; \
49+
echo "Generated Code Coverage report in HTML at $(abs_top_builddir)/coverage-html" ; \
50+
else \
51+
echo "Code coverage not enabled at configuration time." ; \
52+
echo "Use: ./configure --with-coverage" ; \
53+
fi
54+
2055
#
2156
##
2257
### library

configure.ac

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AC_PREREQ(2.64)
22
AC_INIT([mtbl],
3-
[1.6.0],
3+
[1.6.1],
44
[https://github.com/farsightsec/mtbl/issues],
55
[mtbl],
66
[https://github.com/farsightsec/mtbl])
@@ -84,6 +84,35 @@ fi
8484

8585
gl_LD_VERSION_SCRIPT
8686

87+
AC_ARG_WITH(coverage,
88+
[ --with-coverage[=PROGRAM] enable gtest and coverage target using the specified lcov], lcov="$withval", lcov="no")
89+
90+
USE_LCOV="no"
91+
if test "$lcov" != "no"; then
92+
if test "$lcov" != "yes"; then
93+
LCOV=$lcov
94+
else
95+
AC_PATH_PROG([LCOV], [lcov])
96+
fi
97+
if test -x "${LCOV}"; then
98+
USE_LCOV="yes"
99+
else
100+
AC_MSG_ERROR([Cannot find lcov.])
101+
fi
102+
# is genhtml always in the same directory?
103+
GENHTML=`echo "$LCOV" | ${SED} s/lcov$/genhtml/`
104+
if test ! -x $GENHTML; then
105+
AC_MSG_ERROR([genhtml not found, needed for lcov])
106+
fi
107+
CFLAGS="$CFLAGS --coverage"
108+
LIBS=" $LIBS -lgcov"
109+
AC_SUBST(CPPFLAGS)
110+
AC_SUBST(LIBS)
111+
AC_SUBST(LCOV)
112+
AC_SUBST(GENHTML)
113+
fi
114+
AC_SUBST(USE_LCOV)
115+
87116
AC_OUTPUT
88117
AC_MSG_RESULT([
89118
$PACKAGE $VERSION
@@ -102,4 +131,6 @@ AC_MSG_RESULT([
102131
bigendian: ${ac_cv_c_bigendian}
103132
104133
building manpage docs: ${DOC_MAN_MSG}
134+
135+
code coverage enabled: ${USE_LCOV}
105136
])

debian/changelog

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
mtbl (1.6.1-1) debian-fsi; urgency=medium
2+
3+
* Add ./configure --with-coverage option to build with code coverage
4+
and make targets: clean-coverage to remove the coverage data and results
5+
and report-coverage to generate report (after running the code such as
6+
with "make check").
7+
8+
-- Farsight Security Inc <[email protected]> Wed, 03 Apr 2024 15:40:01 +0000
9+
110
mtbl (1.6.0-2) debian-fsi; urgency=medium
211

312
* Updated symbols

debian/control

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Priority: optional
44
Maintainer: Farsight Security, Inc. <[email protected]>
55
Build-Depends:
66
debhelper (>= 10~),
7-
dh-autoreconf (>= 5~),
87
dpkg-dev (>= 1.16.0~),
98
lcov,
109
liblz4-dev (>= 0.0~r130),

mtbl.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: mtbl
2-
Version: 1.6.0
2+
Version: 1.6.1
33
Release: 1%{?dist}
44
Summary: immutable sorted string table utilities
55

0 commit comments

Comments
 (0)