2019-02-05 10:10:36 +00:00
|
|
|
version = "1.0.0"
|
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "Ethereum Common library"
|
|
|
|
license = "MIT"
|
|
|
|
skipDirs = @["tests"]
|
|
|
|
|
2021-12-11 18:12:55 +00:00
|
|
|
requires "nim >= 1.2.0",
|
2019-02-05 10:10:36 +00:00
|
|
|
"nimcrypto",
|
|
|
|
"stint",
|
2019-02-05 14:06:13 +00:00
|
|
|
"secp256k1",
|
2019-02-05 15:54:17 +00:00
|
|
|
"rocksdb",
|
2019-02-06 18:11:29 +00:00
|
|
|
"chronos",
|
2019-03-11 09:22:06 +00:00
|
|
|
"chronicles",
|
2019-07-07 09:55:17 +00:00
|
|
|
"stew",
|
2020-08-28 04:13:16 +00:00
|
|
|
"nat_traversal",
|
2020-04-27 13:16:11 +00:00
|
|
|
"metrics",
|
2020-06-02 15:21:50 +00:00
|
|
|
"sqlite3_abi",
|
2020-06-12 14:19:58 +00:00
|
|
|
"confutils",
|
2021-12-11 18:12:55 +00:00
|
|
|
"testutils",
|
|
|
|
"unittest2"
|
|
|
|
|
|
|
|
var commonParams = " --verbosity:0 --hints:off --skipUserCfg:on --warning[ObservableStores]:off " &
|
|
|
|
getEnv("NIMFLAGS") & " "
|
2019-02-05 10:32:22 +00:00
|
|
|
|
2021-03-26 14:20:03 +00:00
|
|
|
proc runTest(path: string, release: bool = true, chronosStrict = true) =
|
2021-12-11 18:12:55 +00:00
|
|
|
echo "\nBuilding and running: ", path
|
2020-12-23 10:29:34 +00:00
|
|
|
let releaseMode = if release: "-d:release" else: ""
|
2021-03-26 14:20:03 +00:00
|
|
|
let chronosMode =
|
|
|
|
if chronosStrict: "-d:chronosStrictException" else: ""
|
|
|
|
exec "nim c -r " & releaseMode & " " & chronosMode &
|
2021-12-11 18:12:55 +00:00
|
|
|
" -d:chronicles_log_level=ERROR " & commonParams & path
|
2019-03-25 21:22:02 +00:00
|
|
|
rmFile path
|
2019-02-05 10:10:36 +00:00
|
|
|
|
2021-04-06 11:33:24 +00:00
|
|
|
proc buildBinary(path: string) =
|
|
|
|
echo "\nBuilding: ", path
|
|
|
|
exec "nim c -d:release -d:chronosStrictException " &
|
2021-12-11 18:12:55 +00:00
|
|
|
"-d:chronicles_log_level=TRACE --threads:on " & commonParams &
|
2021-04-06 11:33:24 +00:00
|
|
|
"--warning[CaseTransition]:off --warning[ObservableStores]:off " &
|
|
|
|
path
|
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_keyfile, "Run keyfile tests":
|
2020-04-27 13:16:11 +00:00
|
|
|
runTest("tests/keyfile/all_tests")
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_keys, "Run keys tests":
|
2020-04-27 13:16:11 +00:00
|
|
|
runTest("tests/keys/all_tests")
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_discv5, "Run discovery v5 tests":
|
|
|
|
runTest("tests/p2p/all_discv5_tests")
|
2019-03-25 21:22:02 +00:00
|
|
|
|
2021-04-06 13:43:15 +00:00
|
|
|
task test_discv4, "Run discovery v4 tests":
|
2021-05-06 15:20:54 +00:00
|
|
|
runTest("tests/p2p/test_discovery")
|
2021-04-06 13:43:15 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_p2p, "Run p2p tests":
|
2021-04-18 15:10:10 +00:00
|
|
|
runTest("tests/p2p/all_tests")
|
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_rlp, "Run rlp tests":
|
2020-12-23 10:29:34 +00:00
|
|
|
# workaround for github action CI
|
|
|
|
# mysterious crash on windows-2019 64bit mode
|
|
|
|
# cannot reproduce locally on windows-2019
|
|
|
|
# running in virtualbox
|
|
|
|
let releaseMode = if existsEnv"PLATFORM":
|
|
|
|
getEnv"PLATFORM" != "windows-amd64"
|
|
|
|
else: true
|
|
|
|
|
|
|
|
runTest("tests/rlp/all_tests", releaseMode)
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_trie, "Run trie tests":
|
2020-04-18 08:17:59 +00:00
|
|
|
runTest("tests/trie/all_tests")
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_db, "Run db tests":
|
2020-04-27 13:16:11 +00:00
|
|
|
runTest("tests/db/all_tests")
|
|
|
|
|
2021-09-13 12:54:06 +00:00
|
|
|
task test_utp, "Run utp tests":
|
2021-10-11 12:16:06 +00:00
|
|
|
runTest("tests/utp/all_utp_tests")
|
2021-09-13 12:54:06 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test, "Run all tests":
|
2019-03-25 21:22:02 +00:00
|
|
|
for filename in [
|
|
|
|
"test_bloom",
|
|
|
|
]:
|
|
|
|
runTest("tests/" & filename)
|
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
test_keyfile_task()
|
|
|
|
test_keys_task()
|
|
|
|
test_rlp_task()
|
|
|
|
test_p2p_task()
|
|
|
|
test_trie_task()
|
|
|
|
test_db_task()
|
2021-09-13 12:54:06 +00:00
|
|
|
test_utp_task()
|
2021-03-29 13:26:34 +00:00
|
|
|
|
|
|
|
task test_discv5_full, "Run discovery v5 and its dependencies tests":
|
|
|
|
test_keys_task()
|
|
|
|
test_rlp_task()
|
|
|
|
test_discv5_task()
|
2021-04-06 11:33:24 +00:00
|
|
|
|
|
|
|
task build_dcli, "Build dcli":
|
|
|
|
buildBinary("eth/p2p/discoveryv5/dcli")
|
2021-09-07 14:00:01 +00:00
|
|
|
|
|
|
|
import os, strutils
|
|
|
|
|
|
|
|
task build_fuzzers, "Build fuzzer test cases":
|
|
|
|
# This file is there to be able to quickly build the fuzzer test cases in
|
|
|
|
# order to avoid bit rot (e.g. for CI). Not for actual fuzzing.
|
|
|
|
# TODO: Building fuzzer test case one by one will make it take a bit longer,
|
|
|
|
# but we cannot import them in one Nim file due to the usage of
|
|
|
|
# `exportc: "AFLmain"` in the fuzzing test template for Windows:
|
|
|
|
# https://github.com/status-im/nim-testutils/blob/master/testutils/fuzzing.nim#L100
|
|
|
|
for file in walkDirRec("tests/fuzzing/"):
|
|
|
|
if file.endsWith("nim"):
|
|
|
|
buildBinary(file)
|