Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / examples / Notify / Lanes / run_test.pl
blob85cb5a8d1f27c38f31592cf760b8878905625757
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";
23 my $con2 = PerlACE::TestTarget::create_target (5) || die "Create target 5 failed\n";
25 PerlACE::check_privilege_group();
27 # Lanes Example
30 $experiment_timeout = 60;
31 $startup_timeout = 60;
33 $nsiorfile = "naming.ior";
34 $nfsiorfile = "notify.ior";
35 $supiorfile = "supplier.ior";
36 $nfsconf = "notify.conf";
37 $cliconf = "client.conf";
39 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
40 my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
41 my $sup_nsiorfile = $sup->LocalFile ($nsiorfile);
42 my $con_nsiorfile = $con->LocalFile ($nsiorfile);
43 my $con2_nsiorfile = $con2->LocalFile ($nsiorfile);
44 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
45 my $sup_supiorfile = $sup->LocalFile ($supiorfile);
46 my $nfs_nfsconf = $nfs->LocalFile ($nfsconf);
47 my $sup_cliconf = $sup->LocalFile ($cliconf);
48 my $con_cliconf = $con->LocalFile ($cliconf);
49 my $con2_cliconf = $con2->LocalFile ($cliconf);
50 $ns->DeleteFile ($nsiorfile);
51 $nfs->DeleteFile ($nsiorfile);
52 $sup->DeleteFile ($nsiorfile);
53 $con->DeleteFile ($nsiorfile);
54 $con2->DeleteFile ($nsiorfile);
55 $nfs->DeleteFile ($nfsiorfile);
56 $sup->DeleteFile ($supiorfile);
59 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
60 " -o $ns_nsiorfile");
62 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification");
63 $Notify_Args = "-ORBInitRef NameService=file://$nfs_nsiorfile -IORoutput $nfs_nfsiorfile -ORBSvcConf $nfs_nfsconf ";
65 $SUP = $sup->CreateProcess ("Supplier");
66 $Supplier_Args = "-ORBInitRef NameService=file://$sup_nsiorfile -ORBSvcConf $sup_cliconf -IORoutput $sup_supiorfile -ORBDebugLevel $debug_level";
68 $CON = $sup->CreateProcess ("Consumer");
69 $Consumer_Args = "-ORBInitRef NameService=file://$con_nsiorfile -ORBSvcConf $con_cliconf -LanePriority 1";
71 $CON2 = $sup->CreateProcess ("Consumer");
72 $Consumer2_Args = "-ORBInitRef NameService=file://$con2_nsiorfile -ORBSvcConf $con2_cliconf -LanePriority 2";
74 $NS_status = $NS->Spawn ();
76 if ($NS_status != 0) {
77 print STDERR "ERROR: Name Service returned $NS_status\n";
78 exit 1;
81 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+$startup_timeout) == -1) {
82 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
83 $NS->Kill (); $NS->TimedWait (1);
84 exit 1;
87 if ($ns->GetFile ($nsiorfile) == -1) {
88 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
89 $NS->Kill (); $NS->TimedWait (1);
90 exit 1;
92 if ($nfs->PutFile ($nsiorfile) == -1) {
93 print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
94 $NS->Kill (); $NS->TimedWait (1);
95 exit 1;
97 if ($sup->PutFile ($nsiorfile) == -1) {
98 print STDERR "ERROR: cannot set file <$sup_nsiorfile>\n";
99 $NS->Kill (); $NS->TimedWait (1);
100 exit 1;
102 if ($con->PutFile ($nsiorfile) == -1) {
103 print STDERR "ERROR: cannot set file <$con_nsiorfile>\n";
104 $NS->Kill (); $NS->TimedWait (1);
105 exit 1;
107 if ($con2->PutFile ($nsiorfile) == -1) {
108 print STDERR "ERROR: cannot set file <$con2_nsiorfile>\n";
109 $NS->Kill (); $NS->TimedWait (1);
110 exit 1;
113 $NFS->Arguments ($Notify_Args);
114 $args = $NFS->Arguments ();
115 print STDERR "Running Notification with arguments: $args\n";
116 $NFS_status = $NFS->Spawn ();
118 if ($NFS_status != 0) {
119 print STDERR "ERROR: Notification Service returned $NFS_status\n";
120 exit 1;
123 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+$startup_timeout) == -1) {
124 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
125 $NFS->Kill (); $NFS->TimedWait (1);
126 $NS->Kill (); $NS->TimedWait (1);
127 exit 1;
130 $SUP->Arguments ($Supplier_Args);
131 $args = $SUP->Arguments ();
132 print STDERR "Running Supplier with arguments: $args\n";
133 $SUP_status = $SUP->Spawn ();
135 if ($SUP_status != 0) {
136 print STDERR "ERROR: Supplier returned $SUP_status\n";
137 exit 1;
140 if ($sup->WaitForFileTimed ($supiorfile,$sup->ProcessStartWaitInterval()+$startup_timeout) == -1) {
141 print STDERR "ERROR: cannot find file <$sup_supiorfile>\n";
142 $NFS->Kill (); $NFS->TimedWait (1);
143 $NS->Kill (); $NS->TimedWait (1);
144 exit 1;
147 $CON->Arguments ($Consumer_Args);
148 $args = $CON->Arguments ();
149 print STDERR "Running Consumer with arguments: $args\n";
150 $CON_status = $CON->Spawn ();
152 if ($CON_status != 0) {
153 print STDERR "ERROR: Consumer returned $CON_status\n";
154 $SUP->Kill (); $SUP->TimedWait (1);
155 $NFS->Kill (); $NFS->TimedWait (1);
156 $NS->Kill (); $NS->TimedWait (1);
157 exit 1;
161 $CON2->Arguments ($Consumer2_Args);
162 $args = $CON2->Arguments ();
163 print STDERR "Running Consumer2 with arguments: $args\n";
164 $CON2_status = $CON2->SpawnWaitKill ($con2->ProcessStartWaitInterval()+$experiment_timeout);
165 if ($CON2_status != 0) {
166 print STDERR "ERROR: Consumer2 returned $CON2_status\n";
167 $status = 1;
170 $CON->Wait ();
171 $SUP->Wait ();
173 $NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
175 if ($NFS_status != 0) {
176 print STDERR "ERROR: Notification Service returned $NFS_status\n";
177 $status = 1;
180 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
182 if ($NS_status != 0) {
183 print STDERR "ERROR: Name Service returned $NS_status\n";
184 $status = 1;
187 $ns->DeleteFile ($nsiorfile);
188 $nfs->DeleteFile ($nsiorfile);
189 $sup->DeleteFile ($nsiorfile);
190 $con->DeleteFile ($nsiorfile);
191 $con2->DeleteFile ($nsiorfile);
192 $nfs->DeleteFile ($nfsiorfile);
193 $sup->DeleteFile ($supiorfile);
195 exit $status;