Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / MT_Dispatching / run_test.pl
blob4132769ee50b777cf34ba00321149cdfd33ea011
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 $experiment_timeout = 60;
28 $startup_timeout = 60;
29 $shutdown_timeout = 10;
31 $nfsiorfile = "notify.ior";
32 $nsiorfile = "naming.ior";
33 $supiorfile = "supplier.ior";
35 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
36 my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
37 my $sup_nsiorfile = $sup->LocalFile ($nsiorfile);
38 my $con_nsiorfile = $con->LocalFile ($nsiorfile);
39 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
40 my $sup_supiorfile = $sup->LocalFile ($supiorfile);
41 my $con_supiorfile = $con->LocalFile ($supiorfile);
42 $ns->DeleteFile ($nsiorfile);
43 $nfs->DeleteFile ($nsiorfile);
44 $sup->DeleteFile ($nsiorfile);
45 $con->DeleteFile ($nsiorfile);
46 $nfs->DeleteFile ($nfsiorfile);
47 $sup->DeleteFile ($supiorfile);
48 $con->DeleteFile ($coniorfile);
50 @tests = ( {
51 description => "no threads",
52 config => "notify_nothreads$PerlACE::svcconf_ext",
53 supplier => " -c 10 -e 10 ",
54 consumer => " -c 2 -e 100 ",
55 }, {
56 description => "multi-threaded dispatching",
57 config => "notify_mtdispatching$PerlACE::svcconf_ext",
58 supplier => " -c 10 -e 10 ",
59 consumer => " -c 2 -e 100 ",
60 }, {
61 description => "multi-threaded supplier-side",
62 config => "notify_mtsource$PerlACE::svcconf_ext",
63 supplier => " -c 10 -e 10 ",
64 consumer => " -c 2 -e 100 ",
68 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
69 "-o $ns_nsiorfile");
71 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification");
72 $NFS_Args = "-ORBInitRef NameService=file://$nfs_nsiorfile ".
73 " -IORoutput $nfs_nfsiorfile";
75 $SUP = $sup->CreateProcess ("Structured_Supplier",
76 "-ORBDebugLevel $debug_level ".
77 "-ORBInitRef NameService=file://$sup_nsiorfile ".
78 "-o $sup_supiorfile");
80 $CON = $con->CreateProcess ("Structured_Consumer",
81 "-ORBInitRef NameService=file://$con_nsiorfile ".
82 "-k file://$con_supiorfile");
84 $NS_status = $NS->Spawn ();
85 if ($NS_status != 0) {
86 print STDERR "ERROR: Name Service returned $NS_status\n";
87 exit 1;
89 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+$startup_timeout) == -1) {
90 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
91 $NS->Kill (); $NS->TimedWait (1);
92 exit 1;
94 if ($ns->GetFile ($nsiorfile) == -1) {
95 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
96 $NS->Kill (); $NS->TimedWait (1);
97 exit 1;
99 if ($nfs->PutFile ($nsiorfile) == -1) {
100 print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
101 $NS->Kill (); $NS->TimedWait (1);
102 exit 1;
104 if ($sup->PutFile ($nsiorfile) == -1) {
105 print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n";
106 $NS->Kill (); $NS->TimedWait (1);
107 exit 1;
109 if ($con->PutFile ($nsiorfile) == -1) {
110 print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
111 $NS->Kill (); $NS->TimedWait (1);
112 exit 1;
115 for $test (@tests) {
116 print STDERR "\nTesting $test->{description} ....\n\n";
118 $nfs->DeleteFile ($nfsiorfile);
119 my $config = $test->{config};
120 my $nfs_config = $nfs->LocalFile ($config);
122 $NFS->Arguments ($NFS_Args . " -ORBSvcConf $nfs_config");
123 $args = $NFS->Arguments ();
124 print STDERR "Running Notification with arguments: $args\n";
125 $NFS_status = $NFS->Spawn ();
126 if ($NFS_status != 0) {
127 print STDERR "ERROR: Notify Service returned $NFS_status\n";
128 $NS->Kill (); $NS->TimedWait (1);
129 $NFS->Kill (); $NFS->TimedWait (1);
130 exit 1;
132 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+$startup_timeout) == -1) {
133 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
134 $NS->Kill (); $NS->TimedWait (1);
135 $NFS->Kill (); $NFS->TimedWait (1);
136 exit 1;
139 $sup->DeleteFile ($supiorfile);
140 $con->DeleteFile ($coniorfile);
141 $SUP->Arguments ($SUP->Arguments () . $test->{supplier});
142 $args = $SUP->Arguments ();
143 print STDERR "Running Supplier with arguments: $args\n";
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()+$startup_timeout) == -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 () . $test->{consumer});
175 $args = $CON->Arguments ();
176 print STDERR "Running Consumer with arguments: $args\n";
177 $CON_status = $CON->SpawnWaitKill ($con->ProcessStartWaitInterval()+$experiment_timeout);
178 if ($CON_status != 0) {
179 print STDERR "ERROR: Consumer returned $CON_status\n";
180 $SUP->Kill (); $SUP->TimedWait (1);
181 $NFS->Kill (); $NFS->TimedWait (1);
182 $NS->Kill (); $NS->TimedWait (1);
183 exit 1;
186 $SUP_status = $SUP->WaitKill ($shutdown_timeout);
187 if ($SUP_status != 0) {
188 print STDERR "ERROR: Supplier returned $SUP_status\n";
189 $NFS->Kill (); $NFS->TimedWait (1);
190 $NS->Kill (); $NS->TimedWait (1);
191 exit 1;
194 $NFS_status = $NFS->Kill ($nfs->ProcessStopWaitInterval());
195 if ($NFS_status != 0) {
196 print STDERR "ERROR: Notify Service returned $NFS_status\n";
197 $NS->Kill (); $NS->TimedWait (1);
198 exit 1;
202 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
203 if ($NS_status != 0) {
204 print STDERR "ERROR: Name Service returned $NS_status\n";
205 $status = 1;
208 $ns->DeleteFile ($nsiorfile);
209 $nfs->DeleteFile ($nsiorfile);
210 $sup->DeleteFile ($nsiorfile);
211 $con->DeleteFile ($nsiorfile);
212 $nfs->DeleteFile ($nfsiorfile);
213 $sup->DeleteFile ($supiorfile);
214 $con->DeleteFile ($coniorfile);
216 exit $status;