2021-01-06 10:48:10 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
version = "0.1.0"
|
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "General purpose background task runner for Nim programs"
|
2021-01-14 19:51:18 +00:00
|
|
|
license = "Apache License 2.0 or MIT"
|
2021-01-06 10:48:10 +00:00
|
|
|
skipDirs = @["test"]
|
|
|
|
|
|
|
|
requires "nim >= 1.2.0",
|
|
|
|
"chronos"
|
|
|
|
|
|
|
|
proc buildAndRunTest(name: string,
|
|
|
|
srcDir = "test/",
|
|
|
|
outDir = "test/build/",
|
|
|
|
params = "",
|
|
|
|
cmdParams = "",
|
|
|
|
lang = "c") =
|
|
|
|
rmDir outDir
|
|
|
|
mkDir outDir
|
|
|
|
# allow something like "nim test --verbosity:0 --hints:off beacon_chain.nims"
|
|
|
|
var extra_params = params
|
|
|
|
for i in 2..<paramCount():
|
|
|
|
extra_params &= " " & paramStr(i)
|
|
|
|
exec "nim " &
|
|
|
|
lang &
|
|
|
|
" --debugger:native" &
|
|
|
|
" --define:chronicles_line_numbers" &
|
|
|
|
" --define:debug" &
|
2021-02-05 01:38:33 +00:00
|
|
|
" --define:ssl" &
|
2021-01-14 19:51:18 +00:00
|
|
|
" --linetrace:on" &
|
2021-01-06 10:48:10 +00:00
|
|
|
" --nimcache:nimcache/test/" & name &
|
|
|
|
" --out:" & outDir & name &
|
2021-01-14 19:51:18 +00:00
|
|
|
" --stacktrace:on" &
|
2021-01-06 10:48:10 +00:00
|
|
|
" --threads:on" &
|
|
|
|
" --tlsEmulation:off" &
|
|
|
|
" " &
|
|
|
|
extra_params &
|
|
|
|
" " &
|
|
|
|
srcDir & name & ".nim" &
|
|
|
|
" " &
|
|
|
|
cmdParams
|
|
|
|
exec outDir & name
|
|
|
|
|
|
|
|
task tests, "Run all tests":
|
2021-01-14 19:51:18 +00:00
|
|
|
buildAndRunTest "test_all"
|
|
|
|
|
2021-02-05 01:38:33 +00:00
|
|
|
task achannels_helgrind, "Run channel implementation through helgrind to detect threading or lock errors":
|
2021-01-14 19:51:18 +00:00
|
|
|
rmDir "test/build/"
|
|
|
|
mkDir "test/build/"
|
|
|
|
var commands = [
|
|
|
|
"nim c" &
|
|
|
|
" --define:useMalloc" &
|
2021-02-05 01:38:33 +00:00
|
|
|
" --nimcache:nimcache/test/achannels_helgrind" &
|
2021-01-14 19:51:18 +00:00
|
|
|
" --out:test/build/test_achannels" &
|
|
|
|
" --threads:on" &
|
|
|
|
" --tlsEmulation:off" &
|
|
|
|
" test/test_achannels.nim",
|
|
|
|
"valgrind --tool=helgrind test/build/test_achannels"
|
|
|
|
]
|
|
|
|
echo "\n" & commands[0]
|
|
|
|
exec commands[0]
|
|
|
|
echo "\n" & commands[1]
|
|
|
|
exec commands[1]
|