fix coverage?
This commit is contained in:
parent
b8ec1cc6cb
commit
4f30012c2d
|
@ -11,3 +11,4 @@ nimbus-build-system.paths
|
||||||
vendor/*
|
vendor/*
|
||||||
NimBinaries
|
NimBinaries
|
||||||
.update.timestamp
|
.update.timestamp
|
||||||
|
*.dSYM
|
||||||
|
|
21
build.nims
21
build.nims
|
@ -1,4 +1,4 @@
|
||||||
import std / strutils
|
import std / [os, strutils, sequtils]
|
||||||
|
|
||||||
switch("define", "libp2p_pki_schemes=secp256k1")
|
switch("define", "libp2p_pki_schemes=secp256k1")
|
||||||
|
|
||||||
|
@ -40,14 +40,19 @@ task coverage, "generates code coverage report":
|
||||||
echo " *****************************************************************"
|
echo " *****************************************************************"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
exec("nimble --verbose test --opt:speed -d:debug --verbosity:0 --hints:off --lineDir:on -d:chronicles_log_level=INFO --nimcache:nimcache --passC:-fprofile-arcs --passC:-ftest-coverage --passL:-fprofile-arcs --passL:-ftest-coverage")
|
var nimSrcs = ""
|
||||||
exec("cd nimcache; rm *.c; cd ..")
|
for f in walkDirRec(".", {pcFile}):
|
||||||
mkDir("coverage")
|
if f.endswith(".nim"): nimSrcs.add " " & f.quoteShell()
|
||||||
|
|
||||||
|
echo "======== Running Tests ======== "
|
||||||
|
exec("nim c -r tests/coverage.nim")
|
||||||
|
# exec("rm nimcache/*.c")
|
||||||
|
rmDir("coverage"); mkDir("coverage")
|
||||||
|
echo " ======== Running LCOV ======== "
|
||||||
exec("lcov --capture --directory nimcache --output-file coverage/coverage.info")
|
exec("lcov --capture --directory nimcache --output-file coverage/coverage.info")
|
||||||
exec("$(which bash) -c 'shopt -s globstar; ls $(pwd)/codexdht/{*,**/*}.nim'")
|
exec("lcov --extract coverage/coverage.info --output-file coverage/coverage.f.info " & nimSrcs)
|
||||||
exec("$(which bash) -c 'shopt -s globstar; lcov --extract coverage/coverage.info $(pwd)/codexdht/{*,**/*}.nim --output-file coverage/coverage.f.info'")
|
echo " ======== Generating HTML coverage report ======== "
|
||||||
echo "Generating HTML coverage report"
|
|
||||||
exec("genhtml coverage/coverage.f.info --output-directory coverage/report ")
|
exec("genhtml coverage/coverage.f.info --output-directory coverage/report ")
|
||||||
echo "Opening HTML coverage report in browser..."
|
echo " ======== Opening HTML coverage report in browser... ======== "
|
||||||
exec("open coverage/report/index.html")
|
exec("open coverage/report/index.html")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
include ./testAll
|
|
@ -0,0 +1,15 @@
|
||||||
|
switch("define", "testsAll")
|
||||||
|
|
||||||
|
switch("debugger", "native")
|
||||||
|
switch("lineDir", "on")
|
||||||
|
switch("define", "debug")
|
||||||
|
# switch("opt", "none")
|
||||||
|
switch("verbosity", "0")
|
||||||
|
switch("hints", "off")
|
||||||
|
switch("warnings", "off")
|
||||||
|
switch("define", "chronicles_log_level=INFO")
|
||||||
|
switch("nimcache", "nimcache")
|
||||||
|
switch("passC", "-fprofile-arcs")
|
||||||
|
switch("passC", "-ftest-coverage")
|
||||||
|
switch("passL", "-fprofile-arcs")
|
||||||
|
switch("passL", "-ftest-coverage")
|
|
@ -1,5 +1,10 @@
|
||||||
import
|
when defined(testsPart1) or not defined(testParts):
|
||||||
./dht/[test_providers, test_providermngr],
|
import ./dht/test_providers
|
||||||
./discv5/[test_discoveryv5, test_discoveryv5_encoding]
|
when defined(testsPart2) or not defined(testParts):
|
||||||
|
import ./dht/test_providermngr
|
||||||
|
when defined(testsPart3) or not defined(testParts):
|
||||||
|
import ./discv5/test_discoveryv5
|
||||||
|
when defined(testsPart4) or not defined(testParts):
|
||||||
|
import ./discv5/test_discoveryv5_encoding
|
||||||
|
|
||||||
{.warning[UnusedImport]: off.}
|
{.warning[UnusedImport]: off.}
|
||||||
|
|
Loading…
Reference in New Issue