1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
6 use lib
"$ENV{ACE_ROOT}/bin";
7 use PerlACE
::TestTarget
;
18 my $imr = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
19 my $act = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
20 my $ti = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
21 my $srv = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
22 my $cli = PerlACE
::TestTarget
::create_target
(5) || die "Create target 5 failed\n";
25 my $OBJ_REF_STYLE = "-ORBObjRefStyle url";
28 "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_locator";
29 my $imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_activator";
30 my $tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr";
32 my $imriorfile = "imr.ior";
33 my $actiorfile = "activator.ior";
34 my $srviorfile = "messenger.ior";
36 my $imr_imriorfile = $imr->LocalFile ($imriorfile);
37 my $act_imriorfile = $act->LocalFile ($imriorfile);
38 my $ti_imriorfile = $ti->LocalFile ($imriorfile);
39 my $srv_imriorfile = $srv->LocalFile ($imriorfile);
40 my $act_actiorfile = $act->LocalFile ($actiorfile);
41 my $srv_srviorfile = $srv->LocalFile ($srviorfile);
42 my $cli_srviorfile = $cli->LocalFile ($srviorfile);
45 $IMR = $imr->CreateProcess ($implrepo_server, "-d $DEBUG_LEVEL ".
49 "-o $imr_imriorfile");
50 $ACT = $act->CreateProcess ($imr_activator, "-d $DEBUG_LEVEL ".
52 "-o $act_actiorfile ".
53 "-ORBInitRef ImplRepoService=file://$act_imriorfile");
54 $TI = $ti->CreateProcess ("$tao_imr");
55 $SRV = $srv->CreateProcess ("MessengerServer", "-orbuseimr 1 ".
57 "-o $srv_srviorfile ".
58 "-ORBInitRef ImplRepoService=file://$srv_imriorfile");
59 $CLI = $cli->CreateProcess ("MessengerClient");
61 my $server_cmd = $SRV->Executable();
62 my $srv_server_cmd = $imr->LocalFile ($server_cmd);
65 $imr->DeleteFile ($imriorfile);
66 $act->DeleteFile ($imriorfile);
67 $ti->DeleteFile ($imriorfile);
68 $srv->DeleteFile ($imriorfile);
69 $act->DeleteFile ($actiorfile);
70 $srv->DeleteFile ($srviorfile);
71 $cli->DeleteFile ($srviorfile);
80 if (!defined $timeout) {
81 $timeout = $target->ProcessStartWaitInterval();
84 print ">>> " . $process->CommandLine () . "\n\ttimeout = $timeout\n";
85 my $status = $process->Spawn ();
87 print STDERR
"ERROR: Process returned $status\n";
90 my $ret = $target->WaitForFileTimed ($file,$timeout);
92 print STDERR
"ERROR: Cannot find file <$file>\n";
97 # We want the tao_imr executable to be found exactly in the path
98 # given, without being modified by the value of -ExeSubDir.
99 # So, we tell its Process object to ignore the setting of -ExeSubDir.
100 $TI->IgnoreExeSubDir(1);
105 print ">>> " . $TI->CommandLine() . "\n";
106 $TI->Arguments("-ORBInitRef ImplRepoService=file://$ti_imriorfile $cmd");
107 return $TI->SpawnWaitKill($ti->ProcessStartWaitInterval());
112 if (SpawnWait
($IMR, $imriorfile, $imr) != 0) {
113 $ImR->Kill (); $ImR->TimedWait (1);
116 if ($imr->GetFile ($imriorfile) == -1) {
117 print STDERR
"ERROR: cannot retrieve file <$imr_imriorfile>\n";
118 $IMR->Kill (); $IMR->TimedWait (1);
121 if ($ti->PutFile ($imriorfile) == -1) {
122 print STDERR
"ERROR: cannot set file <$ti_imriorfile>\n";
123 $IMR->Kill (); $IMR->TimedWait (1);
126 if ($act->PutFile ($imriorfile) == -1) {
127 print STDERR
"ERROR: cannot set file <$act_imriorfile>\n";
128 $IMR->Kill (); $IMR->TimedWait (1);
131 if ($srv->PutFile ($imriorfile) == -1) {
132 print STDERR
"ERROR: cannot set file <$srv_imriorfile>\n";
133 $IMR->Kill (); $IMR->TimedWait (1);
137 if (SpawnWait
($ACT, $actiorfile, $act) != 0) {
138 $ACT->Kill (); $ACT->TimedWait (1);
139 $IMR->Kill (); $IMR->TimedWait (1);
143 my $actname = $act->HostName ();
144 RunImRUtil
("add MessengerService -a per_client -r 1 -l $actname -c \""
145 . "$srv_server_cmd $OBJ_REF_STYLE "
146 . "-ORBEndpoint iiop://:8923/portspan=3\"");
147 RunImRUtil
("list -v");
149 #start the server manually twice
151 if (SpawnWait
($SRV, $srviorfile, $srv, 30) != 0) {
152 $SRV->Kill (); $SRV->TimedWait (1);
153 $ACT->Kill (); $ACT->TimedWait (1);
154 $IMR->Kill (); $IMR->TimedWait (1);
158 $SRV->Kill (); $SRV->TimedWait (1);
159 $srv->DeleteFile ($srviorfile);
161 if (SpawnWait
($SRV, $srviorfile, $srv, 30) != 0) {
162 $SRV->Kill (); $SRV->TimedWait (1);
163 $ACT->Kill (); $ACT->TimedWait (1);
164 $IMR->Kill (); $IMR->TimedWait (1);
167 $SRV->Kill (); $SRV->TimedWait (1);
168 if ($srv->GetFile ($srviorfile) == -1) {
169 print STDERR
"ERROR: cannot retrieve file <$srv_srviorfile>\n";
172 if ($cli->PutFile ($srviorfile) == -1) {
173 print STDERR
"ERROR: cannot set file <$cli_srviorfile>\n";
177 $CLI_status = $CLI->SpawnWaitKill ($cli->ProcessStartWaitInterval()+985);
178 if ($CLI_status != 0) {
179 print STDERR
"Error : Client failed to run correctly with error $CLI_status.";
183 $ACT_status = $ACT->TerminateWaitKill ($act->ProcessStopWaitInterval());
184 if ($ACT_status != 0) {
185 print STDERR
"ERROR: Activator returned $ACT_status\n";
189 $IMR_status = $IMR->TerminateWaitKill ($imr->ProcessStopWaitInterval());
190 if ($IMR_status != 0) {
191 print STDERR
"ERROR: ImplRepo Service returned $IMR_status\n";