1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/ipdl/test/cxx/PTestInterruptRaces.ipdl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,82 @@ 1.4 +namespace mozilla { 1.5 +namespace _ipdltest { 1.6 + 1.7 +intr protocol PTestInterruptRaces { 1.8 +both: 1.9 + intr Race() returns (bool hasReply); 1.10 + intr StackFrame() returns (); 1.11 + intr StackFrame3() returns (); 1.12 + 1.13 +parent: 1.14 + sync StartRace(); 1.15 + intr Parent(); 1.16 + sync GetAnsweredParent() returns (bool answeredParent); 1.17 + 1.18 +child: 1.19 + Start(); 1.20 + Wakeup(); 1.21 + Wakeup3(); 1.22 + intr Child(); 1.23 + __delete__(); 1.24 + 1.25 +state START: 1.26 + send Start goto TEST1; 1.27 + 1.28 +// First test: race while no other messages are on the Interrupt stack 1.29 +state TEST1: 1.30 + recv StartRace goto RACE1; 1.31 +state RACE1: 1.32 + call Race goto DUMMY1_1; 1.33 + answer Race goto DUMMY1_2; 1.34 +state DUMMY1_1: 1.35 + answer Race goto TEST2; 1.36 +state DUMMY1_2: 1.37 + call Race goto TEST2; 1.38 + 1.39 +// Second test: race while other messages are on the Interrupt stack 1.40 +state TEST2: 1.41 + call StackFrame goto MORESTACK; 1.42 +state MORESTACK: 1.43 + answer StackFrame goto STARTRACE; 1.44 +state STARTRACE: 1.45 + send Wakeup goto RACE2; 1.46 +state RACE2: 1.47 + call Race goto DUMMY2_1; 1.48 + answer Race goto DUMMY2_2; 1.49 +state DUMMY2_1: 1.50 + answer Race goto TEST3; 1.51 +state DUMMY2_2: 1.52 + call Race goto TEST3; 1.53 + 1.54 +// Third test: resolve race using custom policy 1.55 +state TEST3: 1.56 + call StackFrame3 goto MORESTACK3; 1.57 +state MORESTACK3: 1.58 + answer StackFrame3 goto STARTRACE3; 1.59 +state STARTRACE3: 1.60 + send Wakeup3 goto RACE3; 1.61 +state RACE3: 1.62 + call Child goto DUMMY3_1; 1.63 + answer Parent goto DUMMY3_2; 1.64 +state DUMMY3_1: 1.65 + // the parent receives this from the child in this state 1.66 + recv GetAnsweredParent goto CHECK; 1.67 + // this transition is never taken (if the custom race resolution 1.68 + // works correctly) 1.69 + answer Parent goto CHECK; 1.70 +state DUMMY3_2: 1.71 + call Child goto CHECK; 1.72 +state CHECK: 1.73 + // the child sends this from this state 1.74 + recv GetAnsweredParent goto DYING; 1.75 + // because of deferred processing, the parent receives the child's 1.76 + // message here 1.77 + answer Parent goto DYING; 1.78 + 1.79 + 1.80 +state DYING: 1.81 + send __delete__; 1.82 +}; 1.83 + 1.84 +} // namespace _ipdltest 1.85 +} // namespace mozilla