Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Bug_2561_Regression / run_test.pl
blob793ae6427e579105ba66e735bec5355249402ed0
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 $debug_level = '0';
13 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $sup = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
22 my $con1 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
23 my $con2 = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
25 $sup->AddLibPath ('../lib');
26 $con1->AddLibPath ('../lib');
27 $con2->AddLibPath ('../lib');
29 $port = $ns->RandomPort ();
30 $host = $ns->HostName ();
32 $supiorfile = "supplier.ior";
33 $nsiorfile = "naming.ior";
34 $nfsiorfile = "notify.ior";
35 $nfsconffile = "notify$PerlACE::svcconf_ext";
37 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
38 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
39 my $sup_supiorfile = $sup->LocalFile ($supiorfile);
40 my $con1_supiorfile = $con1->LocalFile ($supiorfile);
41 my $con2_supiorfile = $con2->LocalFile ($supiorfile);
42 my $nfs_nfsconffile = $nfs->LocalFile ($nfsconffile);
43 $ns->DeleteFile ($nsiorfile);
44 $nfs->DeleteFile ($nfsiorfile);
45 $sup->DeleteFile ($supiorfile);
46 $con1->DeleteFile ($supiorfile);
47 $con2->DeleteFile ($supiorfile);
49 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
50 "-ORBEndpoint iiop://$host:$port ".
51 "-o $ns_nsiorfile");
52 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
53 "-ORBInitRef NameService=iioploc://" .
54 "$host:$port/NameService " .
55 "-IORoutput $nfs_nfsiorfile -ORBSvcConf " .
56 "$nfs_nfsconffile");
57 $SUP = $sup->CreateProcess ("Supplier",
58 "-ORBDebugLevel $debug_level ".
59 "-ORBInitRef NameService=iioploc://" .
60 "$host:$port/NameService ".
61 "-o $sup_supiorfile ");
62 $CON1 = $con1->CreateProcess ("Consumer",
63 "-ORBInitRef NameService=iioploc://".
64 "$host:$port/NameService ".
65 "-k file://$con1_supiorfile");
66 $CON2 = $con2->CreateProcess ("Consumer",
67 "-ORBInitRef NameService=iioploc://".
68 "$host:$port/NameService -g ".
69 "-k file://$con2_supiorfile");
71 $NS_status = $NS->Spawn ();
72 if ($NS_status != 0) {
73 print STDERR "ERROR: Name Service returned $NS_status\n";
74 $NS->Kill (); $NS->TimedWait (1);
75 exit 1;
77 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
78 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
79 $NS->Kill (); $NS->TimedWait (1);
80 exit 1;
83 $NFS_status = $NFS->Spawn ();
84 if ($NFS_status != 0) {
85 print STDERR "ERROR: Notify Service returned $NFS_status\n";
86 $NS->Kill (); $NS->TimedWait (1);
87 $NFS->Kill (); $NFS->TimedWait (1);
88 exit 1;
90 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+5) == -1) {
91 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
92 $NS->Kill (); $NS->TimedWait (1);
93 $NFS->Kill (); $NFS->TimedWait (1);
94 exit 1;
97 $SUP_status = $SUP->Spawn ();
98 if ($SUP_status != 0) {
99 print STDERR "ERROR: Supplier returned $SUP_status\n";
100 $SUP->Kill (); $SUP->TimedWait (1);
101 $NFS->Kill (); $NFS->TimedWait (1);
102 $NS->Kill (); $NS->TimedWait (1);
103 exit 1;
105 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()) == -1) {
106 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
107 $SUP->Kill (); $SUP->TimedWait (1);
108 $NS->Kill (); $NS->TimedWait (1);
109 $NFS->Kill (); $NFS->TimedWait (1);
110 exit 1;
112 if ($sup->GetFile ($supiorfile) == -1) {
113 print STDERR "ERROR: cannot retrieve file <$sup_supiorfile>\n";
114 $SUP->Kill (); $SUP->TimedWait (1);
115 $NFS->Kill (); $NFS->TimedWait (1);
116 $NS->Kill (); $NS->TimedWait (1);
117 exit 1;
119 if ($con1->PutFile ($supiorfile) == -1) {
120 print STDERR "ERROR: cannot set file <$con1_supiorfile>\n";
121 $SUP->Kill (); $SUP->TimedWait (1);
122 $NFS->Kill (); $NFS->TimedWait (1);
123 $NS->Kill (); $NS->TimedWait (1);
124 exit 1;
126 if ($con2->PutFile ($supiorfile) == -1) {
127 print STDERR "ERROR: cannot set file <$con2_supiorfile>\n";
128 $SUP->Kill (); $SUP->TimedWait (1);
129 $NFS->Kill (); $NFS->TimedWait (1);
130 $NS->Kill (); $NS->TimedWait (1);
131 exit 1;
134 $CON1_status = $CON1->Spawn ();
135 if ($CON1_status != 0) {
136 print STDERR "ERROR: Consumer 1 returned $CON1_status\n";
137 $CON1->Kill (); $CON1->TimedWait (1);
138 $SUP->Kill (); $SUP->TimedWait (1);
139 $NFS->Kill (); $NFS->TimedWait (1);
140 $NS->Kill (); $NS->TimedWait (1);
141 exit 1;
144 # Give the STC1 time to start up before STC2 starts and triggers the supplier to send.
145 sleep(2);
147 $CON2_status = $CON2->SpawnWaitKill ($con2->ProcessStartWaitInterval()+5);
148 if ($CON2_status != 0) {
149 print STDERR "ERROR: Consumer 2 returned $CON2_status\n";
150 $status = 1;
153 $CON1_status = $CON1->WaitKill ($con1->ProcessStartWaitInterval()+5);
154 if ($CON1_status != 0) {
155 print STDERR "ERROR: Consumer 1 returned $CON1_status\n";
156 $status = 1;
160 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
161 if ($SUP_status != 0) {
162 print STDERR "ERROR: Supplier returned $SUP_status\n";
163 $status = 1;
166 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
167 if ($NFS_status != 0) {
168 print STDERR "ERROR: Notify Service returned $NFS_status\n";
169 $NS->Kill (); $NS->TimedWait (1);
170 $status = 1;
173 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
174 if ($NS_status != 0) {
175 print STDERR "ERROR: Name Service returned $NS_status\n";
176 $status = 1;
179 $ns->DeleteFile ($nsiorfile);
180 $nfs->DeleteFile ($nfsiorfile);
181 $sup->DeleteFile ($supiorfile);
182 $con1->DeleteFile ($supiorfile);
183 $con2->DeleteFile ($supiorfile);
185 exit $status;