Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / Blocking / run_test.pl
blob65a6f4e22fa00fa89ae43331cc50c35829a04dfb
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 $con = PerlACE::TestTarget::create_target (4) || die "Create target 4 failed\n";
24 $sup->AddLibPath ('../lib');
25 $con->AddLibPath ('../lib');
27 $port = $ns->RandomPort ();
28 $host = $ns->HostName ();
30 $supiorfile = "supplier.ior";
31 $nsiorfile = "naming.ior";
32 $nfsiorfile = "notify.ior";
33 $nfsconffile = "../Blocking/notify$PerlACE::svcconf_ext";
35 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
36 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
37 my $sup_supiorfile = $sup->LocalFile ($supiorfile);
38 my $con_supiorfile = $con->LocalFile ($supiorfile);
39 my $nfs_nfsconffile = $nfs->LocalFile ($nfsconffile);
40 $ns->DeleteFile ($nsiorfile);
41 $nfs->DeleteFile ($nfsiorfile);
42 $sup->DeleteFile ($supiorfile);
43 $con->DeleteFile ($supiorfile);
45 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
46 "-ORBEndpoint iiop://$host:$port ".
47 "-o $ns_nsiorfile");
48 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
49 "-ORBInitRef NameService=iioploc://" .
50 "$host:$port/NameService " .
51 "-IORoutput $nfs_nfsiorfile -ORBSvcConf " .
52 "$nfs_nfsconffile");
53 $SUP = $sup->CreateProcess ("Structured_Supplier",
54 "-ORBDebugLevel $debug_level ".
55 "-ORBInitRef NameService=iioploc://" .
56 "$host:$port/NameService ".
57 "-o $sup_supiorfile ");
58 $CON = $con->CreateProcess ("Structured_Consumer",
59 "-ORBInitRef NameService=iioploc://".
60 "$host:$port/NameService ".
61 "-k file://$con_supiorfile");
63 $NS_status = $NS->Spawn ();
64 if ($NS_status != 0) {
65 print STDERR "ERROR: Name Service returned $NS_status\n";
66 $NS->Kill (); $NS->TimedWait (1);
67 exit 1;
69 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()) == -1) {
70 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
71 $NS->Kill (); $NS->TimedWait (1);
72 exit 1;
75 $NFS_status = $NFS->Spawn ();
76 if ($NFS_status != 0) {
77 print STDERR "ERROR: Notify Service returned $NFS_status\n";
78 $NS->Kill (); $NS->TimedWait (1);
79 $NFS->Kill (); $NFS->TimedWait (1);
80 exit 1;
82 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+5) == -1) {
83 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
84 $NS->Kill (); $NS->TimedWait (1);
85 $NFS->Kill (); $NFS->TimedWait (1);
86 exit 1;
89 print "****** Running consumer long blocking timeout ******\n";
91 $SUP_status = $SUP->Spawn ();
92 if ($SUP_status != 0) {
93 print STDERR "ERROR: Supplier returned $SUP_status\n";
94 $SUP->Kill (); $SUP->TimedWait (1);
95 $NFS->Kill (); $NFS->TimedWait (1);
96 $NS->Kill (); $NS->TimedWait (1);
97 exit 1;
99 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()) == -1) {
100 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
101 $SUP->Kill (); $SUP->TimedWait (1);
102 $NS->Kill (); $NS->TimedWait (1);
103 $NFS->Kill (); $NFS->TimedWait (1);
104 exit 1;
106 if ($sup->GetFile ($supiorfile) == -1) {
107 print STDERR "ERROR: cannot retrieve file <$sup_supiorfile>\n";
108 $SUP->Kill (); $SUP->TimedWait (1);
109 $NFS->Kill (); $NFS->TimedWait (1);
110 $NS->Kill (); $NS->TimedWait (1);
111 exit 1;
113 if ($con->PutFile ($supiorfile) == -1) {
114 print STDERR "ERROR: cannot set file <$con_supiorfile>\n";
115 $SUP->Kill (); $SUP->TimedWait (1);
116 $NFS->Kill (); $NFS->TimedWait (1);
117 $NS->Kill (); $NS->TimedWait (1);
118 exit 1;
121 $CON->Arguments($CON->Arguments() . " -t 2000");
122 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+5);
123 if ($CON_status != 0) {
124 print STDERR "ERROR: Consumer returned $CON_status\n";
125 $SUP->Kill (); $SUP->TimedWait (1);
126 $NFS->Kill (); $NFS->TimedWait (1);
127 $NS->Kill (); $NS->TimedWait (1);
128 exit 1;
131 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
132 if ($SUP_status != 0) {
133 print STDERR "ERROR: Supplier returned $SUP_status\n";
134 $NFS->Kill (); $NFS->TimedWait (1);
135 $NS->Kill (); $NS->TimedWait (1);
136 exit 1;
139 print "****** Running consumer with short blocking timeout ******\n";
141 $sup->DeleteFile ($supiorfile);
142 $con->DeleteFile ($supiorfile);
144 $SUP_status = $SUP->Spawn ();
145 if ($SUP_status != 0) {
146 print STDERR "ERROR: Supplier returned $SUP_status\n";
147 $SUP->Kill (); $SUP->TimedWait (1);
148 $NFS->Kill (); $NFS->TimedWait (1);
149 $NS->Kill (); $NS->TimedWait (1);
150 exit 1;
152 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()) == -1) {
153 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
154 $SUP->Kill (); $SUP->TimedWait (1);
155 $NS->Kill (); $NS->TimedWait (1);
156 $NFS->Kill (); $NFS->TimedWait (1);
157 exit 1;
159 if ($sup->GetFile ($supiorfile) == -1) {
160 print STDERR "ERROR: cannot retrieve file <$sup_supiorfile>\n";
161 $SUP->Kill (); $SUP->TimedWait (1);
162 $NFS->Kill (); $NFS->TimedWait (1);
163 $NS->Kill (); $NS->TimedWait (1);
164 exit 1;
166 if ($con->PutFile ($supiorfile) == -1) {
167 print STDERR "ERROR: cannot set file <$con_supiorfile>\n";
168 $SUP->Kill (); $SUP->TimedWait (1);
169 $NFS->Kill (); $NFS->TimedWait (1);
170 $NS->Kill (); $NS->TimedWait (1);
171 exit 1;
174 $CON->Arguments($CON->Arguments() . " -e 19 -t 500");
175 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval());
176 if ($CON_status != 0) {
177 print STDERR "ERROR: Consumer returned $CON_status\n";
178 $SUP->Kill (); $SUP->TimedWait (1);
179 $NFS->Kill (); $NFS->TimedWait (1);
180 $NS->Kill (); $NS->TimedWait (1);
181 exit 1;
184 $SUP_status = $SUP->WaitKill ($sup->ProcessStopWaitInterval());
185 if ($SUP_status != 0) {
186 print STDERR "ERROR: Supplier returned $SUP_status\n";
187 $status = 1;
190 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
191 if ($NFS_status != 0) {
192 print STDERR "ERROR: Notify Service returned $NFS_status\n";
193 $status = 1;
196 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
197 if ($NS_status != 0) {
198 print STDERR "ERROR: Name Service returned $NS_status\n";
199 $status = 1;
202 $ns->DeleteFile ($nsiorfile);
203 $nfs->DeleteFile ($nfsiorfile);
204 $sup->DeleteFile ($supiorfile);
205 $con->DeleteFile ($supiorfile);
207 exit $status;