Add failing ORC thread-safety regressions and run all suites with nimble test

This commit is contained in:
jdb committed 2026-09-21 17:43:45 -05:00
1 parent 15af03e5c5
commit c1c8a3c072
8 files changed
+342 -2

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import std/os
import ../src/namespaced_logging
when not defined(multithreaded):
{.error: "Compile this fixture with -d:multithreaded to exercise writer threads".}
proc formatLine(msg: LogMessage): string {.gcsafe.} = msg.msg & "\n"
proc main() =
doAssert paramCount() == 2
var service = initLogService()
case paramStr(1)
of "file":
service.addAppender(initFileLogAppender(paramStr(2)))
of "console":
# Keep stdout open through the library's exit hook. Redirecting it to a
# file also prevents a full parent/child pipe from blocking the writer.
doAssert open(stdout, paramStr(2), fmWrite)
service.addAppender(initConsoleLogAppender(formatter = formatLine))
else:
raise newException(ValueError, "unknown writer destination")
let local = service.threadLocalRef()
let logger = local.getLogger("shutdown")
for i in 0 ..< 10_000:
logger.info("message " & $i)
# No sleep or explicit flush: normal exit must preserve accepted messages.
main()