automatically enable chronicles logs for the test harness when DEBUG_TESTHARNESS=1

This commit is contained in:
Eric 2025-01-22 19:23:08 +11:00
parent 533c508932
commit 6051c64f30
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View File

@ -148,7 +148,7 @@ endif
ifdef DEBUG_HARDHAT ifdef DEBUG_HARDHAT
TEST_PARAMS := $(TEST_PARAMS) -d:DebugHardhat=$(DEBUG_HARDHAT) TEST_PARAMS := $(TEST_PARAMS) -d:DebugHardhat=$(DEBUG_HARDHAT)
endif endif
ifdef DEBUG_CODEXNODES ifdef DEBUG_CODEXNODES # true by default
TEST_PARAMS := $(TEST_PARAMS) -d:DebugCodexNodes=$(DEBUG_CODEXNODES) TEST_PARAMS := $(TEST_PARAMS) -d:DebugCodexNodes=$(DEBUG_CODEXNODES)
endif endif
ifdef DEBUG_UPDATES ifdef DEBUG_UPDATES

View File

@ -1,8 +1,13 @@
mode = ScriptMode.Verbose mode = ScriptMode.Verbose
import std/os except commandLineParams import std/os except commandLineParams
import std/strutils
### Helper functions ### Helper functions
proc truthy(val: string): bool =
const truthySwitches = @["yes", "1", "on", "true"]
return val in truthySwitches
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") = proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build": if not dirExists "build":
mkDir "build" mkDir "build"
@ -46,7 +51,11 @@ task testIntegration, "Run integration tests":
buildBinary "codex", buildBinary "codex",
params = params =
"-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:codex_enable_proof_failures=true" "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:codex_enable_proof_failures=true"
test "testIntegration" var testParams = ""
for i in 2 ..< paramCount():
if "DebugTestHarness" in paramStr(i) and truthy paramStr(i).split('=')[1]:
testParams = "-d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[stdout]"
test "testIntegration", params = testParams
# use params to enable logging from the integration test executable # use params to enable logging from the integration test executable
# test "testIntegration", params = "-d:chronicles_sinks=textlines[notimestamps,stdout],textlines[dynamic] " & # test "testIntegration", params = "-d:chronicles_sinks=textlines[notimestamps,stdout],textlines[dynamic] " &
# "-d:chronicles_enabled_topics:integration:TRACE" # "-d:chronicles_enabled_topics:integration:TRACE"