Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Monitor / Marshal_Buffer / run_test.pl
blob720e4e6490b59b4f74af33b75507637fa727f6fe
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 $iterations = '10';
15 foreach $i (@ARGV) {
16 if ($i eq '-debug') {
17 $debug_level = '10';
21 my $server1 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
22 my $server2 = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
23 my $client = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
25 my $iorbase = "test.ior";
26 my $mc_iorbase = "monitor.ior";
28 my $server1_iorfile1 = $server1->LocalFile ($iorbase);
29 my $client_iorfile1 = $client->LocalFile ($iorbase);
31 my $server2_iorfile2 = $server2->LocalFile ($mc_iorbase);
32 my $client_iorfile2 = $client->LocalFile ($mc_iorbase);
34 $server1->DeleteFile($iorbase);
35 $server2->DeleteFile($mc_iorbase);
36 $client->DeleteFile($iorbase);
37 $client->DeleteFile($mc_iorbase);
39 $SV1 = $server1->CreateProcess ("server",
40 "-ORBdebuglevel $debug_level " .
41 "-o $server1_iorfile1");
43 $SV2 = $server2->CreateProcess ("$ENV{TAO_ROOT}/utils/monitor/monitor_client",
44 "-k \"file://$server2_iorfile2\" " .
45 "-p \"Output CDR Buffer\" " .
46 "-p \"OS/Processor/CPULoad\" " .
47 "-p \"OS/Network/BytesSent\" " .
48 "-i $iterations");
50 $CL = $client->CreateProcess ("client", "-k file://$client_iorfile1 -m $client_iorfile2");
52 $server_status = $SV1->Spawn ();
54 if ($server_status != 0) {
55 print STDERR "ERROR: server returned $server_status\n";
56 exit 1;
58 if ($server1->WaitForFileTimed ($iorbase,
59 $server1->ProcessStartWaitInterval()) == -1) {
60 print STDERR "ERROR: cannot find file <$server1_iorfile1>\n";
61 $SV1->Kill (); $SV1->TimedWait (1);
62 exit 1;
65 if ($server1->GetFile ($iorbase) == -1) {
66 print STDERR "ERROR: cannot retrieve file <$server1_iorfile1>\n";
67 $SV1->Kill (); $SV1->TimedWait (1);
68 exit 1;
70 if ($client->PutFile ($iorbase) == -1) {
71 print STDERR "ERROR: cannot set file <$client_iorfile1>\n";
72 $SV1->Kill (); $SV1->TimedWait (1);
73 exit 1;
76 # Start client
77 $client_status = $CL->Spawn ();
79 if ($client_status != 0) {
80 print STDERR "ERROR: client returned $client_status\n";
81 exit 1;
83 if ($client->WaitForFileTimed ($mc_iorbase,
84 $client->ProcessStartWaitInterval()) == -1) {
85 print STDERR "ERROR: cannot find file <$client_iorfile2>\n";
86 $SV1->Kill (); $SV1->TimedWait (1);
87 $CL->Kill (); $CL->TimedWait (1);
88 exit 1;
91 if ($client->GetFile ($mc_iorbase) == -1) {
92 print STDERR "ERROR: cannot retrieve file <$client_iorfile2>\n";
93 $SV1->Kill (); $SV1->TimedWait (1);
94 $CL->Kill (); $CL->TimedWait (1);
95 exit 1;
98 if ($server2->PutFile ($mc_iorbase) == -1) {
99 print STDERR "ERROR: cannot set file <$server2_iorfile2>\n";
100 $SV1->Kill (); $SV1->TimedWait (1);
101 $CL->Kill (); $CL->TimedWait (1);
102 exit 1;
105 sleep (2);
107 $server_status = $SV2->SpawnWaitKill ($server2->ProcessStartWaitInterval() + 45);
109 if ($server_status != 0) {
110 print STDERR "ERROR: server returned $server_status\n";
111 $status = 1;
114 $client_status = $CL->Kill ($client->ProcessStopWaitInterval());
116 if ($client_status != 0) {
117 print STDERR "ERROR: client returned $client_status\n";
118 $status = 1;
121 $server_status = $SV1->WaitKill ($server1->ProcessStopWaitInterval());
123 if ($server_status != 0) {
124 print STDERR "ERROR: server returned $server_status\n";
125 $status = 1;
128 $server1->DeleteFile($iorbase);
129 $server2->DeleteFile($mc_iorbase);
130 $client->DeleteFile($iorbase);
131 $client->DeleteFile($mc_iorbase);
133 exit $status;