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
;
10 PerlACE
::check_privilege_group
();
15 $experiment_timeout = 50;
16 $startup_timeout = 45;
24 my $server1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
25 my $server2 = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
26 my $client1 = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
27 my $client2 = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
29 $client1->AddLibPath ("../lib");
30 $client2->AddLibPath ("../lib");
32 my $ior1file = "naming.ior";
33 my $ior2file = "notify.ior";
34 my $client_ior = "supplier.ior";
36 # Config files for targets
37 my $server2_conf = $server2->LocalFile ("notify.conf");
38 my $client1_conf = $client1->LocalFile ("supplier.conf");
39 my $client2_conf = $client2->LocalFile ("consumer.conf");
41 # Files which used by server1
42 my $server1_ior1file = $server1->LocalFile ($ior1file);
43 $server1->DeleteFile($ior1file);
45 # Files which used by server2
46 my $server2_ior2file = $server2->LocalFile ($ior2file);
47 $server2->DeleteFile($ior2file);
48 my $server2_ior1file = $server2->LocalFile ($ior1file);
49 $server2->DeleteFile($ior1file);
53 # Files which used by client1
54 my $client1_ior1file = $client1->LocalFile ($ior1file);
55 my $client1_client_ior = $client1->LocalFile ($client_ior);
56 $client1->DeleteFile($ior1file);
57 $client1->DeleteFile($client_ior);
59 # Files which used by client2
60 my $client2_ior1file = $client2->LocalFile ($ior1file);
61 my $client2_client_ior = $client2->LocalFile ($client_ior);
62 $client2->DeleteFile($ior1file);
63 $client2->DeleteFile($client_ior);
65 $SV1 = $server1->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
66 "-o $server1_ior1file");
68 $SV2 = $server2->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
69 "-ORBInitRef NameService=file://$server2_ior1file " .
70 "-IORoutput $server2_ior2file " .
71 "-ORBSvcConf $server2_conf");
73 $CL1 = $client1->CreateProcess ("../Driver/Notify_Tests_Driver",
74 "-ORBdebuglevel $debug_level " .
75 "-ORBInitRef NameService=file://$client1_ior1file " .
76 "-IORoutput $client1_client_ior " .
77 "-ORBSvcConf $client1_conf");
79 $CL2 = $client2->CreateProcess ("../Driver/Notify_Tests_Driver",
80 "-ORBdebuglevel $debug_level " .
81 "-ORBInitRef NameService=file://$client2_ior1file " .
82 "-IORinput $client2_client_ior " .
83 "-ORBSvcConf $client2_conf");
86 $server_status = $SV1->Spawn ();
88 if ($server_status != 0) {
89 print STDERR
"ERROR: server returned $server_status\n";
93 if ($server1->WaitForFileTimed ($ior1file,
94 $server1->ProcessStartWaitInterval() + $startup_timeout) == -1) {
95 print STDERR
"ERROR: cannot find file <$server1_ior1file>\n";
96 $SV1->Kill (); $SV1->TimedWait (1);
99 if ($server1->GetFile ($ior1file) == -1) {
100 print STDERR
"ERROR: cannot retrieve file <$server1_ior1file>\n";
101 $SV1->Kill (); $SV1->TimedWait (1);
104 if ($server2->PutFile ($ior1file) == -1) {
105 print STDERR
"ERROR: cannot set file <$server2_ior1file>\n";
106 $SV1->Kill (); $SV1->TimedWait (1);
109 if ($client1->PutFile ($ior1file) == -1) {
110 print STDERR
"ERROR: cannot set file <$client1_ior1file>\n";
111 $SV1->Kill (); $SV1->TimedWait (1);
114 if ($client2->PutFile ($ior1file) == -1) {
115 print STDERR
"ERROR: cannot set file <$client2_ior1file>\n";
116 $SV1->Kill (); $SV1->TimedWait (1);
120 $args = $SV2->Arguments ();
121 print STDERR
"Running Notification with arguments: $args\n";
124 $server_status = $SV2->Spawn ();
126 if ($server_status != 0) {
127 print STDERR
"ERROR: server returned $server_status\n";
128 $SV1->Kill (); $SV1->TimedWait (1);
132 if ($server2->WaitForFileTimed ($ior2file,
133 $server2->ProcessStartWaitInterval() + $startup_timeout) == -1) {
134 print STDERR
"ERROR: cannot find file <$server2_ior2file>\n";
135 $SV1->Kill (); $SV1->TimedWait (1);
136 $SV2->Kill (); $SV2->TimedWait (1);
140 $args = $SV2->Arguments ();
141 print STDERR
"Running Supplier with arguments: $args\n";
145 $client_status = $CL1->Spawn ();
147 if ($client_status != 0) {
148 print STDERR
"ERROR: client returned client_status\n";
149 $SV1->Kill (); $SV1->TimedWait (1);
150 $SV2->Kill (); $SV2->TimedWait (1);
154 if ($client1->WaitForFileTimed ($client_ior,
155 $client1->ProcessStartWaitInterval() + $startup_timeout) == -1) {
156 print STDERR
"ERROR: cannot find file <$client1_client_ior>\n";
157 $CL1->Kill (); $CL1->TimedWait (1);
158 $SV1->Kill (); $SV1->TimedWait (1);
159 $SV2->Kill (); $SV2->TimedWait (1);
162 if ($client1->GetFile ($client_ior) == -1) {
163 print STDERR
"ERROR: cannot retrieve file <$client1_client_ior>\n";
164 $CL1->Kill (); $CL1->TimedWait (1);
165 $SV1->Kill (); $SV1->TimedWait (1);
166 $SV2->Kill (); $SV2->TimedWait (1);
169 if ($client2->PutFile ($client_ior) == -1) {
170 print STDERR
"ERROR: cannot set file <$client2_client_ior>\n";
171 $CL1->Kill (); $CL1->TimedWait (1);
172 $SV1->Kill (); $SV1->TimedWait (1);
173 $SV2->Kill (); $SV2->TimedWait (1);
177 $args = $CL2->Arguments ();
178 print STDERR
"Running Consumer with arguments: $args\n";
181 $client_status = $CL2->SpawnWaitKill ($client2->ProcessStartWaitInterval() + $experiment_timeout);
183 if ($client_status != 0) {
184 print STDERR
"ERROR: client returned $client_status\n";
193 $client2->DeleteFile($ior1file);
194 $client2->DeleteFile($client_ior);
195 $server2->DeleteFile($ior2file);
196 $server2->DeleteFile($ior1file);
197 $client1->DeleteFile($ior1file);
198 $client1->DeleteFile($client_ior);