summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorEXetoC <exetoc@gmail.com>2014-04-20 18:10:57 +0200
committerEXetoC <exetoc@gmail.com>2014-04-20 18:10:57 +0200
commita822d0bf0196f2c77f9032a5455c5102f673acad (patch)
treec6376ef1cbaa717f815e38f2aba29ae4af39fee1 /tests
parentbe6474af638b72aabeb70cfc5f477cc5fb7af0ce (diff)
downloadNim-a822d0bf0196f2c77f9032a5455c5102f673acad.tar.gz
Add spawn test. Hangs most of the time on linux x64 at least.
Diffstat (limited to 'tests')
-rw-r--r--tests/system/tsysspawn.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/system/tsysspawn.nim b/tests/system/tsysspawn.nim
new file mode 100644
index 000000000..0388918aa
--- /dev/null
+++ b/tests/system/tsysspawn.nim
@@ -0,0 +1,29 @@
+discard """
+  output: '''4
+8'''
+  cmd: "nimrod $target --threads:on $options $file"
+"""
+
+var
+  x, y = 0
+
+proc p1 =
+  for i in 0 .. 1_000_000:
+    discard
+
+  inc x
+
+proc p2 =
+  for i in 0 .. 1_000_000:
+    discard
+
+  inc y, 2
+
+for i in 0.. 3:
+  spawn(p1())
+  spawn(p2())
+
+sync()
+
+echo x
+echo y