File tree 5 files changed +57
-1
lines changed
5 files changed +57
-1
lines changed Original file line number Diff line number Diff line change 42
42
install : base-devel mingw-w64-${{matrix.env}}-toolchain
43
43
- run : make
44
44
- run : make test
45
+ code-coverage :
46
+ runs-on : ubuntu-latest
47
+ steps :
48
+ - uses : actions/checkout@v4
49
+ - name : Setup LCOV
50
+ uses : hrishikesh-kadam/setup-lcov@v1
51
+ - name : Build and Run tests
52
+ run : make coverage -j
53
+ - name : Upload coverage to Codecov
54
+ uses : codecov/codecov-action@v3
55
+ with :
56
+ files : ./cov-html/libopenlibm.info
57
+ - uses : actions/upload-artifact@v4
58
+ with :
59
+ name : code-coverage-report
60
+ path : ./cov-html/
Original file line number Diff line number Diff line change 5
5
* .so *
6
6
* .dylib *
7
7
* .pc
8
+
9
+ # code coverage
10
+ cov-html /
11
+ * .gcda
12
+ * .gcno
Original file line number Diff line number Diff line change 21
21
pkgconfigdir ?= $(libdir )/pkgconfig
22
22
endif
23
23
24
+ # Build with Code Coverage
25
+ # Only test with Ubuntu + gcc + lcov, may not work for other platform.
26
+ # deps: https://github.com/linux-test-project/lcov
27
+ # You don't need to set this flag manually, `make coverage` will do it for you.
28
+ # Just Run: make clean && make coverage -j
29
+ CODE_COVERAGE ?= 0
30
+
24
31
USEGCC ?= 1
25
32
USECLANG ?= 0
26
33
@@ -162,6 +169,12 @@ LONG_DOUBLE_NOT_DOUBLE := 1
162
169
endif
163
170
endif
164
171
172
+ ifeq ($(CODE_COVERAGE ), 1 )
173
+ CFLAGS_add += -g -O0 --coverage
174
+ LDFLAGS_add += --coverage
175
+ endif # CODE_COVERAGE==1
176
+
177
+
165
178
%. c . o : %. c
166
179
$(CC ) $(CPPFLAGS ) $(CFLAGS ) $(CFLAGS_add ) -c $< -o $@
167
180
Original file line number Diff line number Diff line change @@ -80,9 +80,29 @@ test/test-double: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
80
80
test/test-float : libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT )
81
81
$(MAKE ) -C test test-float
82
82
83
- clean :
83
+ COVERAGE_DIR: =cov-html
84
+ COVERAGE_FILE: =$(COVERAGE_DIR ) /libopenlibm.info
85
+ # Gen cov report with: make clean && make coverage -j
86
+ coverage : clean-coverage
87
+ mkdir $(COVERAGE_DIR )
88
+ $(MAKE ) test CODE_COVERAGE=1
89
+ lcov -d amd64 -d bsdsrc -d ld80 -d src \
90
+ --rc lcov_branch_coverage=1 --capture --output-file $(COVERAGE_FILE )
91
+ genhtml --legend --branch-coverage \
92
+ --title " Openlibm commit ` git rev-parse HEAD` " \
93
+ --output-directory $(COVERAGE_DIR ) / \
94
+ $(COVERAGE_FILE )
95
+
96
+ # Zero coverage statistics and Delete report
97
+ clean-coverage :
98
+ -lcov -d amd64 -d bsdsrc -d ld80 -d src --zerocounters
99
+ rm -f ./* /* .gcda
100
+ rm -rf $(COVERAGE_DIR ) /
101
+
102
+ clean : clean-coverage
84
103
rm -f aarch64/* .o amd64/* .o arm/* .o bsdsrc/* .o i387/* .o loongarch64/* .o ld80/* .o ld128/* .o src/* .o powerpc/* .o mips/* .o s390/* .o riscv64/* .o
85
104
rm -f libopenlibm.a libopenlibm.* $(SHLIB_EXT ) *
105
+ rm -f ./* /* .gcno
86
106
$(MAKE ) -C test clean
87
107
88
108
openlibm.pc : openlibm.pc.in Make.inc Makefile
Original file line number Diff line number Diff line change 1
1
# OpenLibm
2
2
3
+ [ ![ codecov] ( https://codecov.io/gh/JuliaMath/openlibm/graph/badge.svg?token=eTAdN7d9cg )] ( https://codecov.io/gh/JuliaMath/openlibm )
4
+
3
5
[ OpenLibm] ( https://openlibm.org/ ) is an effort to have a high quality, portable, standalone
4
6
C mathematical library ([ ` libm ` ] ( http://en.wikipedia.org/wiki/libm ) ).
5
7
It can be used standalone in applications and programming language
You can’t perform that action at this time.
0 commit comments