Add gcov
This commit is contained in:
37
.github/workflows/busted.yml
vendored
37
.github/workflows/busted.yml
vendored
@@ -35,19 +35,38 @@ jobs:
|
|||||||
- name: Setup dependencies
|
- name: Setup dependencies
|
||||||
run: |
|
run: |
|
||||||
luarocks install busted
|
luarocks install busted
|
||||||
luarocks install luacov-coveralls
|
luarocks install luacov-reporter-lcov
|
||||||
- name: Build C library
|
- name: Build C++ library
|
||||||
run: |
|
run: |
|
||||||
${{ matrix.os == 'ubuntu-latest' && 'FSANITIZE=1' || '' }} luarocks make --no-install
|
luarocks make --no-install
|
||||||
|
env:
|
||||||
|
LJKIWI_LUA: ${{ startsWith(matrix.lua_version, 'luajit-') && '0' || '1' }}
|
||||||
|
LJKIWI_CFFI: ${{ startsWith(matrix.lua_version, 'luajit-') && '1' || '0' }}
|
||||||
|
FCOV: ${{ startsWith(matrix.os, 'ubuntu-') && '1' || '' }}
|
||||||
|
# Can't assume so versions, have to update this manually below
|
||||||
|
FSANITIZE: ${{ matrix.os == 'ubuntu-latest' && '1' || '' }}
|
||||||
|
|
||||||
- name: Run busted tests
|
- name: Run busted tests
|
||||||
run: |
|
run: |
|
||||||
${{ matrix.os == 'ubuntu-latest' && 'LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.6:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libubsan.so.1' || '' }} busted -c -v
|
busted -c -v
|
||||||
- name: Report test coverage
|
|
||||||
if: success() && !startsWith(matrix.os, 'windows-') && startsWith(matrix.lua_version, 'luajit-')
|
|
||||||
continue-on-error: true
|
|
||||||
run: luacov-coveralls -e .luarocks -e spec
|
|
||||||
env:
|
env:
|
||||||
COVERALLS_REPO_TOKEN: ${{ github.token }}
|
LD_PRELOAD: ${{ matrix.os == 'ubuntu-latest' && '/usr/lib/x86_64-linux-gnu/libasan.so.6:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libubsan.so.1' || '' }}
|
||||||
|
|
||||||
|
- name: Run gcov
|
||||||
|
if: success() && ${{ startsWith(matrix.os, 'ubuntu-') }}
|
||||||
|
run: |
|
||||||
|
gcov -p -b -s"$(pwd)" -r *.gcda
|
||||||
|
|
||||||
|
- name: generate Lua lcov test reports
|
||||||
|
if: success() && !startsWith(matrix.os, 'windows-') && startsWith(matrix.lua_version, 'luajit-')
|
||||||
|
run: luacov
|
||||||
|
|
||||||
|
- name: Report test coverage
|
||||||
|
if: success() && !startsWith(matrix.os, 'windows-') && (startsWith(matrix.lua_version, 'luajit-') || startsWith(matrix.os, 'ubuntu-'))
|
||||||
|
continue-on-error: true
|
||||||
|
uses: coverallsapp/github-action@v2
|
||||||
|
with:
|
||||||
|
flag-name: run ${{ join(matrix.*, ' - ') }}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -3,6 +3,11 @@
|
|||||||
/lua_modules
|
/lua_modules
|
||||||
/.luarocks
|
/.luarocks
|
||||||
/config.mk
|
/config.mk
|
||||||
|
*.gcda
|
||||||
|
*.gcno
|
||||||
|
*.gcov
|
||||||
|
*.lcov
|
||||||
|
*.out
|
||||||
*.pch
|
*.pch
|
||||||
*.gch
|
*.gch
|
||||||
*.lib
|
*.lib
|
||||||
|
|||||||
5
.luacov
Normal file
5
.luacov
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
modules = {
|
||||||
|
kiwi = "kiwi.lua",
|
||||||
|
}
|
||||||
|
reporter = "lcov"
|
||||||
|
reportfile = "luacov.lcov"
|
||||||
20
Makefile
20
Makefile
@@ -29,6 +29,7 @@ SANITIZE_FLAGS := -fsanitize=undefined -fsanitize=address -fsanitize=alignment -
|
|||||||
-fsanitize=shift -fsanitize=unreachable -fsanitize=bool \
|
-fsanitize=shift -fsanitize=unreachable -fsanitize=bool \
|
||||||
-fsanitize=enum
|
-fsanitize=enum
|
||||||
|
|
||||||
|
COVERAGE_FLAGS := -fprofile-arcs -ftest-coverage
|
||||||
LTO_FLAGS := -flto=auto
|
LTO_FLAGS := -flto=auto
|
||||||
|
|
||||||
-include config.mk
|
-include config.mk
|
||||||
@@ -52,10 +53,13 @@ endif
|
|||||||
|
|
||||||
CCFLAGS += -Wall -fvisibility=hidden -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
CCFLAGS += -Wall -fvisibility=hidden -Wformat=2 -Wconversion -Wimplicit-fallthrough
|
||||||
|
|
||||||
|
ifdef FCOV
|
||||||
|
CCFLAGS += $(COVERAGE_FLAGS)
|
||||||
|
endif
|
||||||
ifdef FSANITIZE
|
ifdef FSANITIZE
|
||||||
CCFLAGS += $(SANITIZE_FLAGS)
|
CCFLAGS += $(SANITIZE_FLAGS)
|
||||||
endif
|
endif
|
||||||
ifndef FNOLTO
|
ifdef FLTO
|
||||||
CCFLAGS += $(LTO_FLAGS)
|
CCFLAGS += $(LTO_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -80,11 +84,9 @@ ifdef LUA
|
|||||||
LUA_VERSION ?= $(lastword $(shell "$(LUA)" -e "print(_VERSION)"))
|
LUA_VERSION ?= $(lastword $(shell "$(LUA)" -e "print(_VERSION)"))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef LUA_VERSION
|
ifdef LUA_VERSION
|
||||||
LJKIWI_CKIWI := 1
|
ifneq ($(LUA_VERSION),5.1)
|
||||||
else
|
LJKIWI_CFFI ?= 0
|
||||||
ifeq ($(LUA_VERSION),5.1)
|
|
||||||
LJKIWI_CKIWI := 1
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -92,8 +94,10 @@ kiwi_lib_srcs := AssocVector.h constraint.h debug.h errors.h expression.h kiwi.h
|
|||||||
row.h shareddata.h solver.h solverimpl.h strength.h symbol.h symbolics.h term.h \
|
row.h shareddata.h solver.h solverimpl.h strength.h symbol.h symbolics.h term.h \
|
||||||
util.h variable.h version.h
|
util.h variable.h version.h
|
||||||
|
|
||||||
objs := luakiwi.o
|
ifneq ($(LJKIWI_LUA),0)
|
||||||
ifdef LJKIWI_CKIWI
|
objs += luakiwi.o
|
||||||
|
endif
|
||||||
|
ifneq ($(LJKIWI_CFFI),0)
|
||||||
objs += ckiwi.o
|
objs += ckiwi.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user