2018-11-19 02:52:11 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
2018-11-19 04:03:23 +00:00
|
|
|
packageName = "libp2p"
|
2019-11-06 11:01:16 +00:00
|
|
|
version = "0.0.2"
|
2018-11-19 02:52:11 +00:00
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "LibP2P implementation"
|
|
|
|
license = "MIT"
|
2020-09-15 09:16:43 +00:00
|
|
|
skipDirs = @["tests", "examples", "Nim", "tools", "scripts", "docs"]
|
2018-11-19 02:52:11 +00:00
|
|
|
|
2020-04-14 05:26:12 +00:00
|
|
|
requires "nim >= 1.2.0",
|
|
|
|
"nimcrypto >= 0.4.1",
|
2021-08-18 07:40:12 +00:00
|
|
|
"https://github.com/ba0f3/dnsclient.nim == 0.1.0",
|
2020-03-06 19:19:43 +00:00
|
|
|
"bearssl >= 0.1.4",
|
2021-08-03 13:48:03 +00:00
|
|
|
"chronicles#ba2817f1",
|
2020-09-04 16:30:45 +00:00
|
|
|
"chronos >= 2.5.2",
|
2020-04-14 13:27:07 +00:00
|
|
|
"metrics",
|
|
|
|
"secp256k1",
|
2021-08-03 13:48:03 +00:00
|
|
|
"stew#head",
|
|
|
|
"https://github.com/status-im/nim-websock"
|
2018-11-19 02:52:11 +00:00
|
|
|
|
2020-07-21 20:10:21 +00:00
|
|
|
proc runTest(filename: string, verify: bool = true, sign: bool = true,
|
|
|
|
moreoptions: string = "") =
|
2021-09-27 12:30:22 +00:00
|
|
|
var excstr = "nim c --opt:speed -d:debug -d:libp2p_agents_metrics -d:libp2p_protobuf_metrics -d:libp2p_network_protocols_metrics --verbosity:0 --hints:off"
|
2020-06-20 10:56:55 +00:00
|
|
|
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)
|
2020-07-21 20:10:21 +00:00
|
|
|
excstr.add(" " & moreoptions & " ")
|
2020-07-14 00:02:16 +00:00
|
|
|
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
|
2020-04-14 13:21:16 +00:00
|
|
|
rmFile "tests/" & filename.toExe
|
2019-03-14 02:55:47 +00:00
|
|
|
|
2020-04-19 05:04:53 +00:00
|
|
|
proc buildSample(filename: string) =
|
2020-06-20 10:56:55 +00:00
|
|
|
var excstr = "nim c --opt:speed --threads:on -d:debug --verbosity:0 --hints:off"
|
|
|
|
excstr.add(" --warning[CaseTransition]:off --warning[ObservableStores]:off --warning[LockLevel]:off")
|
|
|
|
excstr.add(" examples/" & filename)
|
|
|
|
exec excstr
|
2020-04-19 05:04:53 +00:00
|
|
|
rmFile "examples" & filename.toExe
|
|
|
|
|
2020-05-06 09:26:08 +00:00
|
|
|
task testnative, "Runs libp2p native tests":
|
2020-04-23 01:27:29 +00:00
|
|
|
runTest("testnative")
|
2020-05-06 09:26:08 +00:00
|
|
|
|
|
|
|
task testdaemon, "Runs daemon tests":
|
2020-04-23 01:27:29 +00:00
|
|
|
runTest("testdaemon")
|
2020-05-06 09:26:08 +00:00
|
|
|
|
|
|
|
task testinterop, "Runs interop tests":
|
2020-04-23 01:27:29 +00:00
|
|
|
runTest("testinterop")
|
2020-04-19 05:04:53 +00:00
|
|
|
|
2020-05-06 09:26:08 +00:00
|
|
|
task testpubsub, "Runs pubsub tests":
|
2020-09-21 09:16:29 +00:00
|
|
|
runTest("pubsub/testgossipinternal", sign = false, verify = false, moreoptions = "-d:pubsub_internal_testing")
|
2020-05-06 09:26:08 +00:00
|
|
|
runTest("pubsub/testpubsub")
|
|
|
|
runTest("pubsub/testpubsub", sign = false, verify = false)
|
2020-09-28 07:11:18 +00:00
|
|
|
runTest("pubsub/testpubsub", sign = false, verify = false, moreoptions = "-d:libp2p_pubsub_anonymize=true")
|
2020-05-06 09:26:08 +00:00
|
|
|
|
2020-09-28 07:11:18 +00:00
|
|
|
task testpubsub_slim, "Runs pubsub tests":
|
|
|
|
runTest("pubsub/testgossipinternal", sign = false, verify = false, moreoptions = "-d:pubsub_internal_testing")
|
|
|
|
runTest("pubsub/testpubsub")
|
|
|
|
|
2020-07-21 20:10:21 +00:00
|
|
|
task testfilter, "Run PKI filter test":
|
|
|
|
runTest("testpkifilter",
|
|
|
|
moreoptions = "-d:libp2p_pki_schemes=\"secp256k1\"")
|
|
|
|
runTest("testpkifilter",
|
|
|
|
moreoptions = "-d:libp2p_pki_schemes=\"secp256k1;ed25519\"")
|
|
|
|
runTest("testpkifilter",
|
|
|
|
moreoptions = "-d:libp2p_pki_schemes=\"secp256k1;ed25519;ecnist\"")
|
|
|
|
runTest("testpkifilter",
|
|
|
|
moreoptions = "-d:libp2p_pki_schemes=")
|
|
|
|
|
2020-05-06 09:26:08 +00:00
|
|
|
task test, "Runs the test suite":
|
|
|
|
exec "nimble testnative"
|
|
|
|
exec "nimble testpubsub"
|
|
|
|
exec "nimble testdaemon"
|
|
|
|
exec "nimble testinterop"
|
2020-07-21 20:10:21 +00:00
|
|
|
exec "nimble testfilter"
|
2020-05-06 09:26:08 +00:00
|
|
|
|
2020-09-28 07:11:18 +00:00
|
|
|
task test_slim, "Runs the test suite":
|
|
|
|
exec "nimble testnative"
|
|
|
|
exec "nimble testpubsub_slim"
|
|
|
|
exec "nimble testinterop"
|
|
|
|
exec "nimble testfilter"
|
|
|
|
|
2020-04-19 05:04:53 +00:00
|
|
|
task examples_build, "Build the samples":
|
2020-04-23 01:27:29 +00:00
|
|
|
buildSample("directchat")
|