2024-01-23 16:48:29 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
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"]
|
|
|
|
|
2023-05-09 20:19:44 +00:00
|
|
|
requires "nim >= 1.6.0",
|
2019-02-05 10:10:36 +00:00
|
|
|
"nimcrypto",
|
|
|
|
"stint",
|
2019-02-05 14:06:13 +00:00
|
|
|
"secp256k1",
|
2024-01-12 16:35:44 +00:00
|
|
|
"chronos#head",
|
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",
|
2024-05-30 12:46:57 +00:00
|
|
|
"unittest2",
|
|
|
|
"results"
|
2021-12-11 18:12:55 +00:00
|
|
|
|
2024-01-23 16:48:29 +00:00
|
|
|
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
|
|
|
|
let lang = getEnv("NIMLANG", "c") # Which backend (c/cpp/js)
|
|
|
|
let flags = getEnv("NIMFLAGS", "") # Extra flags for the compiler
|
|
|
|
let verbose = getEnv("V", "") notin ["", "0"]
|
|
|
|
|
|
|
|
let cfg =
|
2023-05-09 20:19:44 +00:00
|
|
|
" --styleCheck:usages --styleCheck:error" &
|
2024-01-23 16:48:29 +00:00
|
|
|
(if verbose: "" else: " --verbosity:0 --hints:off") &
|
|
|
|
" --skipUserCfg --nimcache:build/nimcache -f" &
|
|
|
|
" --warning[ObservableStores]:off -d:nimOldCaseObjects" &
|
2024-01-24 08:09:11 +00:00
|
|
|
" -d:chronicles_log_level=TRACE" &
|
2024-07-01 16:06:10 +00:00
|
|
|
" --threads:on -d:release"
|
2019-02-05 10:32:22 +00:00
|
|
|
|
2022-11-10 08:01:58 +00:00
|
|
|
|
2024-01-23 16:48:29 +00:00
|
|
|
proc build(args, path, outdir: string) =
|
|
|
|
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args &
|
|
|
|
" --outdir:build/" & outdir & " " & path
|
2019-02-05 10:10:36 +00:00
|
|
|
|
2024-07-01 16:06:10 +00:00
|
|
|
proc run(path, outdir: string) =
|
|
|
|
build "--mm:refc -r", path, outdir
|
2024-02-14 03:35:28 +00:00
|
|
|
if (NimMajor, NimMinor) > (1, 6):
|
2024-07-01 16:06:10 +00:00
|
|
|
build "--mm:orc -r", path, outdir
|
2021-04-06 11:33:24 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_keyfile, "Run keyfile tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/keyfile/all_tests", "keyfile"
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_keys, "Run keys tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/keys/all_tests", "keys"
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_discv5, "Run discovery v5 tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/p2p/all_discv5_tests", "p2p"
|
2019-03-25 21:22:02 +00:00
|
|
|
|
2021-04-06 13:43:15 +00:00
|
|
|
task test_discv4, "Run discovery v4 tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/p2p/test_discovery", "p2p"
|
2021-04-06 13:43:15 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_p2p, "Run p2p tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/p2p/all_tests", "p2p"
|
2021-04-18 15:10:10 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_rlp, "Run rlp tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/rlp/all_tests", "rlp"
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_trie, "Run trie tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/trie/all_tests", "trie"
|
2019-02-15 14:46:44 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test_db, "Run db tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/db/all_tests", "db"
|
2020-04-27 13:16:11 +00:00
|
|
|
|
2021-09-13 12:54:06 +00:00
|
|
|
task test_utp, "Run utp tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/utp/all_utp_tests", "utp"
|
2021-09-13 12:54:06 +00:00
|
|
|
|
2022-02-01 06:41:50 +00:00
|
|
|
task test_common, "Run common tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/common/all_tests", "common"
|
2022-02-01 06:41:50 +00:00
|
|
|
|
2021-03-29 13:26:34 +00:00
|
|
|
task test, "Run all tests":
|
2024-07-01 16:06:10 +00:00
|
|
|
run "tests/test_bloom", ""
|
2019-03-25 21:22:02 +00:00
|
|
|
|
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()
|
2022-02-01 06:41:50 +00:00
|
|
|
test_common_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":
|
2024-07-01 16:06:10 +00:00
|
|
|
build "", "tools/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"):
|
2024-01-23 16:48:29 +00:00
|
|
|
build "", file, "fuzzing"
|