Skip to content

Commit cf0d809

Browse files
authored
chore(ci): add verbose output for test binaries (#1790)
1 parent 31abbee commit cf0d809

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

libp2p.nimble

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,20 @@ let cfg =
2525

2626
import hashes, strutils
2727

28-
proc runTest(filename: string, moreoptions: string = "") =
29-
var excstr = nimc & " " & lang & " -d:debug " & cfg & " " & flags
30-
excstr.add(" " & moreoptions & " ")
28+
proc runTest(filename: string, moreoptions: string = "", verbose: bool = true) =
29+
var compileCmd = nimc & " " & lang & " -d:debug " & cfg & " " & flags
3130
if getEnv("CICOV").len > 0:
32-
excstr &= " --nimcache:nimcache/" & filename & "-" & $excstr.hash
33-
exec excstr &
34-
" -r -d:libp2p_autotls_support -d:libp2p_mix_experimental_exit_is_dest -d:libp2p_gossipsub_1_4 tests/" &
35-
filename
31+
compileCmd &= " --nimcache:nimcache/" & filename & "-" & $compileCmd.hash
32+
compileCmd &= " -d:libp2p_autotls_support"
33+
compileCmd &= " -d:libp2p_mix_experimental_exit_is_dest"
34+
compileCmd &= " -d:libp2p_gossipsub_1_4"
35+
compileCmd &= " " & moreoptions & " "
36+
37+
# step 1: compile test binary
38+
exec compileCmd & " tests/" & filename
39+
# step 2: run binary
40+
exec "./tests/" & filename.toExe & (if verbose: " --output-level=VERBOSE" else: "")
41+
# step 3: remove binary
3642
rmFile "tests/" & filename.toExe
3743

3844
proc buildSample(filename: string, run = false, extraFlags = "") =
@@ -55,7 +61,7 @@ task testmultiformatexts, "Run multiformat extensions tests":
5561
"-d:libp2p_multihash_exts=../tests/multiformat_exts/multihash_exts.nim " &
5662
"-d:libp2p_multibase_exts=../tests/multiformat_exts/multibase_exts.nim " &
5763
"-d:libp2p_contentids_exts=../tests/multiformat_exts/contentids_exts.nim "
58-
runTest("multiformat_exts/testmultiformat_exts", opts)
64+
runTest("multiformat_exts/testmultiformat_exts", opts, false)
5965

6066
task testnative, "Runs libp2p native tests":
6167
runTest("testnative")

0 commit comments

Comments
 (0)