aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cancel.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/cancel.lua b/tests/cancel.lua
index 9ee986c..8dfccd2 100644
--- a/tests/cancel.lua
+++ b/tests/cancel.lua
@@ -26,6 +26,9 @@ local linda = lanes.linda()
26-- a numeric value to read 26-- a numeric value to read
27linda:set( "val", 33.0) 27linda:set( "val", 33.0)
28 28
29-- so that we can easily swap between lanes.gen and lanes.coro, to try stuff
30local generator = lanes.coro
31
29-- ################################################################################################## 32-- ##################################################################################################
30 33
31if not next(which_tests) or which_tests.genlock then 34if not next(which_tests) or which_tests.genlock then
@@ -149,7 +152,7 @@ end
149if not next(which_tests) or which_tests.linda then 152if not next(which_tests) or which_tests.linda then
150 remaining_tests.linda = nil 153 remaining_tests.linda = nil
151 print "\n\n####################################################################\nbegin linda cancel test\n" 154 print "\n\n####################################################################\nbegin linda cancel test\n"
152 h = lanes.gen( "*", laneBody)( "receive", nil) -- start an infinite wait on the linda 155 h = generator( "*", laneBody)( "receive", nil) -- start an infinite wait on the linda
153 156
154 print "wait 1s" 157 print "wait 1s"
155 SLEEP(1) 158 SLEEP(1)
@@ -170,7 +173,7 @@ end
170if not next(which_tests) or which_tests.soft then 173if not next(which_tests) or which_tests.soft then
171 remaining_tests.soft = nil 174 remaining_tests.soft = nil
172 print "\n\n####################################################################\nbegin soft cancel test\n" 175 print "\n\n####################################################################\nbegin soft cancel test\n"
173 h = lanes.gen( "*", protectedBody)( "receive") -- start an infinite wait on the linda 176 h = generator( "*", protectedBody)( "receive") -- start an infinite wait on the linda
174 177
175 print "wait 1s" 178 print "wait 1s"
176 SLEEP(1) 179 SLEEP(1)
@@ -194,7 +197,7 @@ end
194if not next(which_tests) or which_tests.hook then 197if not next(which_tests) or which_tests.hook then
195 remaining_tests.hook = nil 198 remaining_tests.hook = nil
196 print "\n\n####################################################################\nbegin hook cancel test\n" 199 print "\n\n####################################################################\nbegin hook cancel test\n"
197 h = lanes.gen( "*", protectedBody)( "get", 300000) 200 h = generator( "*", protectedBody)( "get", 300000)
198 print "wait 2s" 201 print "wait 2s"
199 SLEEP(2) 202 SLEEP(2)
200 203
@@ -230,7 +233,7 @@ end
230if not next(which_tests) or which_tests.hard_unprotected then 233if not next(which_tests) or which_tests.hard_unprotected then
231 remaining_tests.hard_unprotected = nil 234 remaining_tests.hard_unprotected = nil
232 print "\n\n####################################################################\nbegin hard cancel test with unprotected lane body\n" 235 print "\n\n####################################################################\nbegin hard cancel test with unprotected lane body\n"
233 h = lanes.gen( "*", laneBody)( "receive", nil) 236 h = generator( "*", laneBody)( "receive", nil)
234 237
235 -- wait 2s before cancelling the lane 238 -- wait 2s before cancelling the lane
236 print "wait 2s" 239 print "wait 2s"