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
;
14 foreach my $i (@ARGV) {
15 if ($i eq '-verbose') {
17 } elsif ($i eq '-none') {
19 } elsif ($i eq '-delayed') {
21 } elsif ($i eq '-transport') {
22 # In this mode, the test is *expected* to fail. We only run it
23 # like this to verify that the test is a good test (i.e. it
24 # detects failures.) Same comment applies for SERVER and TARGET
27 } elsif ($i eq '-server') {
29 } elsif ($i eq '-target') {
34 my $backend = PerlACE
::TestTarget
::create_target
(1)
35 or die "Create target 1 failed\n";
36 my $middle = PerlACE
::TestTarget
::create_target
(2)
37 or die "Create target 2 failed\n";
38 my $client = PerlACE
::TestTarget
::create_target
(3)
39 or die "Create target 3 failed\n";
41 my $backend_ior = "backend.ior";
42 my $middle_ior = "middle.ior";
44 my $backend_iorfile = $backend->LocalFile ($backend_ior);
45 my $middle_in_iorfile = $middle->LocalFile ($backend_ior);
46 my $middle_out_iorfile = $middle->LocalFile ($middle_ior);
47 my $client_in_iorfile = $client->LocalFile ($middle_ior);
49 $backend->DeleteFile($backend_ior);
50 $middle->DeleteFile($backend_ior);
51 $middle->DeleteFile($middle_ior);
52 $client->DeleteFile($middle_ior);
55 $backend->CreateProcess ("backend_server",
56 " -o $backend_iorfile"
59 $middle->CreateProcess ("middle_server",
61 ." -o $middle_out_iorfile"
63 . " -k file://$middle_in_iorfile");
64 my $CL = $client->CreateProcess ("client",
65 " -k file://$client_in_iorfile"
68 my $be_status = $BE->Spawn ();
69 if ($be_status != 0) {
70 print STDERR
"ERROR: server returned $be_status\n";
74 if ($backend->WaitForFileTimed ($backend_ior,
75 $backend->ProcessStartWaitInterval()) == -1) {
76 print STDERR
"ERROR: cannot find file <$backend_iorfile>\n";
77 $BE->Kill (); $BE->TimedWait (1);
81 if ($backend->GetFile ($backend_ior) == -1) {
82 print STDERR
"ERROR: cannot retrieve file <$backend_iorfile>\n";
83 $BE->Kill (); $BE->TimedWait (1);
87 if ($middle->PutFile ($backend_ior) == -1) {
88 print STDERR
"ERROR: cannot set file <$middle_in_iorfile>\n";
89 $BE->Kill (); $BE->TimedWait (1);
93 my $md_status = $MD->Spawn ();
94 if ($md_status != 0) {
95 print STDERR
"ERROR: server returned $md_status\n";
96 $BE->Kill (); $BE->TimedWait (1);
100 if ($middle->WaitForFileTimed ($middle_ior,
101 $middle->ProcessStartWaitInterval()) == -1) {
102 print STDERR
"ERROR: cannot find file <$middle_in_iorfile>\n";
103 $MD->Kill (); $MD->TimedWait (1);
104 $BE->Kill (); $BE->TimedWait (1);
108 if ($middle->GetFile ($middle_ior) == -1) {
109 print STDERR
"ERROR: cannot retrieve file <$middle_out_iorfile>\n";
110 $MD->Kill (); $MD->TimedWait (1);
111 $BE->Kill (); $BE->TimedWait (1);
115 if ($client->PutFile ($middle_ior) == -1) {
116 print STDERR
"ERROR: cannot set file <$client_in_iorfile>\n";
117 $MD->Kill (); $MD->TimedWait (1);
118 $BE->Kill (); $BE->TimedWait (1);
124 $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
125 if ($client_status != 0) {
126 print STDERR
"ERROR: client returned $client_status\n";
130 $md_status = $MD->WaitKill ($middle->ProcessStopWaitInterval());
131 if ($md_status != 0) {
132 print STDERR
"ERROR: middle returned $md_status\n";
136 $be_status = $BE->WaitKill ($backend->ProcessStopWaitInterval());
137 if ($be_status != 0) {
138 print STDERR
"ERROR: backend returned $be_status\n";
142 $backend->DeleteFile($backend_ior);
143 $middle->DeleteFile($backend_ior);
144 $middle->DeleteFile($middle_ior);
145 $client->DeleteFile($middle_ior);