Skip to content

Commit

Permalink
Test the inflate code with full coverage.
Browse files Browse the repository at this point in the history
Add a cover target in Makefile and the test/infcover.c test program
to cover all of the code lines in the inf*.c source files.  The
coverage is run with memory allocation checking in order to expose
memory leaks.  The coverage testing is run using:

    ./configure --cover && make cover
  • Loading branch information
madler committed Nov 27, 2011
1 parent de32a2d commit 014967a
Show file tree
Hide file tree
Showing 3 changed files with 687 additions and 0 deletions.
1 change: 1 addition & 0 deletions INDEX
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ configure configure script for Unix
make_vms.com makefile for VMS
test/example.c zlib usages examples for build testing
test/minigzip.c minimal gzip-like functionality for build testing
test/infcover.c inf*.c code coverage for build coverage testing
treebuild.xml XML description of source file dependencies
zconf.h.cmakein zconf.h template for cmake
zconf.h.in zconf.h template for configure
Expand Down
13 changes: 13 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ test64: all64
fi
-@rm -f foo.gz

infcover.o: test/infcover.c zlib.h zconf.h
$(CC) $(CFLAGS) -I. -c -o $@ test/infcover.c

infcover: infcover.o libz.a
$(CC) $(CFLAGS) -o $@ infcover.o libz.a

cover: infcover
rm -f *.gcda
./infcover
gcov inf*.c

libz.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
Expand Down Expand Up @@ -230,10 +241,12 @@ clean:
rm -f *.o *.lo *~ \
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
example64$(EXE) minigzip64$(EXE) \
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
rm -rf objs
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov

maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs
Expand Down
Loading

0 comments on commit 014967a

Please sign in to comment.