Move tests flags from 'nimble test' to 'config.nims' (#852)

This commit is contained in:
Tanguy 2023-02-10 11:32:21 +01:00 committed by GitHub
parent 444b837923
commit f14ada3dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 13 deletions

View File

@ -22,9 +22,7 @@ requires "nim >= 1.2.0",
import hashes
proc runTest(filename: string, verify: bool = true, sign: bool = true,
moreoptions: string = "") =
var excstr = "nim c --skipParentCfg --opt:speed -d:debug -d:libp2p_agents_metrics -d:libp2p_protobuf_metrics -d:libp2p_network_protocols_metrics -d:libp2p_mplex_metrics "
excstr.add(" -d:chronicles_sinks=textlines[stdout],json[dynamic] -d:chronicles_log_level=TRACE ")
excstr.add(" -d:chronicles_runtime_filtering=TRUE ")
var excstr = "nim c --skipParentCfg --opt:speed -d:debug "
excstr.add(" " & getEnv("NIMFLAGS") & " ")
excstr.add(" --verbosity:0 --hints:off ")
excstr.add(" -d:libp2p_pubsub_sign=" & $sign)

View File

@ -1,5 +1,25 @@
import ../config.nims
import strutils
--threads:on
--d:metrics
--d:withoutPCRE
--d:libp2p_agents_metrics
--d:libp2p_protobuf_metrics
--d:libp2p_network_protocols_metrics
--d:libp2p_mplex_metrics
# Only add chronicles param if the
# user didn't specify any
var hasChroniclesParam = false
for param in 0..<paramCount():
if "chronicles" in paramStr(param):
hasChroniclesParam = true
if hasChroniclesParam:
echo "Since you specified chronicles params, TRACE won't be tested!"
else:
switch("import", "stublogger")
switch("define", "chronicles_sinks=textlines[stdout],json[dynamic]")
switch("define", "chronicles_log_level=TRACE")
switch("define", "chronicles_runtime_filtering=TRUE")

View File

@ -3,7 +3,6 @@ include ../../libp2p/protocols/pubsub/gossipsub
{.used.}
import options
import ../stublogger
import stew/byteutils
import ../../libp2p/builders
import ../../libp2p/errors

View File

@ -1,7 +1,5 @@
{.used.}
import ../stublogger
import testfloodsub,
testgossipsub,
testgossipsub2,

View File

@ -7,4 +7,6 @@ when defined(chronicles_runtime_filtering):
when defaultChroniclesStream.outputs.type.arity == 1:
# Hide the json logs, they're just here to check if we compile
proc noOutput(logLevel: LogLevel, msg: LogOutputStr) = discard
defaultChroniclesStream.outputs[0].writer = noOutput
defaultChroniclesStream.outputs[0].writer = noOutput
{.used.}

View File

@ -1,4 +1,4 @@
import chronos, unittest2, helpers, stublogger
import chronos, unittest2, helpers
import ../libp2p/daemon/daemonapi, ../libp2p/multiaddress, ../libp2p/multicodec,
../libp2p/cid, ../libp2p/multihash, ../libp2p/peerid

View File

@ -1,5 +1,3 @@
import stublogger
import helpers, commoninterop
import ../libp2p
import ../libp2p/crypto/crypto, ../libp2p/protocols/connectivity/relay/[relay, client]

View File

@ -1,5 +1,3 @@
import stublogger
import testvarint,
testconnection,
testminprotobuf,

View File

@ -9,7 +9,6 @@
when defined(nimHasUsed): {.used.}
import unittest2
import stublogger
import ../libp2p/crypto/crypto
import nimcrypto/utils