Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / EC_Custom_Marshal / run_test.pl
blob554e85b8f787f2971e3b2a4298a9458c0b80803b
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 $sleeptime = 8;
13 my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
14 my $server2 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
15 my $server3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
16 my $client = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
18 $port = $server1->RandomPort () + 10001; # This can't be 10000 on Chorus 4.0
20 $naming_ior = "NameService.ior";
22 $server1_naming_ior = $server1->LocalFile ($naming_ior);
23 $server2_naming_ior = $server2->LocalFile ($naming_ior);
24 $server3_naming_ior = $server3->LocalFile ($naming_ior);
25 $client_naming_ior = $client->LocalFile ($naming_ior);
27 $server1->DeleteFile ($naming_ior);
28 $server2->DeleteFile ($naming_ior);
29 $server3->DeleteFile ($naming_ior);
30 $client->DeleteFile ($naming_ior);
33 $SV1 = $server1->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
34 "-ORBNameServicePort $port " .
35 "-o $server1_naming_ior");
37 $SV2 = $server2->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Event_Service/tao_rtevent",
38 "-ORBInitRef NameService=file://$server2_naming_ior");
40 $SV3 = $server3->CreateProcess ("ECM_Supplier",
41 "-ORBInitRef NameService=file://$server3_naming_ior");
43 $CL = $client->CreateProcess ("ECM_Consumer",
44 "-ORBInitRef NameService=file://$client_naming_ior");
46 $server_status = $SV1->Spawn ();
48 if ($server_status != 0) {
49 print STDERR "ERROR: server returned $server_status\n";
50 $SV1->Kill (); $SV1->TimedWait (1);
51 exit 1;
53 if ($server1->WaitForFileTimed ($naming_ior,
54 $server1->ProcessStartWaitInterval()) == -1) {
55 print STDERR "ERROR: cannot find file <$server1_naming_ior>\n";
56 $SV1->Kill (); $SV1->TimedWait (1);
57 exit 1;
60 if ($server1->GetFile ($naming_ior) == -1) {
61 print STDERR "ERROR: cannot retrieve file <$server1_naming_ior>\n";
62 $SV1->Kill (); $SV1->TimedWait (1);
63 exit 1;
66 if ($server2->PutFile ($naming_ior) == -1) {
67 print STDERR "ERROR: cannot set file <$server2_naming_ior>\n";
68 $SV1->Kill (); $SV1->TimedWait (1);
69 exit 1;
71 if ($server3->PutFile ($naming_ior) == -1) {
72 print STDERR "ERROR: cannot set file <$server3_naming_ior>\n";
73 $SV1->Kill (); $SV1->TimedWait (1);
74 exit 1;
77 if ($client->PutFile ($naming_ior) == -1) {
78 print STDERR "ERROR: cannot set file <$client_naming_ior>\n";
79 $SV1->Kill (); $SV1->TimedWait (1);
80 exit 1;
83 $server_status = $SV2->Spawn ();
85 if ($server_status != 0) {
86 print STDERR "ERROR: server returned $server_status\n";
87 $SV1->Kill (); $SV1->TimedWait (1);
88 $SV2->Kill (); $SV2->TimedWait (1);
89 exit 1;
92 sleep $sleeptime;
94 $client_status = $CL->Spawn ();
96 if ($client_status != 0) {
97 print STDERR "ERROR: client returned $client_status\n";
98 $SV1->Kill (); $SV1->TimedWait (1);
99 $SV2->Kill (); $SV2->TimedWait (1);
100 $CL->Kill (); $CL->TimedWait (1);
101 exit 1;
104 sleep $sleeptime;
106 $server_status = $SV3->Spawn ();
108 if ($server_status != 0) {
109 print STDERR "ERROR: server returned $server_status\n";
110 $SV1->Kill (); $SV1->TimedWait (1);
111 $SV2->Kill (); $SV2->TimedWait (1);
112 $SV3->Kill (); $SV3->TimedWait (1);
113 $CL->Kill (); $CL->TimedWait (1);
114 exit 1;
117 $client_status = $CL->WaitKill ($client->ProcessStopWaitInterval() + 45);
118 if ($client_status != 0) {
119 print STDERR "ERROR: client returned $client_status\n";
120 $status = 1;
123 $server_status = $SV3->WaitKill ($server3->ProcessStopWaitInterval() + 45);
124 if ($server_status != 0) {
125 print STDERR "ERROR: server returned $server_status\n";
126 $status = 1;
129 $server_status = $SV2->TerminateWaitKill ($server2->ProcessStopWaitInterval());
131 if ($server_status != 0) {
132 print STDERR "ERROR: server returned $server_status\n";
133 $status = 1;
137 $server_status = $SV1->TerminateWaitKill ($server1->ProcessStopWaitInterval());
139 if ($server_status != 0) {
140 print STDERR "ERROR: server returned $server_status\n";
141 $status = 1;
144 $server1->DeleteFile ($naming_ior);
145 $server2->DeleteFile ($naming_ior);
146 $server3->DeleteFile ($naming_ior);
147 $client->DeleteFile ($naming_ior);
149 exit $status;