Skip to content

Commit fde8c33

Browse files
committed
SwiftCov support
84.8% coverage so far. Signed-off-by: Stephen Celis <stephen@stephencelis.com>
1 parent 743530d commit fde8c33

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ BUILD_SDK = macosx
33
BUILD_ARGUMENTS = -scheme SQLite -sdk $(BUILD_SDK)
44

55
XCPRETTY := $(shell command -v xcpretty)
6+
SWIFTCOV := $(shell command -v swiftcov)
7+
GCOVR := $(shell command -v gcovr)
68

79
default: test
810

@@ -16,8 +18,30 @@ else
1618
$(BUILD_TOOL) $(BUILD_ARGUMENTS) test
1719
endif
1820

21+
coverage:
22+
ifdef SWIFTCOV
23+
$(SWIFTCOV) generate --output coverage \
24+
$(BUILD_TOOL) $(BUILD_ARGUMENTS) -configuration Release test \
25+
-- ./SQLite/*.swift
26+
ifdef GCOVR
27+
$(GCOVR) \
28+
--root . \
29+
--use-gcov-files \
30+
--html \
31+
--html-details \
32+
--output coverage/index.html \
33+
--keep
34+
else
35+
@echo gcovr must be installed for HTML output: https://github.com/gcovr/gcovr
36+
endif
37+
else
38+
@echo swiftcov must be installed for coverage: https://github.com/realm/SwiftCov
39+
@exit 1
40+
endif
41+
1942
clean:
2043
$(BUILD_TOOL) $(BUILD_ARGUMENTS) clean
44+
rm -r coverage
2145

2246
repl:
2347
@$(BUILD_TOOL) $(BUILD_ARGUMENTS) -derivedDataPath $(TMPDIR)/SQLite.swift > /dev/null && \
@@ -26,3 +50,4 @@ repl:
2650
sloc:
2751
@zsh -c "grep -vE '^ *//|^$$' SQLite/*.{swift,h,c} | wc -l"
2852

53+
.PHONY: test coverage clean repl sloc

0 commit comments

Comments
 (0)