2020-12-21 11:45:07 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
packageName = "stew"
|
|
|
|
version = "0.1.0"
|
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "Backports, standard library candidates and small utilities that don't yet deserve their own repository"
|
|
|
|
license = "Apache License 2.0"
|
|
|
|
skipDirs = @["tests"]
|
|
|
|
|
2022-09-07 16:16:28 +00:00
|
|
|
requires "nim >= 1.2.0",
|
|
|
|
"unittest2"
|
2020-12-21 11:45:07 +00:00
|
|
|
|
2021-02-02 11:46:38 +00:00
|
|
|
### Helper functions
|
2022-01-14 09:51:22 +00:00
|
|
|
proc test(args, path: string) =
|
2022-09-07 16:16:28 +00:00
|
|
|
# nnkArglist was changed to nnkArgList, so can't always use --styleCheck:error
|
|
|
|
# https://github.com/nim-lang/Nim/pull/17529
|
|
|
|
# https://github.com/nim-lang/Nim/pull/19822
|
|
|
|
let styleCheckStyle =
|
|
|
|
if (NimMajor, NimMinor) < (1, 6):
|
|
|
|
"hint"
|
|
|
|
else:
|
|
|
|
"error"
|
|
|
|
|
2021-02-02 11:46:38 +00:00
|
|
|
# Compilation language is controlled by TEST_LANG
|
2022-09-07 16:16:28 +00:00
|
|
|
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") &
|
|
|
|
" " & args &
|
|
|
|
" -r --hints:off --skipParentCfg --styleCheck:usages --styleCheck:" &
|
|
|
|
styleCheckStyle & " " & path
|
|
|
|
|
|
|
|
proc buildHelper(args, path: string) =
|
|
|
|
let styleCheckStyle =
|
|
|
|
if (NimMajor, NimMinor) < (1, 6):
|
|
|
|
"hint"
|
|
|
|
else:
|
|
|
|
"error"
|
|
|
|
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") &
|
|
|
|
" " & args &
|
|
|
|
" --hints:off --skipParentCfg --styleCheck:usages --styleCheck:" &
|
|
|
|
styleCheckStyle & " " & path
|
2021-02-02 11:46:38 +00:00
|
|
|
|
2020-12-21 11:45:07 +00:00
|
|
|
task test, "Run all tests":
|
2022-09-07 16:16:28 +00:00
|
|
|
# Building `test_helper.nim`.
|
|
|
|
buildHelper("", "tests/test_helper")
|
2021-02-02 11:46:38 +00:00
|
|
|
test "--threads:off", "tests/all_tests"
|
|
|
|
test "--threads:on -d:nimTypeNames", "tests/all_tests"
|
2022-09-07 16:16:28 +00:00
|
|
|
test "--threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians",
|
|
|
|
"tests/all_tests"
|
2020-12-21 11:45:07 +00:00
|
|
|
|
|
|
|
task testvcc, "Run all tests with vcc compiler":
|
2022-09-07 16:16:28 +00:00
|
|
|
# Building `test_helper.nim`.
|
|
|
|
buildHelper("--cc:vcc", "tests/test_helper")
|
2021-02-02 11:46:38 +00:00
|
|
|
test "--cc:vcc --threads:off", "tests/all_tests"
|
|
|
|
test "--cc:vcc --threads:on -d:nimTypeNames", "tests/all_tests"
|
2022-09-07 16:16:28 +00:00
|
|
|
test "--cc:vcc --threads:on -d:noIntrinsicsBitOpts -d:noIntrinsicsEndians",
|
|
|
|
"tests/all_tests"
|