[build] fix: ignore logging when running singular tests (#369)

* [build] fix: ignore logging when running singular tests

Ensures that logging is ignored at runtime when running
individual tests using `nim c -r tests/...`

* [build] Allow tests to be run with -d:chronicles_log_level

When running tests with chronicles_log_level set, do not
hide the the logs.
This commit is contained in:
markspanbroek 2023-03-16 15:32:09 +01:00 committed by GitHub
parent 5ae545bc3c
commit 086b5c3914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 9 deletions

8
tests/config.nims Normal file
View File

@ -0,0 +1,8 @@
--path:".."
--threads:on
--tlsEmulation:off
when not defined(chronicles_log_level):
--define:"chronicles_log_level:NONE" # compile all log statements
--define:"chronicles_sinks:textlines[dynamic]" # allow logs to be filtered at runtime
--"import":"logging" # ensure that logging is ignored at runtime

View File

@ -4,3 +4,6 @@ proc ignoreLogging(level: LogLevel, message: LogOutputStr) =
discard discard
defaultChroniclesStream.output.writer = ignoreLogging defaultChroniclesStream.output.writer = ignoreLogging
{.warning[UnusedImport]:off.}
{.used.}

View File

@ -1,6 +0,0 @@
--path:".."
--threads:on
--tlsEmulation:off
-d:chronicles_log_level:"NONE" # compile all log statements
-d:chronicles_sinks:"textlines[dynamic]" # allow logs to be filtered by tests

View File

@ -1,4 +1,3 @@
import ./logging
import ./codex/teststores import ./codex/teststores
import ./codex/testblockexchange import ./codex/testblockexchange
import ./codex/teststorageproofs import ./codex/teststorageproofs

View File

@ -1,4 +1,3 @@
import ./logging
import ./contracts/testCollateral import ./contracts/testCollateral
import ./contracts/testContracts import ./contracts/testContracts
import ./contracts/testMarket import ./contracts/testMarket

View File

@ -1,4 +1,3 @@
import ./logging
import ./integration/testIntegration import ./integration/testIntegration
import ./integration/testblockexpiration import ./integration/testblockexpiration