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" "stew >= 0.1.0"
proc runTest(filename: string, verify: bool = true, sign: bool = true) = 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(" --warning[CaseTransition]:off --warning[ObservableStores]:off --warning[LockLevel]:off")
excstr.add(" -d:libp2p_pubsub_sign=" & $sign) excstr.add(" -d:libp2p_pubsub_sign=" & $sign)
excstr.add(" -d:libp2p_pubsub_verify=" & $verify) excstr.add(" -d:libp2p_pubsub_verify=" & $verify)
excstr.add(" tests/" & filename) if verify and sign:
exec excstr # 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 rmFile "tests/" & filename.toExe
proc buildSample(filename: string) = proc buildSample(filename: string) =

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,9 +16,6 @@ import transport,
../stream/connection, ../stream/connection,
../stream/chronosstream ../stream/chronosstream
when chronicles.enabledLogLevel == LogLevel.TRACE:
import oids
logScope: logScope:
topics = "tcptransport" topics = "tcptransport"
@ -74,7 +71,7 @@ proc connHandler*(t: TcpTransport,
proc cleanup() {.async.} = proc cleanup() {.async.} =
try: try:
await client.join() 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)): if not(isNil(conn)):
await conn.close() await conn.close()
t.clients.keepItIf(it != client) t.clients.keepItIf(it != client)

View File

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

View File

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

View File

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

View File

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