From 2ebf7b15680e9c988ef19ac5d5cf10a4d37d2d91 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Wed, 19 Mar 2025 12:57:48 +1100 Subject: [PATCH] reinstate logging after it also failed on windows and ci --- tests/integration/multinodes.nim | 20 ++++++++++---------- tests/integration/testmanager.nim | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/integration/multinodes.nim b/tests/integration/multinodes.nim index 31833923..4df1354e 100644 --- a/tests/integration/multinodes.nim +++ b/tests/integration/multinodes.nim @@ -167,7 +167,7 @@ template multinodesuite*(name: string, body: untyped) = sanitize($starttime) / sanitize($role & "_" & $roleIdx) try: - if config.logFile.isSome: # or CodexLogToFile: + if config.logFile.isSome or CodexLogToFile: try: let updatedLogFile = getLogFile( CodexLogsDir, starttime, name, currentTestName, $role, some roleIdx @@ -360,15 +360,15 @@ template multinodesuite*(name: string, body: untyped) = except CatchableError as e: raiseMultiNodeSuiteError "Failed to get node info: " & e.msg, e - # setupAll: - # # When this file is run with `-d:chronicles_sinks=textlines[file]`, we - # # need to set the log file path at runtime, otherwise chronicles didn't seem to - # # create a log file even when using an absolute path - # when defaultChroniclesStream.outputs is (FileOutput,) and CodexLogsDir.len > 0: - # let logFile = - # CodexLogsDir / sanitize(getAppFilename().extractFilename & ".chronicles.log") - # let success = defaultChroniclesStream.outputs[0].open(logFile, fmAppend) - # doAssert success, "Failed to open log file: " & logFile + setupAll: + # When this file is run with `-d:chronicles_sinks=textlines[file]`, we + # need to set the log file path at runtime, otherwise chronicles didn't seem to + # create a log file even when using an absolute path + when defaultChroniclesStream.outputs is (FileOutput,) and CodexLogsDir.len > 0: + let logFile = + CodexLogsDir / sanitize(getAppFilename().extractFilename & ".chronicles.log") + let success = defaultChroniclesStream.outputs[0].open(logFile, fmAppend) + doAssert success, "Failed to open log file: " & logFile setup: if var conf =? nodeConfigs.hardhat: diff --git a/tests/integration/testmanager.nim b/tests/integration/testmanager.nim index d63a3c97..c587ec31 100644 --- a/tests/integration/testmanager.nim +++ b/tests/integration/testmanager.nim @@ -438,10 +438,10 @@ proc teardownTest( stdoutBytes = output.stdOut.len, stderrFile = test.logFile("stderr.log"), stderrBytes = output.stdErr.len - # test.logFile("stdout.log").appendFile(output.stdOut.stripAnsi) - # if test.status == IntegrationTestStatus.Error or - # (test.status == IntegrationTestStatus.Failed and test.output.isErrorLike): - # test.logFile("stderr.log").appendFile(output.stdErr.stripAnsi) + test.logFile("stdout.log").appendFile(output.stdOut.stripAnsi) + if test.status == IntegrationTestStatus.Error or + (test.status == IntegrationTestStatus.Failed and test.output.isErrorLike): + test.logFile("stderr.log").appendFile(output.stdErr.stripAnsi) except AsyncTimeoutError: error "Timeout waiting for stdout or stderr stream contents, nothing will be written to file" except IOError as e: