summary refs log tree commit diff stats
path: root/tests/async
diff options
context:
space:
mode:
Diffstat (limited to 'tests/async')
-rw-r--r--tests/async/t12221.nim30
-rw-r--r--tests/async/t7758.nim2
-rw-r--r--tests/async/tasync_misc.nim4
-rw-r--r--tests/async/tasyncawait.nim6
-rw-r--r--tests/async/tasyncawait_cyclebreaker.nim6
-rw-r--r--tests/async/tasyncclosestall.nim1
-rw-r--r--tests/async/tfuturestream.nim2
-rw-r--r--tests/async/tjsandnativeasync.nim2
-rw-r--r--tests/async/tpendingcheck.nim2
9 files changed, 21 insertions, 34 deletions
diff --git a/tests/async/t12221.nim b/tests/async/t12221.nim
index a6ccfb060..70e192356 100644
--- a/tests/async/t12221.nim
+++ b/tests/async/t12221.nim
@@ -1,7 +1,7 @@
 import asyncdispatch, os, times
 
 proc doubleSleep(hardSleep: int) {.async.} =
-  await sleepAsync(100)
+  await sleepAsync(50)
   sleep(hardSleep)
 
 template assertTime(target, timeTook: float): untyped {.dirty.} =
@@ -16,37 +16,25 @@ var
 
 # NOTE: this uses poll(3000) to limit timing error potential.
 start = epochTime()
-fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(40)
+fut = sleepAsync(40) and sleepAsync(100) and doubleSleep(20)
 while not fut.finished:
-  poll(3000)
+  poll(1000)
 assertTime(150, epochTime() - start)
 
 start = epochTime()
-fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(100)
+fut = sleepAsync(40) and sleepAsync(100) and doubleSleep(50)
 while not fut.finished:
-  poll(3000)
+  poll(1000)
 assertTime(200, epochTime() - start)
 
 start = epochTime()
-fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(40) and sleepAsync(300)
+fut = sleepAsync(40) and sleepAsync(100) and doubleSleep(20) and sleepAsync(200)
 while not fut.finished:
-  poll(3000)
+  poll(1000)
 assertTime(300, epochTime() - start)
 
 start = epochTime()
-fut = sleepAsync(50) and sleepAsync(150) and doubleSleep(100) and sleepAsync(300)
+fut = (sleepAsync(40) and sleepAsync(100) and doubleSleep(20)) or sleepAsync(300)
 while not fut.finished:
-  poll(3000)
-assertTime(300, epochTime() - start)
-
-start = epochTime()
-fut = (sleepAsync(50) and sleepAsync(150) and doubleSleep(40)) or sleepAsync(700)
-while not fut.finished:
-  poll(3000)
+  poll(1000)
 assertTime(150, epochTime() - start)
-
-start = epochTime()
-fut = (sleepAsync(50) and sleepAsync(150) and doubleSleep(100)) or sleepAsync(700)
-while not fut.finished:
-  poll(3000)
-assertTime(200, epochTime() - start)
diff --git a/tests/async/t7758.nim b/tests/async/t7758.nim
index ce4df1fc9..15aec1c04 100644
--- a/tests/async/t7758.nim
+++ b/tests/async/t7758.nim
@@ -12,4 +12,4 @@ proc main() =
 
   doAssert counter <= 4
 
-for i in 0 .. 10: main()
+for i in 0 .. 4: main()
diff --git a/tests/async/tasync_misc.nim b/tests/async/tasync_misc.nim
index 1febdedb3..298fa64a9 100644
--- a/tests/async/tasync_misc.nim
+++ b/tests/async/tasync_misc.nim
@@ -9,11 +9,11 @@ block: #6100
   done.complete(1)
 
   proc asyncSum: Future[int] {.async.} =
-    for _ in 1..10_000_000:
+    for _ in 1..1_000_000:
       result += await done
 
   let res = waitFor asyncSum()
-  doAssert(res == 10000000)
+  doAssert(res == 1_000_000)
 
 block: #7985
   proc getData(): Future[JsonNode] {.async.} =
diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim
index b1f893489..a52b0953d 100644
--- a/tests/async/tasyncawait.nim
+++ b/tests/async/tasyncawait.nim
@@ -1,13 +1,13 @@
 discard """
-  output: "5000"
+  output: "2000"
 """
 import asyncdispatch, asyncnet, nativesockets, net, strutils, os
 
 var msgCount = 0
 
 const
-  swarmSize = 50
-  messagesToSend = 100
+  swarmSize = 40
+  messagesToSend = 50
 
 var clientCount = 0
 
diff --git a/tests/async/tasyncawait_cyclebreaker.nim b/tests/async/tasyncawait_cyclebreaker.nim
index 1eb2c4676..0304d4b82 100644
--- a/tests/async/tasyncawait_cyclebreaker.nim
+++ b/tests/async/tasyncawait_cyclebreaker.nim
@@ -1,5 +1,5 @@
 discard """
-  output: "50000"
+  output: "20000"
   cmd: "nim c -d:nimTypeNames -d:nimCycleBreaker $file"
 """
 import asyncdispatch, asyncnet, nativesockets, net, strutils, os
@@ -7,8 +7,8 @@ import asyncdispatch, asyncnet, nativesockets, net, strutils, os
 var msgCount = 0
 
 const
-  swarmSize = 500
-  messagesToSend = 100
+  swarmSize = 400
+  messagesToSend = 50
 
 var clientCount = 0
 
diff --git a/tests/async/tasyncclosestall.nim b/tests/async/tasyncclosestall.nim
index be8a13b98..d1c7a5fba 100644
--- a/tests/async/tasyncclosestall.nim
+++ b/tests/async/tasyncclosestall.nim
@@ -99,4 +99,3 @@ proc server() {.async.} =
 
 when isMainModule:
   waitFor server()
-
diff --git a/tests/async/tfuturestream.nim b/tests/async/tfuturestream.nim
index b5772d5ac..a019df400 100644
--- a/tests/async/tfuturestream.nim
+++ b/tests/async/tfuturestream.nim
@@ -17,7 +17,7 @@ var fs = newFutureStream[int]()
 proc alpha() {.async.} =
   for i in 0 .. 5:
     await fs.write(i)
-    await sleepAsync(200)
+    await sleepAsync(100)
 
   echo("Done")
   fs.complete()
diff --git a/tests/async/tjsandnativeasync.nim b/tests/async/tjsandnativeasync.nim
index 45839899f..c4db3bcfb 100644
--- a/tests/async/tjsandnativeasync.nim
+++ b/tests/async/tjsandnativeasync.nim
@@ -19,7 +19,7 @@ else:
 proc foo() {.async.} =
     echo "hi"
     var s = epochTime()
-    await sleepAsync(500)
+    await sleepAsync(200)
     var e = epochTime()
     doAssert(e - s > 0.1)
     echo "bye"
diff --git a/tests/async/tpendingcheck.nim b/tests/async/tpendingcheck.nim
index a5537d8cb..4eceb0353 100644
--- a/tests/async/tpendingcheck.nim
+++ b/tests/async/tpendingcheck.nim
@@ -7,7 +7,7 @@ import asyncdispatch
 doAssert(not hasPendingOperations())
 
 proc test() {.async.} =
-  await sleepAsync(100)
+  await sleepAsync(50)
 
 var f = test()
 while not f.finished: