2018-12-17 21:48:33 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
packageName = "faststreams"
|
2021-08-20 11:10:26 +00:00
|
|
|
version = "0.3.0"
|
2018-12-17 21:48:33 +00:00
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "Nearly zero-overhead input/output streams for Nim"
|
|
|
|
license = "Apache License 2.0"
|
|
|
|
skipDirs = @["tests"]
|
|
|
|
|
2023-06-20 12:38:26 +00:00
|
|
|
requires "nim >= 1.6.0",
|
2020-04-13 18:59:34 +00:00
|
|
|
"stew",
|
2021-05-27 22:36:44 +00:00
|
|
|
"unittest2"
|
2018-12-17 21:48:33 +00:00
|
|
|
|
2022-11-23 15:27:20 +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-06-20 12:38:26 +00:00
|
|
|
" --styleCheck:usages --styleCheck:error" &
|
2022-11-23 15:27:20 +00:00
|
|
|
(if verbose: "" else: " --verbosity:0 --hints:off") &
|
|
|
|
" --skipParentCfg --skipUserCfg --outdir:build --nimcache:build/nimcache -f"
|
|
|
|
|
|
|
|
proc build(args, path: string) =
|
|
|
|
exec nimc & " " & lang & " " & cfg & " " & flags & " " & args & " " & path
|
|
|
|
|
|
|
|
proc run(args, path: string) =
|
2024-06-26 02:12:29 +00:00
|
|
|
build args & " --mm:refc -r", path
|
2024-02-14 02:06:39 +00:00
|
|
|
if (NimMajor, NimMinor) > (1, 6):
|
2024-06-26 02:12:29 +00:00
|
|
|
build args & " --mm:orc -r", path
|
2019-01-09 22:21:31 +00:00
|
|
|
|
2021-01-07 05:18:00 +00:00
|
|
|
task test, "Run all tests":
|
2022-11-23 15:27:20 +00:00
|
|
|
# TODO asyncdispatch backend is broken / untested
|
2023-05-23 12:35:22 +00:00
|
|
|
# TODO chronos backend uses nested waitFor which is not supported
|
|
|
|
for backend in ["-d:asyncBackend=none"]:
|
2022-11-23 15:27:20 +00:00
|
|
|
for threads in ["--threads:off", "--threads:on"]:
|
2023-06-21 21:58:47 +00:00
|
|
|
for mode in ["-d:debug", "-d:release", "-d:danger", "-d:useMalloc"]:
|
2022-11-23 15:27:20 +00:00
|
|
|
run backend & " " & threads & " " & mode, "tests/all_tests"
|
|
|
|
|
2023-05-23 12:35:22 +00:00
|
|
|
task testChronos, "Run chronos tests":
|
|
|
|
# TODO chronos backend uses nested waitFor which is not supported
|
|
|
|
for backend in ["-d:asyncBackend=chronos"]:
|
|
|
|
for threads in ["--threads:off", "--threads:on"]:
|
|
|
|
for mode in ["-d:debug", "-d:release", "-d:danger"]:
|
|
|
|
run backend & " " & threads & " " & mode, "tests/all_tests"
|