allow test parameters to be set from make testIntegration command

This commit is contained in:
Eric 2025-01-22 17:55:31 +11:00
parent 2faf617538
commit efd960fc7e
No known key found for this signature in database
2 changed files with 41 additions and 23 deletions

View File

@ -141,10 +141,28 @@ testContracts: | build deps
echo -e $(BUILD_MSG) "build/$@" && \ echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testContracts $(NIM_PARAMS) build.nims $(ENV_SCRIPT) nim testContracts $(NIM_PARAMS) build.nims
TEST_PARAMS :=
ifdef DEBUG_TESTHARNESS
TEST_PARAMS := $(TEST_PARAMS) -d:DebugTestHarness=$(DEBUG_TESTHARNESS)
endif
ifdef DEBUG_HARDHAT
TEST_PARAMS := $(TEST_PARAMS) -d:DebugHardhat=$(DEBUG_HARDHAT)
endif
ifdef DEBUG_CODEXNODES
TEST_PARAMS := $(TEST_PARAMS) -d:DebugCodexNodes=$(DEBUG_CODEXNODES)
endif
ifdef DEBUG_UPDATES
TEST_PARAMS := $(TEST_PARAMS) -d:ShowContinuousStatusUpdates=$(DEBUG_UPDATES)
endif
ifdef TEST_TIMEOUT
TEST_PARAMS := $(TEST_PARAMS) -d:TestTimeout=$(TEST_TIMEOUT)
endif
# Builds and runs the integration tests # Builds and runs the integration tests
testIntegration: | build deps testIntegration: | build deps
echo TEST PARAMS: $(TEST_PARAMS)
echo -e $(BUILD_MSG) "build/$@" && \ echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim testIntegration $(NIM_PARAMS) build.nims $(ENV_SCRIPT) nim testIntegration $(TEST_PARAMS) $(NIM_PARAMS) build.nims
# Builds and runs all tests (except for Taiko L2 tests) # Builds and runs all tests (except for Taiko L2 tests)
testAll: | build deps testAll: | build deps

View File

@ -30,23 +30,23 @@ const TestConfigs =
IntegrationTestConfig.init("./integration/testecbug", startHardhat = true) IntegrationTestConfig.init("./integration/testecbug", startHardhat = true)
] ]
proc run() {.async.} =
# Echoes stderr if there's a test failure (eg test failed, compilation error) # Echoes stderr if there's a test failure (eg test failed, compilation error)
# or error (eg test manager error) # or error (eg test manager error)
const debugTestHarness = false const DebugTestHarness {.booldefine.} = false
# Echoes stdout from Hardhat process # Echoes stdout from Hardhat process
const debugHardhat = false const DebugHardhat {.booldefine.} = false
# Echoes stdout from the integration test file process. Codex process logs can # Echoes stdout from the integration test file process. Codex process logs can
# also be output if a test uses a multinodesuite, requires CodexConfig.debug # also be output if a test uses a multinodesuite, requires CodexConfig.debug
# to be enabled # to be enabled
const debugCodexNodes = true const DebugCodexNodes {.booldefine.} = true
# Shows test status updates at time intervals. Useful for running locally with # Shows test status updates at time intervals. Useful for running locally with
# active terminal interaction. Set to false for unattended runs, eg CI. # active terminal interaction. Set to false for unattended runs, eg CI.
const showContinuousStatusUpdates = false const ShowContinuousStatusUpdates {.booldefine.} = false
# Timeout duration for EACH integration test file. # Timeout duration (in mimutes) for EACH integration test file.
const testTimeout = 60.minutes const TestTimeout {.intdefine.} = 60
when debugTestHarness and enabledLogLevel != LogLevel.TRACE: proc run() {.async.} =
when DebugTestHarness and enabledLogLevel != LogLevel.TRACE:
styledEcho bgWhite, styledEcho bgWhite,
fgBlack, styleBright, "\n\n ", styleUnderscore, fgBlack, styleBright, "\n\n ", styleUnderscore,
"ADDITIONAL LOGGING AVAILABILE\n\n", resetStyle, bgWhite, fgBlack, styleBright, "ADDITIONAL LOGGING AVAILABILE\n\n", resetStyle, bgWhite, fgBlack, styleBright,
@ -56,7 +56,7 @@ proc run() {.async.} =
resetStyle, bgWhite, fgBlack, resetStyle, bgWhite, fgBlack,
"\n\n nim c -d:chronicles_log_level=TRACE -r ./testIntegration.nim\n\n" "\n\n nim c -d:chronicles_log_level=TRACE -r ./testIntegration.nim\n\n"
when debugCodexNodes: when DebugCodexNodes:
styledEcho bgWhite, styledEcho bgWhite,
fgBlack, styleBright, "\n\n ", styleUnderscore, "ENABLE CODEX LOGGING\n\n", fgBlack, styleBright, "\n\n ", styleUnderscore, "ENABLE CODEX LOGGING\n\n",
resetStyle, bgWhite, fgBlack, styleBright, resetStyle, bgWhite, fgBlack, styleBright,
@ -68,11 +68,11 @@ proc run() {.async.} =
let manager = TestManager.new( let manager = TestManager.new(
configs = TestConfigs, configs = TestConfigs,
debugTestHarness, DebugTestHarness,
debugHardhat, DebugHardhat,
debugCodexNodes, DebugCodexNodes,
showContinuousStatusUpdates, ShowContinuousStatusUpdates,
testTimeout, TestTimeout.minutes,
) )
try: try:
trace "starting test manager" trace "starting test manager"