| 1 | # vim: ts=2 sw=2 expandtab |
| 2 | |
| 3 | # Tests propagation of signals through the session ancestry |
| 4 | |
| 5 | use warningsscip-perl cpan POE-Test-Loops 1.360 warnings/; |
| 6 | use strictscip-perl cpan POE-Test-Loops 1.360 strict/; |
| 7 | |
| 8 | use Test::Morescip-perl cpan POE-Test-Loops 1.360 Test/More/ tests => 7; |
| 9 | |
| 10 | sub POE::Kernel::ASSERT_DEFAULTscip-perl cpan POE-Test-Loops 1.360 main/`POE::Kernel::ASSERT_DEFAULT`(). () { 1 } |
| 11 | |
| 12 | BEGIN { |
| 13 | package |
| 14 | POE::Kernelscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/; |
| 15 | use constantscip-perl cpan POE-Test-Loops 1.360 constant/ TRACE_DEFAULTscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/TRACE_DEFAULT(). => exists($INC{'Devel/Cover.pm'}); |
| 16 | } |
| 17 | |
| 18 | use POEscip-perl cpan POE-Test-Loops 1.360 POE/; |
| 19 | |
| 20 | { |
| 21 | my @log; |
| 22 | |
| 23 | my $session = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 24 | inline_states => { |
| 25 | _start => sub { |
| 26 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 27 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->sigscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/sig().("foo" => "foo"); |
| 28 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->signalscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/signal().( $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION], "foo" ); |
| 29 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 30 | }, |
| 31 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 32 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 33 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[STATE, SESSION] ] }, |
| 34 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 35 | }, |
| 36 | ); |
| 37 | |
| 38 | POE::Kernel->runscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/run().; |
| 39 | |
| 40 | is_deeplyscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/is_deeply().( |
| 41 | \@log, |
| 42 | [ |
| 43 | [ enter_start => $session ], |
| 44 | [ leave_start => $session ], |
| 45 | [ foo => $session ], |
| 46 | [ stop => $session ], |
| 47 | ], |
| 48 | "simple signal on one session", |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | { |
| 53 | my @log; |
| 54 | |
| 55 | my $child; |
| 56 | my $session = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 57 | inline_states => { |
| 58 | _start => sub { |
| 59 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 60 | $child = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 61 | inline_states => { |
| 62 | _start => sub { |
| 63 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 64 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 0.1); |
| 65 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 66 | }, |
| 67 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 68 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 69 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 70 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 71 | }, |
| 72 | ); |
| 73 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->sigscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/sig().("foo" => "foo"); |
| 74 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->signalscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/signal().( $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION], "foo" ); |
| 75 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 76 | }, |
| 77 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 78 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 79 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 80 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 81 | }, |
| 82 | ); |
| 83 | |
| 84 | POE::Kernel->runscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/run().; |
| 85 | |
| 86 | is_deeplyscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/is_deeply().( |
| 87 | \@log, |
| 88 | [ |
| 89 | [ enter_start => $session ], |
| 90 | [ enter_start => $child ], |
| 91 | [ leave_start => $child ], |
| 92 | [ child => $session ], |
| 93 | [ leave_start => $session ], |
| 94 | [ foo => $session ], |
| 95 | [ default => bar => $child ], |
| 96 | [ stop => $child ], |
| 97 | [ child => $session ], |
| 98 | [ stop => $session ], |
| 99 | ], |
| 100 | "signal on parent, oblivious child", |
| 101 | ); |
| 102 | } |
| 103 | |
| 104 | { |
| 105 | my @log; |
| 106 | |
| 107 | my $child; |
| 108 | my $session = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 109 | inline_states => { |
| 110 | _start => sub { |
| 111 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 112 | $child = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 113 | inline_states => { |
| 114 | _start => sub { |
| 115 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 116 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 0.1); |
| 117 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->sigscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/sig().("foo" => "foo"); |
| 118 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 119 | }, |
| 120 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 121 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 122 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 123 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 124 | }, |
| 125 | ); |
| 126 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->sigscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/sig().("foo" => "foo"); |
| 127 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->signalscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/signal().( $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION], "foo" ); |
| 128 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 129 | }, |
| 130 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 131 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 132 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 133 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 134 | }, |
| 135 | ); |
| 136 | |
| 137 | POE::Kernel->runscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/run().; |
| 138 | |
| 139 | is_deeplyscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/is_deeply().( |
| 140 | \@log, |
| 141 | [ |
| 142 | [ enter_start => $session ], |
| 143 | [ enter_start => $child ], |
| 144 | [ leave_start => $child ], |
| 145 | [ child => $session ], |
| 146 | [ leave_start => $session ], |
| 147 | [ foo => $child ], |
| 148 | [ foo => $session ], |
| 149 | [ default => bar => $child ], |
| 150 | [ stop => $child ], |
| 151 | [ child => $session ], |
| 152 | [ stop => $session ], |
| 153 | ], |
| 154 | "signal on child, then parent", |
| 155 | ); |
| 156 | } |
| 157 | |
| 158 | { |
| 159 | my @log; |
| 160 | |
| 161 | my $child; |
| 162 | my $session = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 163 | inline_states => { |
| 164 | _start => sub { |
| 165 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 166 | $child = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 167 | inline_states => { |
| 168 | _start => sub { |
| 169 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 170 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 1); |
| 171 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->sigscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/sig().("TERM" => "TERM"); |
| 172 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 173 | }, |
| 174 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 175 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 176 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 177 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 178 | }, |
| 179 | ); |
| 180 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->sigscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/sig().("TERM" => "TERM"); |
| 181 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->signalscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/signal().( $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION], "TERM" ); |
| 182 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 183 | }, |
| 184 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 185 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 186 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 187 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 188 | }, |
| 189 | ); |
| 190 | |
| 191 | POE::Kernel->runscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/run().; |
| 192 | |
| 193 | is_deeplyscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/is_deeply().( |
| 194 | \@log, |
| 195 | [ |
| 196 | [ enter_start => $session ], |
| 197 | [ enter_start => $child ], |
| 198 | [ leave_start => $child ], |
| 199 | [ child => $session ], |
| 200 | [ leave_start => $session ], |
| 201 | [ default => TERM => $child ], |
| 202 | [ default => TERM => $session ], |
| 203 | [ stop => $child ], |
| 204 | [ child => $session ], |
| 205 | [ stop => $session ], |
| 206 | ], |
| 207 | "TERM signal on child, then parent", |
| 208 | ); |
| 209 | } |
| 210 | |
| 211 | { |
| 212 | my @log; |
| 213 | |
| 214 | my $child; |
| 215 | my $session = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 216 | inline_states => { |
| 217 | _start => sub { |
| 218 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 219 | $child = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 220 | inline_states => { |
| 221 | _start => sub { |
| 222 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 223 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 1); |
| 224 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 225 | }, |
| 226 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 227 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 228 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 229 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 230 | }, |
| 231 | ); |
| 232 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->signalscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/signal().( $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION], "TERM" ); |
| 233 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 234 | }, |
| 235 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 236 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 237 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 238 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 239 | }, |
| 240 | ); |
| 241 | |
| 242 | POE::Kernel->runscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/run().; |
| 243 | |
| 244 | is_deeplyscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/is_deeply().( |
| 245 | \@log, |
| 246 | [ |
| 247 | [ enter_start => $session ], |
| 248 | [ enter_start => $child ], |
| 249 | [ leave_start => $child ], |
| 250 | [ child => $session ], |
| 251 | [ leave_start => $session ], |
| 252 | [ stop => $child ], |
| 253 | [ child => $session ], |
| 254 | [ stop => $session ], |
| 255 | ], |
| 256 | "TERM signal with no handlers on child, then parent", |
| 257 | ); |
| 258 | } |
| 259 | |
| 260 | { |
| 261 | my @log; |
| 262 | |
| 263 | my ( $child, $grandchild ); |
| 264 | my $session = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 265 | inline_states => { |
| 266 | _start => sub { |
| 267 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 268 | $child = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 269 | inline_states => { |
| 270 | _start => sub { |
| 271 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 272 | $grandchild = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 273 | inline_states => { |
| 274 | _start => sub { |
| 275 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 276 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 1); |
| 277 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 278 | }, |
| 279 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 280 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 281 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 282 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 283 | }, |
| 284 | ); |
| 285 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->sigscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/sig().( TERM => "TERM" ); |
| 286 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 1); |
| 287 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 288 | }, |
| 289 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 290 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 291 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 292 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 293 | }, |
| 294 | ); |
| 295 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->signalscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/signal().( $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION], "TERM" ); |
| 296 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 297 | }, |
| 298 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 299 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 300 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 301 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 302 | }, |
| 303 | ); |
| 304 | |
| 305 | POE::Kernel->runscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/run().; |
| 306 | |
| 307 | is_deeplyscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/is_deeply().( |
| 308 | \@log, |
| 309 | [ |
| 310 | [ enter_start => $session ], |
| 311 | [ enter_start => $child ], |
| 312 | [ enter_start => $grandchild ], |
| 313 | [ leave_start => $grandchild ], |
| 314 | [ child => $child ], |
| 315 | [ leave_start => $child ], |
| 316 | [ child => $session ], |
| 317 | [ leave_start => $session ], |
| 318 | [ default => TERM => $child ], |
| 319 | [ stop => $grandchild ], |
| 320 | [ child => $child ], |
| 321 | [ stop => $child ], |
| 322 | [ child => $session ], |
| 323 | [ stop => $session ], |
| 324 | ], |
| 325 | "TERM signal on granchild, then child (with handler), then parent", |
| 326 | ); |
| 327 | } |
| 328 | |
| 329 | { |
| 330 | my @log; |
| 331 | |
| 332 | my ( $child, $grandchild ); |
| 333 | my $session = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 334 | inline_states => { |
| 335 | _start => sub { |
| 336 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 337 | $child = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 338 | inline_states => { |
| 339 | _start => sub { |
| 340 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 341 | $grandchild = POE::Session->createscip-perl cpan POE-Test-Loops 1.360 POE/Session/create().( |
| 342 | inline_states => { |
| 343 | _start => sub { |
| 344 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ enter_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 345 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 1); |
| 346 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 347 | }, |
| 348 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 349 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 350 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 351 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 352 | }, |
| 353 | ); |
| 354 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->delayscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/delay().("bar" => 1); |
| 355 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 356 | }, |
| 357 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 358 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 359 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 360 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 361 | }, |
| 362 | ); |
| 363 | $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[KERNEL]->signalscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/signal().( $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION], "TERM" ); |
| 364 | pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ leave_start => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ]; |
| 365 | }, |
| 366 | _child => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ child => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 367 | _stop => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ stop => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 368 | _default => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ default => @_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[ARG0, SESSION] ] }, |
| 369 | foo => sub { pushscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/push(). @log, [ foo => $_scip-perl cpan POE-Test-Loops 1.360 POE/Kernel/`@_`.[SESSION] ] }, |
| 370 | }, |
| 371 | ); |
| 372 | |
| 373 | POE::Kernel->runscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/run().; |
| 374 | |
| 375 | is_deeplyscip-perl cpan POE-Test-Loops 1.360 POE/Kernel/is_deeply().( |
| 376 | \@log, |
| 377 | [ |
| 378 | [ enter_start => $session ], |
| 379 | [ enter_start => $child ], |
| 380 | [ enter_start => $grandchild ], |
| 381 | [ leave_start => $grandchild ], |
| 382 | [ child => $child ], |
| 383 | [ leave_start => $child ], |
| 384 | [ child => $session ], |
| 385 | [ leave_start => $session ], |
| 386 | [ stop => $grandchild ], |
| 387 | [ child => $child ], |
| 388 | [ stop => $child ], |
| 389 | [ child => $session ], |
| 390 | [ stop => $session ], |
| 391 | ], |
| 392 | "TERM signal with no handlers on granchild, then child, then parent", |
| 393 | ); |
| 394 | } |
| 395 | |
| 396 | 1; |