diff options
Diffstat (limited to '')
-rw-r--r-- | tests/cancel.lua | 22 |
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 |
6 | end | 6 | end |
7 | 7 | ||
8 | --#################################################################### | 8 | -- ################################################################################################## |
9 | 9 | ||
10 | local lanes = require "lanes" .configure{ with_timers = false} | 10 | local 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 |
14 | linda:set( "val", 33.0) | 14 | linda:set( "val", 33.0) |
15 | 15 | ||
16 | --#################################################################### | 16 | -- ################################################################################################## |
17 | |||
17 | if not next(which_tests) or which_tests.genlock then | 18 | if 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" |
44 | end | 45 | end |
45 | --#################################################################### | 46 | |
47 | -- ################################################################################################## | ||
46 | 48 | ||
47 | local waitCancellation = function( h, expected_status) | 49 | local 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 |
128 | end | 130 | end |
129 | 131 | ||
130 | --#################################################################### | 132 | -- ################################################################################################## |
131 | --#################################################################### | 133 | -- ################################################################################################## |
132 | 134 | ||
133 | if not next(which_tests) or which_tests.linda then | 135 | if 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") |
150 | end | 152 | end |
151 | 153 | ||
154 | -- ################################################################################################## | ||
155 | |||
152 | if not next(which_tests) or which_tests.soft then | 156 | if 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") |
172 | end | 176 | end |
173 | 177 | ||
178 | -- ################################################################################################## | ||
179 | |||
174 | if not next(which_tests) or which_tests.hook then | 180 | if 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") |
187 | end | 193 | end |
188 | 194 | ||
195 | -- ################################################################################################## | ||
196 | |||
189 | if not next(which_tests) or which_tests.hard then | 197 | if 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") |
204 | end | 212 | end |
205 | 213 | ||
214 | -- ################################################################################################## | ||
215 | |||
206 | if not next(which_tests) or which_tests.hard_unprotected then | 216 | if 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") |
221 | end | 231 | end |
222 | 232 | ||
223 | --#################################################################### | 233 | -- ################################################################################################## |
224 | 234 | ||
225 | local unknown_test, val = next(remaining_tests) | 235 | local unknown_test, val = next(remaining_tests) |
226 | assert(not unknown_test, tostring(unknown_test) .. " test is unknown") | 236 | assert(not unknown_test, tostring(unknown_test) .. " test is unknown") |