error instead of echo when testament category is empty; fix realtimeGC (#16162)

This commit is contained in:
Timothee Cour
2020-12-01 11:34:53 -08:00
committed by GitHub
parent c65f95417a
commit fd98705680
7 changed files with 32 additions and 47 deletions

View File

@@ -748,7 +748,9 @@ proc processCategory(r: var TResults, cat: Category,
testSpec r, test
inc testsRun
if testsRun == 0:
echo "[Warning] - Invalid category specified \"", cat.string, "\", no tests were run"
const whiteListedDirs = ["deps"]
doAssert cat.string in whiteListedDirs,
"Invalid category specified: '$#' not in whilelist: $#" % [cat.string, $whiteListedDirs]
proc processPattern(r: var TResults, pattern, options: string; simulate: bool) =
var testsRun = 0

View File

@@ -1,3 +1,5 @@
/* xxx consider removing, this seems redundant with tmain.nim */
#ifdef WIN
#include <windows.h>
#else
@@ -28,7 +30,7 @@ int main(int argc, char* argv[])
status = (pFunc)GetProcAddress((HMODULE) hndl, (char const*)"status");
count = (pFunc)GetProcAddress((HMODULE) hndl, (char const*)"count");
checkOccupiedMem = (pFunc)GetProcAddress((HMODULE) hndl, (char const*)"checkOccupiedMem");
#else /* OSX || NIX */
#else /* OSX || NIX xxx: OSX assumes dylib*/
hndl = (void*) dlopen((char const*)"./tests/realtimeGC/libshared.so", RTLD_LAZY);
status = (pFunc) dlsym(hndl, (char const*)"status");
count = (pFunc) dlsym(hndl, (char const*)"count");

View File

@@ -1,6 +0,0 @@
--app:console
--threads:on
-d:release
-d:useRealtimeGC

View File

@@ -1,21 +1,10 @@
Test the realtime GC without linking nimrtl.dll/so.
Note, this is a long running test, default is 35 minutes. To change the
the run time see RUNTIME in nmain.nim and cmain.c.
To build by hand and run the test for 35 minutes:
$ nim r --threads:on -d:runtimeSecs:2100 tests/realtimeGC/nmain.nim
You can build shared.nim, nmain.nim, and cmain.c by running make (nix systems)
or make.bat (Windows systems). They both assume GCC and that it's in your
path. Output: shared.(dll/so), cmain(.exe), nmain(.exe).
To run the test: execute either nmain or cmain in a shell window.
To build by hand:
- build the shared object (shared.nim):
$ nim c tests/realtimeGC/shared.nim
- build the client executables:
$ nim c --threads:on tests/realtimeGC/nmain.nim
```
xxx do we still need tests/realtimeGC/cmain.c?
if so, tests/realtimeGC/cmain.c needs to updated and factorized with nmain.nim to avoid duplication (even if it's a C file)
```
$ gcc -o tests/realtimeGC/cmain tests/realtimeGC/cmain.c -ldl

View File

@@ -1,8 +1,3 @@
discard """
cmd: "nim $target --debuginfo --hints:on --app:lib $options $file"
action: compile
"""
import strutils
# Global state, accessing with threads, no locks. Don't do this at

View File

@@ -1,5 +0,0 @@
--app:lib
--threads:on
-d:release
-d:useRealtimeGC

View File

@@ -1,18 +1,27 @@
discard """
cmd: "nim $target --debuginfo $options $file"
output: "Done"
cmd: "nim $target --threads:on -d:release -d:useRealtimeGC $options $file"
joinable:false
"""
import times, os, threadpool
#[
was: cmd: "nim $target --debuginfo $options $file"
these dont' seem needed --debuginfo
nor these from the previous main.nim.cfg: --app:console
]#
const RUNTIME = 15 * 60 # 15 minutes
import times, os, strformat, strutils
from stdtest/specialpaths import buildDir
# import threadpool
when defined(windows):
const dllname = "./tests/realtimeGC/shared.dll"
elif defined(macosx):
const dllname = "./tests/realtimeGC/libshared.dylib"
else:
const dllname = "./tests/realtimeGC/libshared.so"
const runtimeSecs {.intdefine.} = 5
const file = "shared.nim"
const dllname = buildDir / (DynlibFormat % file)
static:
let nim = getCurrentCompilerExe()
let (output, exitCode) = gorgeEx(fmt"{nim} c -o:{dllname} --debuginfo --app:lib --threads:on -d:release -d:useRealtimeGC {file}")
doAssert exitCode == 0, output
proc status() {.importc: "status", dynlib: dllname.}
proc count() {.importc: "count", dynlib: dllname.}
@@ -20,7 +29,7 @@ proc checkOccupiedMem() {.importc: "checkOccupiedMem", dynlib: dllname.}
proc process() =
let startTime = getTime()
let runTime = cast[Time](RUNTIME) #
let runTime = cast[Time](runtimeSecs)
var accumTime: Time
while accumTime < runTime:
for i in 0..10:
@@ -41,6 +50,5 @@ proc main() =
# for i in 0..0:
# spawn process()
# sync()
echo("Done")
main()