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
;
13 # amount of delay between running the servers
23 my $nstarget = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
24 my $ntarget = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
25 my $ctarget = PerlACE
::TestTarget
::create_target
(3) || die "Create target 3 failed\n";
26 my $starget = PerlACE
::TestTarget
::create_target
(4) || die "Create target 4 failed\n";
28 my $nsiorbase = "ns.ior";
29 my $examplebase = "example.stocks";
30 my $nstarget_nsiorfile = $nstarget->LocalFile ($nsiorbase);
31 my $ntarget_nsiorfile = $ntarget->LocalFile ($nsiorbase);
32 my $ctarget_nsiorfile = $ctarget->LocalFile ($nsiorbase);
33 my $starget_nsiorfile = $starget->LocalFile ($nsiorbase);
34 my $starget_examplefile = $starget->LocalFile ($examplebase);
35 $nstarget->DeleteFile($nsiorbase);
36 $ntarget->DeleteFile($nsiorbase);
37 $ctarget->DeleteFile($nsiorbase);
38 $starget->DeleteFile($nsiorbase);
40 # Programs that are run
42 $NS = $nstarget->CreateProcess (
43 "$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
44 "-o $nstarget_nsiorfile");
45 $N = $ntarget->CreateProcess (
47 "-ORBDebugLevel $debug_level ".
48 "-ORBInitRef NameService=file://$ntarget_nsiorfile");
49 $C = $ctarget->CreateProcess (
51 "-ORBInitRef NameService=file://$ctarget_nsiorfile -t 12 -a TAO");
52 $S = $starget->CreateProcess (
54 "-ORBInitRef NameService=file://$starget_nsiorfile -i $starget_examplefile");
56 print STDERR
"================ Remote test\n";
58 $ns_status = $NS->Spawn ();
60 if ($ns_status != 0) {
61 print STDERR
"ERROR: tao_cosnaming returned $ns_status\n";
65 if ($nstarget->WaitForFileTimed ($nsiorbase,
66 $nstarget->ProcessStartWaitInterval()) == -1) {
67 print STDERR
"ERROR: cannot find file <$nstarget_nsiorfile>\n";
68 $NS->Kill (); $NS->TimedWait (1);
71 if ($nstarget->GetFile ($nsiorbase) == -1) {
72 print STDERR
"ERROR: cannot retrieve file <$nstarget_nsiorfile>\n";
73 $NS->Kill (); $NS->TimedWait (1);
76 if ($ntarget->PutFile ($nsiorbase) == -1) {
77 print STDERR
"ERROR: cannot set file <$ntarget_nsiorfile>\n";
78 $NS->Kill (); $NS->TimedWait (1);
81 if ($ctarget->PutFile ($nsiorbase) == -1) {
82 print STDERR
"ERROR: cannot set file <$ctarget_nsiorfile>\n";
83 $NS->Kill (); $NS->TimedWait (1);
86 if ($starget->PutFile ($nsiorbase) == -1) {
87 print STDERR
"ERROR: cannot set file <$starget_nsiorfile>\n";
88 $NS->Kill (); $NS->TimedWait (1);
92 $n_status = $N->Spawn ();
95 print STDERR
"ERROR: notifier returned $n_status\n";
96 $NS->Kill (); $NS->TimedWait (1);
101 $c_status = $C->Spawn ();
103 if ($c_status != 0) {
104 print STDERR
"ERROR: consumer returned $c_status\n";
105 $NS->Kill (); $NS->TimedWait (1);
106 $N->Kill (); $N->TimedWait (1);
111 $s_status = $S->SpawnWaitKill ($starget->ProcessStopWaitInterval() + 60);
113 if ($s_status != 0) {
114 print STDERR
"ERROR: supplier returned $s_status\n";
115 $NS->Kill (); $NS->TimedWait (1);
116 $N->Kill (); $N->TimedWait (1);
117 $C->Kill (); $C->TimedWait (1);
121 $c_status = $C->TerminateWaitKill ($ctarget->ProcessStopWaitInterval());
123 if ($c_status != 0) {
124 print STDERR
"ERROR: consumer returned $c_status\n";
128 $n_status = $N->TerminateWaitKill ($ntarget->ProcessStopWaitInterval());
130 if ($n_status != 0) {
131 print STDERR
"ERROR: notifier returned $n_status\n";
135 $ns_status = $NS->TerminateWaitKill ($nstarget->ProcessStopWaitInterval());
137 if ($ns_status != 0) {
138 print STDERR
"ERROR: tao_cosnaming returned $ns_status\n";
142 $nstarget->DeleteFile($nsiorbase);
143 $ntarget->DeleteFile($nsiorbase);
144 $ctarget->DeleteFile($nsiorbase);
145 $starget->DeleteFile($nsiorbase);