mirror of
https://github.com/jmcnamara/libxlsxwriter
synced 2025-03-28 21:13:14 +00:00
Add build support for gcov coverage.
This commit is contained in:
parent
972db12d50
commit
412571bb92
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,6 +6,8 @@
|
||||
*.la
|
||||
*.dylib
|
||||
*.dll
|
||||
*.gcno
|
||||
*.gcda
|
||||
test_*
|
||||
!test_*.c
|
||||
!test_*.cpp
|
||||
@ -42,6 +44,7 @@ cov-int
|
||||
libxlsxwriter-coverity.tgz
|
||||
.scannerwork/
|
||||
.sonar_output/
|
||||
build
|
||||
|
||||
third_party/zlib-1.2.8/configure.log
|
||||
third_party/zlib-1.2.8/contrib/minizip/miniunz
|
||||
|
11
Makefile
11
Makefile
@ -167,6 +167,16 @@ coverity: all
|
||||
$(Q)$(MAKE) -C src clean
|
||||
$(Q)rm -f lib/*
|
||||
|
||||
# Run gcov coverage analysis.
|
||||
gcov: third_party
|
||||
$(Q)$(MAKE) -C src clean
|
||||
$(Q)$(MAKE) -C src GCOV="--coverage" OPT_LEVEL="-O0"
|
||||
$(Q)$(MAKE) -C src test_lib GCOV="--coverage"
|
||||
$(Q)$(MAKE) -C test/unit test GCOV="--coverage"
|
||||
$(Q)$(MAKE) -C test/functional/src GCOV="--coverage"
|
||||
$(Q)$(PYTEST) test/functional -v -k $(PYTESTFILES)
|
||||
$(Q)gcovr -r src --html-details -o build/libxlsxwriter_gcov.html
|
||||
$(Q)gcovr -r . -f src --sonarqube build/coverage.xml
|
||||
|
||||
# Run sonarcloud analysis.
|
||||
sonarcloud:
|
||||
@ -174,7 +184,6 @@ ifndef SONAR_TOKEN
|
||||
@echo "Please define SONAR_TOKEN to run this analysis."
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
$(Q)$(MAKE) clean
|
||||
$(Q)../sonar-scanner-4.6.1.2450-macosx/bin/build-wrapper-macosx-x86 --out-dir .sonar_output make all
|
||||
$(Q)../sonar-scanner-4.6.1.2450-macosx/bin/sonar-scanner \
|
||||
|
10
src/Makefile
10
src/Makefile
@ -99,7 +99,7 @@ UNAME := $(shell uname)
|
||||
# Change make options on OS X.
|
||||
ifeq ($(UNAME), Darwin)
|
||||
LIBXLSXWRITER_SO = libxlsxwriter.dylib
|
||||
SOFLAGS = -dynamiclib $(FPIC) -install_name $(PREFIX)/lib/$(LIBXLSXWRITER_SO)
|
||||
SOFLAGS = -dynamiclib $(FPIC) -install_name $(PREFIX)/lib/$(LIBXLSXWRITER_SO) $(GCOV)
|
||||
endif
|
||||
|
||||
# Check for MinGW/MinGW64/Cygwin environments.
|
||||
@ -158,15 +158,15 @@ test_compile : $(OBJS)
|
||||
|
||||
# Targets for the object files.
|
||||
%.o : %.c $(HDRS)
|
||||
$(Q)$(CC) -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) $(TARGET_ARCH) -c $<
|
||||
$(Q)$(CC) -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) $(TARGET_ARCH) $(GCOV) -c $<
|
||||
|
||||
%.so : %.c $(HDRS)
|
||||
$(Q)$(CC) $(FPIC) -I$(INC_DIR) $(LDFLAGS) $(CFLAGS) $(CXXFLAGS) $(TARGET_ARCH) -c $< -o $@
|
||||
$(Q)$(CC) $(FPIC) -I$(INC_DIR) $(LDFLAGS) $(CFLAGS) $(CXXFLAGS) $(TARGET_ARCH) $(GCOV) -c $< -o $@
|
||||
|
||||
%.to : %.c $(HDRS)
|
||||
$(Q)$(CC) -g $(OPT_LEVEL) -DTESTING -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) -c $< -o $@
|
||||
$(Q)$(CC) -g $(OPT_LEVEL) -DTESTING -I$(INC_DIR) $(CFLAGS) $(CXXFLAGS) $(GCOV) -c $< -o $@
|
||||
|
||||
|
||||
# Clean up any temp/build files.
|
||||
clean :
|
||||
$(Q)rm -f *.o *.a *.so *.to *.dylib *.dll
|
||||
$(Q)rm -f *.o *.a *.so *.to *.dylib *.dll *.gcno *.gcda
|
||||
|
@ -23,7 +23,14 @@ SRCTESTFILES ?= *.c
|
||||
SRCS = $(wildcard $(SRCTESTFILES))
|
||||
EXES = $(patsubst %.c,%,$(SRCS))
|
||||
|
||||
|
||||
ifndef GCOV
|
||||
LIBXLSXWRITER = ../../../src/libxlsxwriter.a
|
||||
else
|
||||
# Link against the same lib used by the unit tests.
|
||||
LIBXLSXWRITER = ../../../src/libxlsxwriter_test.a
|
||||
endif
|
||||
|
||||
|
||||
LIBS = $(LIBXLSXWRITER) -lz
|
||||
ifdef USE_SYSTEM_MINIZIP
|
||||
@ -50,11 +57,11 @@ endif
|
||||
|
||||
clean :
|
||||
$(Q)rm -f $(EXES)
|
||||
$(Q)rm -rf *.dSYM
|
||||
$(Q)rm -rf *.dSYM *.gcno *.gcda
|
||||
|
||||
# Executable targets.
|
||||
%: %.c $(LIBXLSXWRITER)
|
||||
$(Q)$(CC) -I$(INC_DIR) $(CFLAGS) $< -o $@ $(LIBS)
|
||||
$(Q)$(CC) -I$(INC_DIR) $(CFLAGS) $(GCOV) $< -o $@ $(LIBS)
|
||||
|
||||
test_valgrind: all
|
||||
$(Q)$(foreach exe,$(EXES),valgrind -q --error-exitcode=1 --leak-check=full ./$(exe) || exit;)
|
||||
|
@ -16,7 +16,7 @@ INC_DIR = ../../include
|
||||
LIB_DIR = ../../src
|
||||
|
||||
# Flags passed to the C compiler.
|
||||
CFLAGS += -DTESTING -DCOLOR_OK -g -Wall -Wextra -Wno-unused-parameter
|
||||
CFLAGS += -DTESTING -DCOLOR_OK -g -Wall -Wextra -Wno-unused-parameter $(GCOV)
|
||||
|
||||
|
||||
# All tests produced by this Makefile.
|
||||
@ -85,7 +85,7 @@ all :
|
||||
# END make all
|
||||
|
||||
clean :
|
||||
$(Q)rm -f $(TESTS) test_all *.o
|
||||
$(Q)rm -f $(TESTS) test_all *.o *.gcno *.gcda
|
||||
$(Q)$(MAKE) clean -C utility
|
||||
$(Q)$(MAKE) clean -C xmlwriter
|
||||
$(Q)$(MAKE) clean -C worksheet
|
||||
|
@ -16,7 +16,7 @@ INC_DIR = ../../../include
|
||||
LIB_DIR = ../../../src
|
||||
|
||||
# Flags passed to the C compiler.
|
||||
CFLAGS += -DTESTING -DCOLOR_OK -g -Wall -Wextra -Wno-unused-parameter
|
||||
CFLAGS += -DTESTING -DCOLOR_OK -g -Wall -Wextra -Wno-unused-parameter $(GCOV)
|
||||
|
||||
# Make targets and objects.
|
||||
SRCS = $(wildcard test*.c)
|
||||
@ -47,7 +47,7 @@ all : $(TESTS)
|
||||
|
||||
# Clean all the things!
|
||||
clean :
|
||||
$(Q)rm -f $(TESTS) test_all *.o
|
||||
$(Q)rm -f $(TESTS) test_all *.o *.gcno *.gcda
|
||||
|
||||
# Build the testscases.
|
||||
%.o: %.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user