fix coverage?
This commit is contained in:
parent
b8ec1cc6cb
commit
4f30012c2d
|
@ -11,3 +11,4 @@ nimbus-build-system.paths
|
|||
vendor/*
|
||||
NimBinaries
|
||||
.update.timestamp
|
||||
*.dSYM
|
||||
|
|
23
build.nims
23
build.nims
|
@ -1,4 +1,4 @@
|
|||
import std / strutils
|
||||
import std / [os, strutils, sequtils]
|
||||
|
||||
switch("define", "libp2p_pki_schemes=secp256k1")
|
||||
|
||||
|
@ -40,14 +40,19 @@ task coverage, "generates code coverage report":
|
|||
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")
|
||||
exec("cd nimcache; rm *.c; cd ..")
|
||||
mkDir("coverage")
|
||||
var nimSrcs = ""
|
||||
for f in walkDirRec(".", {pcFile}):
|
||||
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("$(which bash) -c 'shopt -s globstar; ls $(pwd)/codexdht/{*,**/*}.nim'")
|
||||
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"
|
||||
exec("genhtml coverage/coverage.f.info --output-directory coverage/report")
|
||||
echo "Opening HTML coverage report in browser..."
|
||||
exec("lcov --extract coverage/coverage.info --output-file coverage/coverage.f.info " & nimSrcs)
|
||||
echo " ======== Generating HTML coverage report ======== "
|
||||
exec("genhtml coverage/coverage.f.info --output-directory coverage/report ")
|
||||
echo " ======== Opening HTML coverage report in browser... ======== "
|
||||
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
|
||||
./dht/[test_providers, test_providermngr],
|
||||
./discv5/[test_discoveryv5, test_discoveryv5_encoding]
|
||||
when defined(testsPart1) or not defined(testParts):
|
||||
import ./dht/test_providers
|
||||
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.}
|
||||
|
|
Loading…
Reference in New Issue