1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
5 use lib
"$ENV{ACE_ROOT}/bin";
6 use PerlACE
::TestTarget
;
20 $imr_debug = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile imr.log -d 5 ";
21 $act_debug = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile act.log -d 5 ";
22 $svr_debug = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile svr.log ";
23 $clt_debug = "-ORBDebugLevel 10 -ORBVerboseLogging 1 -ORBLogFile clt.log ";
27 my $extra_timeout = 345;
29 my $seconds_between_requests = 4;
31 # Valgrind may slow down processes enough that an extra delay
32 # is needed between client requests.
33 if (exists $ENV{'ACE_RUN_VALGRIND_CMD'}) {
34 $seconds_between_requests = 10;
37 my $c1 = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
38 my $imr = PerlACE
::TestTarget
::create_target
(2) || die "Create target 3 failed\n";
39 my $act = PerlACE
::TestTarget
::create_target
(3) || die "Create target 4 failed\n";
40 my $ti = PerlACE
::TestTarget
::create_target
(4) || die "Create target 5 failed\n";
42 my $implrepo_server = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_locator";
43 my $imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_activator";
44 my $tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr";
46 my $implrepo_ior = "implrepo.ior";
47 my $activator_ior = "activator.ior";
48 my $test_ior = "test.ior";
49 my $imrlogfile = "imr.log";
50 my $actlogfile = "act.log";
52 # Use client strategy factory for one of retry parameters.
53 $c1_conf = "client.conf";
55 my $imr_imriorfile = $imr->LocalFile ($implrepo_ior);
56 my $act_imriorfile = $act->LocalFile ($implrepo_ior);
57 my $ti_imriorfile = $ti->LocalFile ($implrepo_ior);
58 my $act_actiorfile = $act->LocalFile ($activator_ior);
59 my $c1_srviorfile = $c1->LocalFile ($test_ior);
60 my $c1_conffile = $c1->LocalFile ($c1_conf);
61 my $act_srviorfile = $ti->LocalFile ($test_ior);
63 # Make sure the files are gone, so we can wait on them.
68 $imr->DeleteFile ($imrlogfile);
69 $act->DeleteFile ($actlogfile);
71 $imr->DeleteFile ($implrepo_ior);
72 $act->DeleteFile ($implrepo_ior);
73 $ti->DeleteFile ($implrepo_ior);
74 $act->DeleteFile ($activator_ior);
75 $act->DeleteFile ($test_ior);
76 $c1->DeleteFile ($test_ior);
79 # Clean up after exit call
87 # Note : We don't actually use SVR, but we need a way to get the
88 # path to the -ExeSubDir
89 $SVR = $imr->CreateProcess ("server", "");
90 my $server = $SVR->Executable ();
91 my $srv_server = $imr->LocalFile ($server);
93 $IR = $imr->CreateProcess ($implrepo_server, $imr_debug .
94 "-orbobjrefstyle url ".
96 "-o $imr_imriorfile ");
97 print ">>> " . $IR->CommandLine() . "\n";
99 my $initrefbase = "-ORBInitRef ImplRepoService=file://";
100 my $actinitref = $initrefbase . $act_imriorfile;
101 my $tiinitref = $initrefbase . $ti_imriorfile;
102 $ACT = $act->CreateProcess ($imr_activator, " " .
104 "-orbobjrefstyle url " .
105 "-o $act_actiorfile " .
108 my $client_cmdline = "-k file://$c1_srviorfile ".
109 "-ORBSvcConf $c1_conffile ".
112 $C1 = $c1->CreateProcess ("client", $client_cmdline);
114 $TI = $ti->CreateProcess ($tao_imr);
115 $TI->IgnoreExeSubDir (1);
120 print STDERR
"ERROR: $msg\n" if (length ($msg) > 0);
121 $ACT->Kill (); $ACT->TimedWait (1);
122 $IR->Kill (); $IR->TimedWait (1);
131 my $obj_name = "TestService";
132 print "invoking ti cmd $cmd $obj_name $cmdargs\n";# if ($debugging);
133 $TI->Arguments ("$tiinitref $cmd $obj_name $cmdargs");
134 $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval() + $extra_timeout);
135 if ($TI_status != 0 && $TI_status != 4) {
136 return kill_imr
("tao_imr $cmd $obj_name returned $TI_status");
141 $IR_status = $IR->Spawn ();
143 if ($IR_status != 0) {
144 print STDERR
"ERROR: ImplRepo Service returned $IR_status\n";
148 if ($imr->WaitForFileTimed ($implrepo_ior,$imr->ProcessStartWaitInterval() + $extra_timeout) == -1) {
149 print STDERR
"ERROR: cannot find file <$imr_imriorfile>\n";
150 $IR->Kill (); $IR->TimedWait (1);
154 if ($imr->GetFile ($implrepo_ior) == -1) {
155 print STDERR
"ERROR: cannot retrieve file <$imr_imriorfile>\n";
156 $IR->Kill (); $IR->TimedWait (1);
159 if ($act->PutFile ($implrepo_ior) == -1) {
160 print STDERR
"ERROR: cannot set file <$act_imriorfile>\n";
161 $IR->Kill (); $IR->TimedWait (1);
164 if ($ti->PutFile ($implrepo_ior) == -1) {
165 print STDERR
"ERROR: cannot set file <$ti_imriorfile>\n";
166 $IR->Kill (); $IR->TimedWait (1);
170 print ">>> " . $ACT->CommandLine() . "\n";
171 $ACT_status = $ACT->Spawn ();
173 if ($ACT_status != 0) {
174 print STDERR
"ERROR: ImR_Activator returned $ACT_status\n";
175 $IR->Kill (); $IR->TimedWait (1);
179 if ($act->WaitForFileTimed ($activator_ior,$act->ProcessStartWaitInterval() + $extra_timeout) == -1) {
180 kill_imr
("cannot find file <$act_actiorfile>");
184 my $srv_cmdline = "$srv_server $svr_debug -orbobjrefstyle url -ORBUseIMR 1 $actinitref";
186 if (ti_cmd
("add", $mode . "-c \"$srv_cmdline\" ")) {
190 if (ti_cmd
("ior", "-f $act_srviorfile")) {
194 if ($act->WaitForFileTimed ($test_ior,$act->ProcessStartWaitInterval() + $extra_timeout) == -1) {
195 kill_imr
("cannot find file <$act_srviorfile>");
199 if ($act->GetFile ($test_ior) == -1) {
200 kill_imr
("cannot retrieve file <$act_srviorfile>");
204 if ($c1->PutFile ($test_ior) == -1) {
205 kill_imr
("cannot set file <$c1_srviorfile>");
210 print ">>> " . $C1->CommandLine() . "\n";
211 $C1_status = $C1->SpawnWaitKill ($c1->ProcessStartWaitInterval() + $extra_timeout);
213 if ($C1_status == 2) {
214 print STDERR
"Warning: This test does not currently run under this operating system.\n";
218 elsif ($C1_status != 0) {
219 kill_imr
("Client1 returned $C1_status");