@ -10,33 +10,23 @@ open OUnit2
let a_pname = Procname . from_string_c_fun " a_c_fun_name "
let a_pname = Procname . from_string_c_fun " a_c_fun_name "
let test _try_lock_already_locked _ test_ctxt =
let test s_wrapper _ test_ctxt =
ProcLocker . (
ProcLocker . (
setup () ;
setup () ;
(* When tries to lock a Procname that was already locked it fails *)
try_lock a_pname | > ignore ;
try_lock a_pname | > ignore ;
assert_bool " Should not be able to lock a Procname that's already locked. "
assert_bool " Should not be able to lock a Procname that's already locked. "
( not ( try_lock a_pname ) ) )
( not ( try_lock a_pname ) ) ;
unlock a_pname ;
(* When successives locks/unlocks are performed in the right order they succeed *)
let test_lock_after_unlock _ test_ctxt =
ProcLocker . (
setup () ;
try_lock a_pname | > ignore ;
try_lock a_pname | > ignore ;
unlock a_pname ;
unlock a_pname ;
try_lock a_pname | > ignore ;
try_lock a_pname | > ignore ;
unlock a_pname )
unlock a_pname ;
(* When an unlock is performed over a non-locked Procname it fails *)
let test_unlocking_unlocked_fails _ text_ctxt =
ProcLocker . (
setup () ;
try_lock a_pname | > ignore ;
try_lock a_pname | > ignore ;
unlock a_pname ;
unlock a_pname ;
assert_raises ( UnlockNotLocked a_pname ) ( fun () -> unlock a_pname ) )
assert_raises ( UnlockNotLocked a_pname ) ( fun () -> unlock a_pname ) )
let tests =
let tests = " restart_scheduler_suite " > :: tests_wrapper
" restart_scheduler_suite "
> :: : [ " test_try_lock_already_locked " > :: test_try_lock_already_locked
; " test_lock_after_unlock " > :: test_lock_after_unlock
; " test_unlocking_unlocked_fails " > :: test_unlocking_unlocked_fails ]