summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-04-20 14:00:04 +0200
committerAraq <rumpf_a@web.de>2014-04-20 14:00:04 +0200
commitbe6474af638b72aabeb70cfc5f477cc5fb7af0ce (patch)
treef25002ea96fcfbd69997e22208c55eb3930eeaf0 /tests
parent39e4e3f20570e804e3059574eafe8f78b2d8a9df (diff)
downloadNim-be6474af638b72aabeb70cfc5f477cc5fb7af0ce.tar.gz
removed flawed thread analysis pass
Diffstat (limited to 'tests')
-rw-r--r--tests/actiontable/tactiontable2.nim2
-rw-r--r--tests/bind/tnicerrorforsymchoice.nim8
-rw-r--r--tests/closure/tinvalidclosure.nim2
-rw-r--r--tests/threads/tthreadanalysis2.nim6
-rw-r--r--tests/threads/tthreadanalysis3.nim51
5 files changed, 9 insertions, 60 deletions
diff --git a/tests/actiontable/tactiontable2.nim b/tests/actiontable/tactiontable2.nim
index 878356321..bfeb1c169 100644
--- a/tests/actiontable/tactiontable2.nim
+++ b/tests/actiontable/tactiontable2.nim
@@ -1,6 +1,6 @@
 discard """
   line: 21
-  errormsg: "invalid type: 'TTable[string, proc (string)]'"
+  errormsg: "invalid type: 'TTable[string, proc (string){.gcsafe.}]'"
 """
 
 import tables
diff --git a/tests/bind/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim
index bc271dcab..4e7a271b3 100644
--- a/tests/bind/tnicerrorforsymchoice.nim
+++ b/tests/bind/tnicerrorforsymchoice.nim
@@ -1,18 +1,18 @@
 discard """
   line: 18
-  errormsg: "type mismatch: got (proc (TScgi) | proc (PAsyncSocket, PStringTable, string))"
+  errormsg: "type mismatch: got (proc (TScgi) | proc (PAsyncSocket, PStringTable, string){.gcsafe.})"
 """
 
 #bug #442
 import scgi, sockets, asyncio, strtabs
 proc handleSCGIRequest[TScgi: TScgiState | PAsyncScgiState](s: TScgi) =
-  nil
+  discard
 proc handleSCGIRequest(client: PAsyncSocket, headers: PStringTable, 
                        input: string) =
-  nil
+  discard
 
 proc test(handle: proc (client: PAsyncSocket, headers: PStringTable, 
                         input: string), b: int) =
-  nil
+  discard
 
 test(handleSCGIRequest)
diff --git a/tests/closure/tinvalidclosure.nim b/tests/closure/tinvalidclosure.nim
index c06270bfa..06e19df3c 100644
--- a/tests/closure/tinvalidclosure.nim
+++ b/tests/closure/tinvalidclosure.nim
@@ -1,6 +1,6 @@
 discard """
   line: 12
-  errormsg: "type mismatch: got (proc (int){.closure.})"
+  errormsg: "type mismatch: got (proc (int){.closure, gcsafe.})"
 """
 
 proc ugh[T](x: T) {.closure.} =
diff --git a/tests/threads/tthreadanalysis2.nim b/tests/threads/tthreadanalysis2.nim
index 697e2cb22..bcc09db98 100644
--- a/tests/threads/tthreadanalysis2.nim
+++ b/tests/threads/tthreadanalysis2.nim
@@ -1,7 +1,7 @@
 discard """
   file: "tthreadanalysis2.nim"
-  line: 42
-  errormsg: "write to foreign heap"
+  line: 37
+  errormsg: "'threadFunc' is not GC-safe"
   cmd: "nimrod $target --hints:on --threads:on $options $file"
 """
 
@@ -10,7 +10,7 @@ import os
 var
   thr: array [0..5, TThread[tuple[a, b: int]]]
 
-proc doNothing() = nil
+proc doNothing() = discard
 
 type
   PNode = ref TNode
diff --git a/tests/threads/tthreadanalysis3.nim b/tests/threads/tthreadanalysis3.nim
deleted file mode 100644
index 3c17fe7e2..000000000
--- a/tests/threads/tthreadanalysis3.nim
+++ /dev/null
@@ -1,51 +0,0 @@
-discard """
-  file: "tthreadanalysis3.nim"
-  line: 35
-  errormsg: "write to foreign heap"
-  cmd: "nimrod $target --hints:on --threads:on $options $file"
-"""
-
-import os
-
-var
-  thr: array [0..5, TThread[tuple[a, b: int]]]
-
-proc doNothing() = nil
-
-type
-  PNode = ref TNode
-  TNode = object {.pure.}
-    le, ri: PNode
-    data: string
-
-var
-  root: PNode
-
-proc buildTree(depth: int): PNode =
-  if depth == 3: return nil
-  new(result)
-  result.le = buildTree(depth-1)
-  result.ri = buildTree(depth-1)
-  result.data = $depth
-
-proc echoLeTree(n: PNode) =
-  var it = n
-  while it != nil:
-    echo it.data
-    it = it.le
-
-proc threadFunc(interval: tuple[a, b: int]) {.thread.} = 
-  doNothing()
-  for i in interval.a..interval.b: 
-    var r = buildTree(i)
-    echoLeTree(r) # for local data
-  echoLeTree(root) # and the same for foreign data :-)
-
-proc main =
-  root = buildTree(5)
-  for i in 0..high(thr):
-    createThread(thr[i], threadFunc, (i*100, i*100+50))
-  joinThreads(thr)
-
-main()
-