aboutsummaryrefslogtreecommitdiff
path: root/tests/cancel.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/cancel.lua22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/cancel.lua b/tests/cancel.lua
index c22103f..5bd569f 100644
--- a/tests/cancel.lua
+++ b/tests/cancel.lua
@@ -5,7 +5,7 @@ for k,v in ipairs{...} do
5 remaining_tests[v] = true 5 remaining_tests[v] = true
6end 6end
7 7
8--#################################################################### 8-- ##################################################################################################
9 9
10local lanes = require "lanes" .configure{ with_timers = false} 10local lanes = require "lanes" .configure{ with_timers = false}
11 11
@@ -13,7 +13,8 @@ local linda = lanes.linda()
13-- a numeric value to read 13-- a numeric value to read
14linda:set( "val", 33.0) 14linda:set( "val", 33.0)
15 15
16--#################################################################### 16-- ##################################################################################################
17
17if not next(which_tests) or which_tests.genlock then 18if not next(which_tests) or which_tests.genlock then
18 remaining_tests.genlock = nil 19 remaining_tests.genlock = nil
19 print "\n\n####################################################################\nbegin genlock & genatomic cancel test\n" 20 print "\n\n####################################################################\nbegin genlock & genatomic cancel test\n"
@@ -42,7 +43,8 @@ if not next(which_tests) or which_tests.genlock then
42 43
43 print "test OK" 44 print "test OK"
44end 45end
45--#################################################################### 46
47-- ##################################################################################################
46 48
47local waitCancellation = function( h, expected_status) 49local waitCancellation = function( h, expected_status)
48 local l = lanes.linda() 50 local l = lanes.linda()
@@ -127,8 +129,8 @@ local protectedBody = function( ...)
127 end 129 end
128end 130end
129 131
130--#################################################################### 132-- ##################################################################################################
131--#################################################################### 133-- ##################################################################################################
132 134
133if not next(which_tests) or which_tests.linda then 135if not next(which_tests) or which_tests.linda then
134 remaining_tests.linda = nil 136 remaining_tests.linda = nil
@@ -149,6 +151,8 @@ if not next(which_tests) or which_tests.linda then
149 linda:cancel( "none") 151 linda:cancel( "none")
150end 152end
151 153
154-- ##################################################################################################
155
152if not next(which_tests) or which_tests.soft then 156if not next(which_tests) or which_tests.soft then
153 remaining_tests.soft = nil 157 remaining_tests.soft = nil
154 print "\n\n####################################################################\nbegin soft cancel test\n" 158 print "\n\n####################################################################\nbegin soft cancel test\n"
@@ -171,6 +175,8 @@ if not next(which_tests) or which_tests.soft then
171 waitCancellation( h, "done") 175 waitCancellation( h, "done")
172end 176end
173 177
178-- ##################################################################################################
179
174if not next(which_tests) or which_tests.hook then 180if not next(which_tests) or which_tests.hook then
175 remaining_tests.hook = nil 181 remaining_tests.hook = nil
176 print "\n\n####################################################################\nbegin hook cancel test\n" 182 print "\n\n####################################################################\nbegin hook cancel test\n"
@@ -186,6 +192,8 @@ if not next(which_tests) or which_tests.hook then
186 waitCancellation( h, "cancelled") 192 waitCancellation( h, "cancelled")
187end 193end
188 194
195-- ##################################################################################################
196
189if not next(which_tests) or which_tests.hard then 197if not next(which_tests) or which_tests.hard then
190 remaining_tests.hard = nil 198 remaining_tests.hard = nil
191 print "\n\n####################################################################\nbegin hard cancel test\n" 199 print "\n\n####################################################################\nbegin hard cancel test\n"
@@ -203,6 +211,8 @@ if not next(which_tests) or which_tests.hard then
203 waitCancellation( h, "cancelled") 211 waitCancellation( h, "cancelled")
204end 212end
205 213
214-- ##################################################################################################
215
206if not next(which_tests) or which_tests.hard_unprotected then 216if not next(which_tests) or which_tests.hard_unprotected then
207 remaining_tests.hard_unprotected = nil 217 remaining_tests.hard_unprotected = nil
208 print "\n\n####################################################################\nbegin hard cancel test with unprotected lane body\n" 218 print "\n\n####################################################################\nbegin hard cancel test with unprotected lane body\n"
@@ -220,7 +230,7 @@ if not next(which_tests) or which_tests.hard_unprotected then
220 waitCancellation( h, "cancelled") 230 waitCancellation( h, "cancelled")
221end 231end
222 232
223--#################################################################### 233-- ##################################################################################################
224 234
225local unknown_test, val = next(remaining_tests) 235local unknown_test, val = next(remaining_tests)
226assert(not unknown_test, tostring(unknown_test) .. " test is unknown") 236assert(not unknown_test, tostring(unknown_test) .. " test is unknown")