From 4929ed1af2325edcd0570bf7b7e08aacd76acecd Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Wed, 22 Jan 2025 19:23:08 +1100 Subject: [PATCH] automatically enable chronicles logs for the test harness when DEBUG_TESTHARNESS=1 --- Makefile | 2 +- build.nims | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6a347138..5233f52d 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ endif ifdef DEBUG_HARDHAT TEST_PARAMS := $(TEST_PARAMS) -d:DebugHardhat=$(DEBUG_HARDHAT) endif -ifdef DEBUG_CODEXNODES +ifdef DEBUG_CODEXNODES # true by default TEST_PARAMS := $(TEST_PARAMS) -d:DebugCodexNodes=$(DEBUG_CODEXNODES) endif ifdef DEBUG_UPDATES diff --git a/build.nims b/build.nims index 88660321..38ac11d1 100644 --- a/build.nims +++ b/build.nims @@ -1,8 +1,13 @@ mode = ScriptMode.Verbose import std/os except commandLineParams +import std/strutils ### 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") = if not dirExists "build": mkDir "build" @@ -46,7 +51,11 @@ task testIntegration, "Run integration tests": buildBinary "codex", params = "-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 # test "testIntegration", params = "-d:chronicles_sinks=textlines[notimestamps,stdout],textlines[dynamic] " & # "-d:chronicles_enabled_topics:integration:TRACE"