CI: build binaries with TRACE & JSON logs (#268)

Also: remove unused imports.
This commit is contained in:
Ștefan Talpalaru 2020-07-14 02:02:16 +02:00 committed by GitHub
parent c6c2d99907
commit b8b0a2b4bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 14 additions and 34 deletions

View File

@ -17,12 +17,15 @@ requires "nim >= 1.2.0",
"stew >= 0.1.0"
proc runTest(filename: string, verify: bool = true, sign: bool = true) =
var excstr = "nim c -r --opt:speed -d:debug --verbosity:0 --hints:off -d:chronicles_log_level=info"
var excstr = "nim c --opt:speed -d:debug --verbosity:0 --hints:off"
excstr.add(" --warning[CaseTransition]:off --warning[ObservableStores]:off --warning[LockLevel]:off")
excstr.add(" -d:libp2p_pubsub_sign=" & $sign)
excstr.add(" -d:libp2p_pubsub_verify=" & $verify)
excstr.add(" tests/" & filename)
exec excstr
if verify and sign:
# build it with TRACE and JSON logs
exec excstr & " -d:chronicles_log_level=TRACE -d:chronicles_sinks:json" & " tests/" & filename
# build it again, to run it with less verbose logs
exec excstr & " -d:chronicles_log_level=INFO -r" & " tests/" & filename
rmFile "tests/" & filename.toExe
proc buildSample(filename: string) =

View File

@ -11,7 +11,6 @@ import strutils
import chronos, chronicles, stew/byteutils
import stream/connection,
vbuffer,
errors,
protocols/protocol
logScope:

View File

@ -14,8 +14,6 @@ import types,
nimcrypto/utils,
../../stream/connection,
../../stream/bufferstream,
../../utility,
../../errors,
../../peerinfo
export connection

View File

@ -13,7 +13,6 @@ import ../muxer,
../../stream/connection,
../../stream/bufferstream,
../../utility,
../../errors,
../../peerinfo,
coder,
types,

View File

@ -10,7 +10,6 @@
import chronos, chronicles
import ../protocols/protocol,
../stream/connection,
../peerinfo,
../errors
logScope:

View File

@ -15,9 +15,7 @@ import pubsub,
rpc/[messages, message],
../../stream/connection,
../../peerid,
../../peerinfo,
../../utility,
../../errors
../../peerinfo
logScope:
topics = "floodsub"

View File

@ -7,9 +7,8 @@
## This file may not be copied, modified, or distributed except according to
## those terms.
import oids
import chronos, chronicles
import connection, ../utility
import connection
logScope:
topics = "chronosstream"

View File

@ -10,7 +10,6 @@
import tables,
sequtils,
options,
strformat,
sets,
algorithm,
oids
@ -20,18 +19,15 @@ import chronos,
metrics
import stream/connection,
stream/chronosstream,
transports/transport,
multistream,
multiaddress,
protocols/protocol,
protocols/secure/secure,
protocols/secure/plaintext, # for plain text
peerinfo,
protocols/identify,
protocols/pubsub/pubsub,
muxers/muxer,
errors,
peerid
logScope:

View File

@ -16,9 +16,6 @@ import transport,
../stream/connection,
../stream/chronosstream
when chronicles.enabledLogLevel == LogLevel.TRACE:
import oids
logScope:
topics = "tcptransport"
@ -74,7 +71,7 @@ proc connHandler*(t: TcpTransport,
proc cleanup() {.async.} =
try:
await client.join()
trace "cleaning up client", addrs = client.remoteAddress, connoid = conn.oid
trace "cleaning up client", addrs = $client.remoteAddress, connoid = conn.oid
if not(isNil(conn)):
await conn.close()
t.clients.keepItIf(it != client)

View File

@ -7,12 +7,11 @@
## This file may not be copied, modified, or distributed except according to
## those terms.
import sequtils, tables
import sequtils
import chronos, chronicles
import ../stream/connection,
../multiaddress,
../multicodec,
../errors
../multicodec
type
ConnHandler* = proc (conn: Connection): Future[void] {.gcsafe.}

View File

@ -9,7 +9,7 @@
{.used.}
import unittest, sequtils, options, tables, sets
import unittest, sequtils, options, tables
import chronos, stew/byteutils
import utils,
../../libp2p/[errors,
@ -18,8 +18,7 @@ import utils,
crypto/crypto,
protocols/pubsub/pubsub,
protocols/pubsub/floodsub,
protocols/pubsub/rpc/messages,
protocols/pubsub/rpc/message]
protocols/pubsub/rpc/messages]
import ../helpers

View File

@ -1,4 +1,4 @@
import unittest, strutils, sequtils, strformat, stew/byteutils
import unittest, strutils, strformat, stew/byteutils
import chronos
import ../libp2p/errors,
../libp2p/multistream,

View File

@ -9,19 +9,13 @@ import ../libp2p/[errors,
multistream,
standard_setup,
stream/bufferstream,
protocols/identify,
stream/connection,
transports/transport,
transports/tcptransport,
multiaddress,
peerinfo,
crypto/crypto,
protocols/protocol,
muxers/muxer,
muxers/mplex/mplex,
muxers/mplex/types,
protocols/secure/secio,
protocols/secure/secure,
stream/lpstream]
import ./helpers