1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
20 my $ping = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
21 my $pong = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
22 my $ctrl = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
24 $pingiorfile = "ping.ior";
25 $pongiorfile = "pong.ior";
27 my $ping_pingiorfile = $ping->LocalFile ($pingiorfile);
28 my $pong_pongiorfile = $pong->LocalFile ($pongiorfile);
29 my $ctrl_pingiorfile = $ctrl->LocalFile ($pingiorfile);
30 my $ctrl_pongiorfile = $ctrl->LocalFile ($pongiorfile);
31 $ping->DeleteFile ($pingiorfile);
32 $pong->DeleteFile ($pongiorfile);
33 $ctrl->DeleteFile ($pingiorfile);
34 $ctrl->DeleteFile ($pongiorfile);
36 $PING = $ping->CreateProcess ("ping",
37 " -o $ping_pingiorfile");
38 $PONG = $pong->CreateProcess ("pong",
39 " -o $pong_pongiorfile");
40 $CTRL = $ctrl->CreateProcess ("control",
41 " -ORBDebugLevel $debug_level ".
42 " -f file://$ctrl_pingiorfile ".
43 " -g file://$ctrl_pongiorfile");
45 print STDERR
"Starting Ping\n";
47 $PING_status = $PING->Spawn ();
49 if ($PING_status != 0) {
50 print STDERR
"ERROR: Ping returned $PING_status\n";
54 if ($ping->WaitForFileTimed ($pingiorfile,$ping->ProcessStartWaitInterval()) == -1) {
55 print STDERR
"ERROR: cannot find file <$ping_pingiorfile>\n";
56 $PING->Kill (); $PING->TimedWait (1);
60 if ($ping->GetFile ($pingiorfile) == -1) {
61 print STDERR
"ERROR: cannot retrieve file <$ping_pingiorfile>\n";
62 $PING->Kill (); $PING->TimedWait (1);
65 if ($ctrl->PutFile ($pingiorfile) == -1) {
66 print STDERR
"ERROR: cannot set file <$ctrl_pingiorfile>\n";
67 $PING->Kill (); $PING->TimedWait (1);
71 print STDERR
"Starting Pong\n";
73 $PONG_status = $PONG->Spawn ();
75 if ($PONG_status != 0) {
76 print STDERR
"ERROR: Pong returned $PONG_status\n";
80 if ($pong->WaitForFileTimed ($pongiorfile,$pong->ProcessStartWaitInterval()) == -1) {
81 print STDERR
"ERROR: cannot find file <$pong_pongiorfile>\n";
82 $PONG->Kill (); $PONG->TimedWait (1);
86 if ($pong->GetFile ($pongiorfile) == -1) {
87 print STDERR
"ERROR: cannot retrieve file <$pong_pongiorfile>\n";
88 $PONG->Kill (); $PONG->TimedWait (1);
91 if ($ctrl->PutFile ($pongiorfile) == -1) {
92 print STDERR
"ERROR: cannot set file <$ctrl_pongiorfile>\n";
93 $PONG->Kill (); $PONG->TimedWait (1);
97 print STDERR
"Starting Control\n";
99 $CTRL_status = $CTRL->Spawn ();
101 if ($CTRL_status != 0) {
102 print STDERR
"ERROR: Control returned $CTRL_status\n";
106 $PING_status = $PING->WaitKill ($ping->ProcessStartWaitInterval()+85);
107 if ($PING_status != 0) {
108 print STDERR
"ERROR: Ping returned $PING_status\n";
112 $PONG_status = $PONG->WaitKill ($pong->ProcessStartWaitInterval()+85);
113 if ($PONG_status != 0) {
114 print STDERR
"ERROR: Pong returned $PONG_status\n";
118 $CTRL_status = $CTRL->TerminateWaitKill ($ctrl->ProcessStopWaitInterval());
119 if ($CTRL_status != 0) {
120 print STDERR
"ERROR: Control returned $CTRL_status\n";
124 $ping->DeleteFile ($pingiorfile);
125 $pong->DeleteFile ($pongiorfile);
126 $ctrl->DeleteFile ($pingiorfile);
127 $ctrl->DeleteFile ($pongiorfile);