summary refs log tree commit diff stats
path: root/tests/coroutines/tgc.nim
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2021-01-21 10:31:47 -0600
committerGitHub <noreply@github.com>2021-01-21 17:31:47 +0100
commitdfe67970235d2c270a4fe91a7ba4451102d8eaac (patch)
treefe6b9e640884a43fb2d80eae675538d7b3ce0d0a /tests/coroutines/tgc.nim
parent57d5c1465a576e2d8bfc6496946aa24183c4456d (diff)
downloadNim-dfe67970235d2c270a4fe91a7ba4451102d8eaac.tar.gz
fix #15628 (#16387)
* done

* Apply suggestions from code review

* fixup

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Diffstat (limited to 'tests/coroutines/tgc.nim')
-rw-r--r--tests/coroutines/tgc.nim27
1 files changed, 15 insertions, 12 deletions
diff --git a/tests/coroutines/tgc.nim b/tests/coroutines/tgc.nim
index 311ec5efc..e2f8b6469 100644
--- a/tests/coroutines/tgc.nim
+++ b/tests/coroutines/tgc.nim
@@ -1,19 +1,22 @@
 discard """
-  targets: "c"
+  matrix: "--gc:refc; --gc:arc; --gc:orc"
+  target: "c"
 """
 
-import coro
+when compileOption("gc", "refc") or not defined(openbsd):
+  # xxx openbsd gave: stdlib_coro.nim.c:406:22: error: array type 'jmp_buf' (aka 'long [11]') is not assignable (*dest).execContext = src.execContext;
+  import coro
 
-var maxOccupiedMemory = 0
+  var maxOccupiedMemory = 0
 
-proc testGC() =
-  var numbers = newSeq[int](100)
-  maxOccupiedMemory = max(maxOccupiedMemory, getOccupiedMem())
-  suspend(0)
+  proc testGC() =
+    var numbers = newSeq[int](100)
+    maxOccupiedMemory = max(maxOccupiedMemory, getOccupiedMem())
+    suspend(0)
 
-start(testGC)
-start(testGC)
-run()
+  start(testGC)
+  start(testGC)
+  run()
 
-GC_fullCollect()
-doAssert(getOccupiedMem() < maxOccupiedMemory, "GC did not free any memory allocated in coroutines")
+  GC_fullCollect()
+  doAssert(getOccupiedMem() < maxOccupiedMemory, "GC did not free any memory allocated in coroutines")