diff options
-rw-r--r-- | testament/categories.nim | 4 | ||||
-rw-r--r-- | tests/realtimeGC/cmain.c | 4 | ||||
-rw-r--r-- | tests/realtimeGC/main.nim.cfg | 6 | ||||
-rw-r--r-- | tests/realtimeGC/readme.txt | 23 | ||||
-rw-r--r-- | tests/realtimeGC/shared.nim | 5 | ||||
-rw-r--r-- | tests/realtimeGC/shared.nim.cfg | 5 | ||||
-rw-r--r-- | tests/realtimeGC/tmain.nim (renamed from tests/realtimeGC/nmain.nim) | 32 |
7 files changed, 32 insertions, 47 deletions
diff --git a/testament/categories.nim b/testament/categories.nim index 3429b760a..c48d611b1 100644 --- a/testament/categories.nim +++ b/testament/categories.nim @@ -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 diff --git a/tests/realtimeGC/cmain.c b/tests/realtimeGC/cmain.c index 0d4bb096a..4bc5bd026 100644 --- a/tests/realtimeGC/cmain.c +++ b/tests/realtimeGC/cmain.c @@ -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"); diff --git a/tests/realtimeGC/main.nim.cfg b/tests/realtimeGC/main.nim.cfg deleted file mode 100644 index fed4fa471..000000000 --- a/tests/realtimeGC/main.nim.cfg +++ /dev/null @@ -1,6 +0,0 @@ - ---app:console ---threads:on - --d:release --d:useRealtimeGC diff --git a/tests/realtimeGC/readme.txt b/tests/realtimeGC/readme.txt index b2e37a1f0..b2788520e 100644 --- a/tests/realtimeGC/readme.txt +++ b/tests/realtimeGC/readme.txt @@ -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 diff --git a/tests/realtimeGC/shared.nim b/tests/realtimeGC/shared.nim index 1abe42089..8b5c05e47 100644 --- a/tests/realtimeGC/shared.nim +++ b/tests/realtimeGC/shared.nim @@ -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 diff --git a/tests/realtimeGC/shared.nim.cfg b/tests/realtimeGC/shared.nim.cfg deleted file mode 100644 index e153b26fa..000000000 --- a/tests/realtimeGC/shared.nim.cfg +++ /dev/null @@ -1,5 +0,0 @@ ---app:lib ---threads:on - --d:release --d:useRealtimeGC diff --git a/tests/realtimeGC/nmain.nim b/tests/realtimeGC/tmain.nim index c9f558dbc..f1515a549 100644 --- a/tests/realtimeGC/nmain.nim +++ b/tests/realtimeGC/tmain.nim @@ -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() |