From 9c65df305390ab01a13788af5aea78cd62dceb2a Mon Sep 17 00:00:00 2001 From: andri lim Date: Mon, 19 Feb 2024 13:47:40 +0700 Subject: [PATCH] Add build test with chronicles to json enabled (#215) * Add build test with chronicles to json enabled * Fix windows failing test --- json_rpc.nimble | 18 ++++++++---------- json_rpc/clients/socketclient.nim | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/json_rpc.nimble b/json_rpc.nimble index 6bd36ce..7c5c75b 100644 --- a/json_rpc.nimble +++ b/json_rpc.nimble @@ -47,16 +47,14 @@ proc run(args, path: string) = if (NimMajor, NimMinor) > (1, 6): build args & " --mm:refc -r", path -proc buildBinary(name: string, srcDir = "./", params = "", cmdParams = "") = - if not dirExists "build": - mkDir "build" - exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & - " -r -f --skipUserCfg:on --skipParentCfg:on --verbosity:0" & - " --debuginfo --path:'.' --threads:on -d:chronicles_log_level=ERROR" & - " --styleCheck:usages --styleCheck:hint" & - " --hint[XDeclaredButNotUsed]:off --hint[Processing]:off " & - " --out:./build/" & name & " " & params & " " & srcDir & name & ".nim" & - " " & cmdParams +proc buildOnly(args, path: string) = + build args, path + if (NimMajor, NimMinor) > (1, 6): + build args & " --mm:refc -r", path task test, "run tests": run "", "tests/all" + + when not defined(windows): + # on windows, socker server build failed + buildOnly "-d:\"chronicles_sinks=textlines[dynamic],json[dynamic]\"", "tests/all" diff --git a/json_rpc/clients/socketclient.nim b/json_rpc/clients/socketclient.nim index 86269f1..2454c04 100644 --- a/json_rpc/clients/socketclient.nim +++ b/json_rpc/clients/socketclient.nim @@ -110,7 +110,7 @@ proc processData(client: RpcSocketClient) {.async: (raises: []).} = # async loop reconnection and waiting try: - info "Reconnect to server", address=client.address + info "Reconnect to server", address=`$`(client.address) client.transport = await connect(client.address) except TransportError as exc: error "Error when reconnecting to server", msg=exc.msg