Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / examples / RTCORBA / Activity / run_test.pl
blobd9498e0d4bd4e395a1cf1a1cae881a52dfb458b0
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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $client1 = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $client2 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $iorfile = "naming.ior";
24 my $server_flag_file = "server.flag";
26 $client2_flag_file = $client2->LocalFile ($server_flag_file);
27 $client2->DeleteFile ($server_flag_file);
29 $server_conf = $client2->LocalFile ("server.conf");
31 $client1_conf = $client1->LocalFile ("client.conf");
33 #Files which used by server
34 my $server_iorfile = $server->LocalFile ($iorfile);
35 $server->DeleteFile($iorfile);
37 #Files which used by client1
38 my $client1_iorfile = $client1->LocalFile ($iorfile);
39 $client1->DeleteFile($iorfile);
41 #Files which used by client2
42 my $client2_iorfile = $client2->LocalFile ($iorfile);
43 $client2->DeleteFile($iorfile);
45 $SV = $server->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
46 "-ORBdebuglevel $debug_level " .
47 "-o $server_iorfile");
49 $CL1 = $client1->CreateProcess ("activity",
50 "-ORBInitRef NameService=file://$client1_iorfile " .
51 "-ORBSvcConf $client1_conf");
53 $CL2 = $client2->CreateProcess ("activity",
54 "-ORBInitRef NameService=file://$client2_iorfile " .
55 "-ORBSvcConf $server_conf " .
56 "-Started_Flag $client2_flag_file");
58 print STDERR "Running tao_cosnaming\n";
60 $server_status = $SV->Spawn ();
62 if ($server_status != 0) {
63 print STDERR "ERROR: server returned $server_status\n";
64 exit 1;
67 if ($server->WaitForFileTimed ($iorfile,
68 $server->ProcessStartWaitInterval() + 45) == -1) {
69 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
70 $SV->Kill (); $SV->TimedWait (1);
71 exit 1;
74 if ($server->GetFile ($iorfile) == -1) {
75 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
76 $SV->Kill (); $SV->TimedWait (1);
77 exit 1;
80 if ($client1->PutFile ($iorfile) == -1) {
81 print STDERR "ERROR: cannot set file <$client1_iorfile>\n";
82 $SV->Kill (); $SV->TimedWait (1);
83 exit 1;
86 if ($client2->PutFile ($iorfile) == -1) {
87 print STDERR "ERROR: cannot set file <$client2_iorfile>\n";
88 $SV->Kill (); $SV->TimedWait (1);
89 exit 1;
92 print STDERR "Running Activity Server\n";
94 $client_status = $CL2->Spawn ();
96 if ($client_status != 0) {
97 print STDERR "ERROR: client returned $client_status\n";
98 exit 1;
101 if ($client2->WaitForFileTimed ($server_flag_file,
102 $client2->ProcessStartWaitInterval() + 45) == -1) {
103 print STDERR "ERROR: cannot find file <$client2_flag_file>\n";
104 $SV->Kill (); $SV->TimedWait (1);
105 $CL2->Kill (); $CL2->TimedWait (1);
106 exit 1;
109 print STDERR "Running Activity Client\n";
111 $client_status = $CL1->SpawnWaitKill ($client1->ProcessStartWaitInterval() + 45);
113 if ($client_status != 0) {
114 print STDERR "ERROR: client returned $client_status\n";
115 $status = 1;
118 $client_status = $CL2->WaitKill ($client2->ProcessStopWaitInterval());
120 if ($client_status != 0) {
121 print STDERR "ERROR: client returned $client_status\n";
122 $status = 1;
125 $SV->Kill ();
127 $client2->DeleteFile ($server_flag_file);
128 $server->DeleteFile($iorfile);
129 $client1->DeleteFile($iorfile);
130 $client2->DeleteFile($iorfile);
132 exit $status;