Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / DevGuideExamples / AMH_AMI / run_test.pl
blobacd3f2621343524a2f22ac61928dcc4554985056
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
10 $status = 0;
11 $debug_level = '0';
13 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $in_server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $md_server = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $inner_ior = "inner.ior";
24 my $middle_ior = "middle.ior";
26 # Files which used by inner_server
27 my $in_server_inner_ior = $in_server->LocalFile ($inner_ior);
28 $in_server->DeleteFile($inner_ior);
30 # Files which used by middle server
31 my $md_server_inner_ior = $md_server->LocalFile ($inner_ior);
32 my $md_server_middle_ior = $md_server->LocalFile ($middle_ior);
33 $md_server->DeleteFile($inner_ior);
34 $md_server->DeleteFile($middle_ior);
36 # Files which used by inner_server
37 my $client_iorfile = $client->LocalFile ($middle_ior);
38 $client->DeleteFile($middle_ior);
40 $IS = $in_server->CreateProcess ("inner_server",
41 "-ORBdebuglevel $debug_level " .
42 "-o $in_server_inner_ior");
44 $MD = $md_server->CreateProcess ("middle_server",
45 "-ORBdebuglevel $debug_level " .
46 "-o $md_server_middle_ior " .
47 "-i file://$md_server_inner_ior");
49 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile");
51 $server_status = $IS->Spawn ();
53 if ($server_status != 0) {
54 print STDERR "ERROR: server returned $server_status\n";
55 exit 1;
58 if ($in_server->WaitForFileTimed ($inner_ior,
59 $in_server->ProcessStartWaitInterval()) == -1) {
60 print STDERR "ERROR: cannot find file <$in_server_inner_ior>\n";
61 $IS->Kill (); $IS->TimedWait (1);
62 exit 1;
65 if ($in_server->GetFile ($inner_ior) == -1) {
66 print STDERR "ERROR: cannot retrieve file <$in_server_inner_ior>\n";
67 $IS->Kill (); $IS->TimedWait (1);
68 exit 1;
70 if ($md_server->PutFile ($inner_ior) == -1) {
71 print STDERR "ERROR: cannot set file <$md_server_inner_ior>\n";
72 $IS->Kill (); $IS->TimedWait (1);
73 exit 1;
76 $server_status = $MD->Spawn ();
78 if ($server_status != 0) {
79 print STDERR "ERROR: server returned $server_status\n";
80 exit 1;
83 if ($md_server->WaitForFileTimed ($middle_ior,
84 $md_server->ProcessStartWaitInterval()) == -1) {
85 print STDERR "ERROR: cannot find file <$md_server_middle_ior>\n";
86 $MD->Kill (); $MD->TimedWait (1);
87 $IS->Kill (); $IS->TimedWait (1);
88 exit 1;
91 if ($md_server->GetFile ($middle_ior) == -1) {
92 print STDERR "ERROR: cannot retrieve file <$md_server_middle_ior>\n";
93 $MD->Kill (); $MD->TimedWait (1);
94 $IS->Kill (); $IS->TimedWait (1);
95 exit 1;
97 if ($client->PutFile ($middle_ior) == -1) {
98 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
99 $MD->Kill (); $MD->TimedWait (1);
100 $IS->Kill (); $IS->TimedWait (1);
101 exit 1;
104 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 30);
106 if ($client_status != 0) {
107 print STDERR "ERROR: client returned $client_status\n";
108 $status = 1;
111 $IS->Kill ();
112 $MD->Kill ();
114 $in_server->DeleteFile($inner_ior);
115 $md_server->DeleteFile($inner_ior);
116 $md_server->DeleteFile($middle_ior);
117 $client->DeleteFile($middle_ior);
119 exit $status;