summary refs log tree commit diff stats
path: root/tests/parallel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parallel')
-rw-r--r--tests/parallel/t10913.nim2
-rw-r--r--tests/parallel/t7535.nim2
-rw-r--r--tests/parallel/t9691.nim2
-rw-r--r--tests/parallel/tblocking_channel.nim4
-rw-r--r--tests/parallel/tguard1.nim2
-rw-r--r--tests/parallel/tlet_spawn.nim11
-rw-r--r--tests/parallel/tsendtwice.nim21
-rw-r--r--tests/parallel/tsimple_array_checks.nim12
-rw-r--r--tests/parallel/tuseafterdef.nim1
9 files changed, 36 insertions, 21 deletions
diff --git a/tests/parallel/t10913.nim b/tests/parallel/t10913.nim
index d8459ecd0..191939100 100644
--- a/tests/parallel/t10913.nim
+++ b/tests/parallel/t10913.nim
@@ -1,5 +1,5 @@
 discard """
-  matrix: "--threads:on"
+  matrix: "--mm:refc; --mm:orc"
   errormsg: "'spawn'ed function cannot have a 'typed' or 'untyped' parameter"
 """
 
diff --git a/tests/parallel/t7535.nim b/tests/parallel/t7535.nim
index 052dcdc3a..7817a1c9e 100644
--- a/tests/parallel/t7535.nim
+++ b/tests/parallel/t7535.nim
@@ -1,5 +1,5 @@
 discard """
-  matrix: "--threads:on"
+  matrix: "--mm:refc; --mm:orc"
   errormsg: "'spawn' takes a call expression; got: proc (x: uint32) = echo [x]"
 """
 
diff --git a/tests/parallel/t9691.nim b/tests/parallel/t9691.nim
index bbf2b1bc7..254f03416 100644
--- a/tests/parallel/t9691.nim
+++ b/tests/parallel/t9691.nim
@@ -1,5 +1,5 @@
 discard """
-  matrix: "--threads:on"
+  matrix: "--mm:refc; --mm:orc"
   errormsg: "'spawn'ed function cannot have a 'typed' or 'untyped' parameter"
 """
 
diff --git a/tests/parallel/tblocking_channel.nim b/tests/parallel/tblocking_channel.nim
index eb5fcb715..f3ccd166a 100644
--- a/tests/parallel/tblocking_channel.nim
+++ b/tests/parallel/tblocking_channel.nim
@@ -1,8 +1,8 @@
 discard """
 output: ""
-disabled: "freebsd"
+disabled: "freebsd" # see #15725
 """
-# disabled pending bug #15725
+
 import threadpool, os
 
 var chan: Channel[int]
diff --git a/tests/parallel/tguard1.nim b/tests/parallel/tguard1.nim
index b1eb7e7c5..f4c92319b 100644
--- a/tests/parallel/tguard1.nim
+++ b/tests/parallel/tguard1.nim
@@ -5,7 +5,7 @@ output: "90"
 
 when false:
   template lock(a, b: ptr Lock; body: stmt) =
-    if cast[ByteAddress](a) < cast[ByteAddress](b):
+    if cast[int](a) < cast[int](b):
       pthread_mutex_lock(a)
       pthread_mutex_lock(b)
     else:
diff --git a/tests/parallel/tlet_spawn.nim b/tests/parallel/tlet_spawn.nim
index 62341d8f0..853ffc443 100644
--- a/tests/parallel/tlet_spawn.nim
+++ b/tests/parallel/tlet_spawn.nim
@@ -4,7 +4,7 @@ done999 999
 '''
 """
 
-import threadpool
+import std/[threadpool, os]
 
 proc foo(): int = 999
 
@@ -17,3 +17,12 @@ proc main =
   echo "done", f, " ", b
 
 main()
+
+# bug #13781
+proc thread(): string =
+  os.sleep(1000)
+  return "ok"
+
+var fv = spawn thread()
+sync()
+doAssert ^fv == "ok"
diff --git a/tests/parallel/tsendtwice.nim b/tests/parallel/tsendtwice.nim
index 6bf5e5ebb..9f4a2e06e 100644
--- a/tests/parallel/tsendtwice.nim
+++ b/tests/parallel/tsendtwice.nim
@@ -1,18 +1,10 @@
 discard """
-  output: '''ob2 @[]
-ob @[]
-ob3 @[]
-3
-ob2 @[]
-ob @[]
-ob3 @[]
-'''
   matrix: "--mm:refc"
 """
 
 # bug #4776
 
-import tables
+import tables, algorithm
 
 type
   Base* = ref object of RootObj
@@ -35,20 +27,21 @@ globalTable.add("ob", d)
 globalTable.add("ob2", d)
 globalTable.add("ob3", d)
 
+proc `<`(x, y: seq[int]): bool = x.len < y.len
+proc kvs(t: TableRef[string, Base]): seq[(string, seq[int])] =
+  for k, v in t.pairs: result.add (k, v.someSeq)
+  result.sort
+
 proc testThread(channel: ptr TableChannel) {.thread.} =
   globalTable = channel[].recv()
-  for k, v in pairs globaltable:
-    echo k, " ", v.someSeq
   var myObj: Base
   deepCopy(myObj, globalTable["ob"])
   myObj.someSeq = newSeq[int](100)
   let table = channel[].recv() # same table
-  echo table.len
-  for k, v in mpairs table:
-    echo k, " ", v.someSeq
   assert(table.contains("ob")) # fails!
   assert(table.contains("ob2")) # fails!
   assert(table.contains("ob3")) # fails!
+  assert table.kvs == globalTable.kvs # Last to see above spot checks first
 
 var channel: TableChannel
 
diff --git a/tests/parallel/tsimple_array_checks.nim b/tests/parallel/tsimple_array_checks.nim
index 650b809e0..ab292f935 100644
--- a/tests/parallel/tsimple_array_checks.nim
+++ b/tests/parallel/tsimple_array_checks.nim
@@ -61,3 +61,15 @@ maino() # Doesn't work outside a proc
 
 when true:
   main()
+
+block two:
+  proc f(a: openArray[int]) =
+    discard
+
+  proc main() =
+    var a: array[0..9, int] = [0,1,2,3,4,5,6,7,8,9]
+    parallel:
+      spawn f(a[0..2])
+
+
+  main()
\ No newline at end of file
diff --git a/tests/parallel/tuseafterdef.nim b/tests/parallel/tuseafterdef.nim
index e73f1b794..64f835a1b 100644
--- a/tests/parallel/tuseafterdef.nim
+++ b/tests/parallel/tuseafterdef.nim
@@ -1,5 +1,6 @@
 discard """
   matrix: "--mm:refc"
+  disabled: true
   errormsg: "(k)..(k) not disjoint from (k)..(k)"
   line: 24
   action: compile