@@ -173,7 +173,9 @@ locktestthread(void *junk, unsigned long num)
173
173
174
174
for (i = 0 ; i < NLOCKLOOPS ; i ++ ) {
175
175
kprintf_t ("." );
176
+ KASSERT (!(lock_do_i_hold (testlock )));
176
177
lock_acquire (testlock );
178
+ KASSERT (lock_do_i_hold (testlock ));
177
179
random_yielder (4 );
178
180
179
181
testval1 = num ;
@@ -184,38 +186,46 @@ locktestthread(void *junk, unsigned long num)
184
186
goto fail ;
185
187
}
186
188
random_yielder (4 );
189
+ KASSERT (lock_do_i_hold (testlock ));
187
190
188
191
if (testval2 %3 != (testval3 * testval3 )%3 ) {
189
192
goto fail ;
190
193
}
191
194
random_yielder (4 );
195
+ KASSERT (lock_do_i_hold (testlock ));
192
196
193
197
if (testval3 != testval1 %3 ) {
194
198
goto fail ;
195
199
}
196
200
random_yielder (4 );
201
+ KASSERT (lock_do_i_hold (testlock ));
197
202
198
203
if (testval1 != num ) {
199
204
goto fail ;
200
205
}
201
206
random_yielder (4 );
207
+ KASSERT (lock_do_i_hold (testlock ));
202
208
203
209
if (testval2 != num * num ) {
204
210
goto fail ;
205
211
}
206
212
random_yielder (4 );
213
+ KASSERT (lock_do_i_hold (testlock ));
207
214
208
215
if (testval3 != num %3 ) {
209
216
goto fail ;
210
217
}
211
218
random_yielder (4 );
219
+ KASSERT (lock_do_i_hold (testlock ));
212
220
213
221
if (!(lock_do_i_hold (testlock ))) {
214
222
goto fail ;
215
223
}
216
224
random_yielder (4 );
225
+ KASSERT (lock_do_i_hold (testlock ));
217
226
218
227
lock_release (testlock );
228
+ KASSERT (!(lock_do_i_hold (testlock )));
219
229
}
220
230
221
231
/* Check for solutions that don't track ownership properly */
@@ -437,7 +447,7 @@ locktest5(int nargs, char **args) {
437
447
438
448
P (donesem );
439
449
secprintf (SECRET , "Should panic..." , "lt5" );
440
- KASSERT (!( lock_do_i_hold (testlock ) ));
450
+ KASSERT (lock_do_i_hold (testlock ));
441
451
442
452
/* Should not get here on success. */
443
453
0 commit comments