Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Oneway_Buffering / run_buffer_size.pl
blob245621bde67dcec4c021b5d169f3a7811e6ad498
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 $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $admin = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $iorfile_admin = "admin.ior";
24 my $iorfile = "server.ior";
26 #Files which used by server
27 my $server_iorfile = $server->LocalFile ($iorfile);
28 my $server_iorfile_admin = $server->LocalFile ($iorfile_admin);
29 $server->DeleteFile($iorfile);
30 $server->DeleteFile($iorfile_admin);
32 #Files which used by client
33 my $client_iorfile = $client->LocalFile ($iorfile);
34 my $client_iorfile_admin = $client->LocalFile ($iorfile_admin);
35 $client->DeleteFile($iorfile);
36 $client->DeleteFile($iorfile_admin);
38 #Files which used by admin
39 my $admin_iorfile_admin = $admin->LocalFile ($iorfile_admin);
40 $admin->DeleteFile($iorfile_admin);
42 $AD = $admin->CreateProcess ("admin",
43 "-ORBdebuglevel $debug_level " .
44 "-o $admin_iorfile_admin");
46 $SV = $server->CreateProcess ("server",
47 "-ORBdebuglevel $debug_level " .
48 "-o $server_iorfile " .
49 "-k file://$server_iorfile_admin");
51 $CL = $client->CreateProcess ("client",
52 "-k file://$client_iorfile " .
53 "-a file://$client_iorfile_admin " .
54 "-b");
56 $admin_status = $AD->Spawn ();
58 if ($admin_status != 0) {
59 print STDERR "ERROR: admin returned $admin_status\n";
60 exit 1;
63 if ($admin->WaitForFileTimed ($iorfile_admin,
64 $admin->ProcessStartWaitInterval()) == -1) {
65 print STDERR "ERROR: cannot find file <$iorfile_admin>\n";
66 $AD->Kill (); $AD->TimedWait (1);
67 exit 1;
69 if ($admin->GetFile ($iorfile_admin) == -1) {
70 print STDERR "ERROR: cannot retrieve file <$admin_iorfile_admin>\n";
71 $AD->Kill (); $AD->TimedWait (1);
72 exit 1;
74 if ($client->PutFile ($iorfile_admin) == -1) {
75 print STDERR "ERROR: cannot set file <$client_iorfile_admin>\n";
76 $AD->Kill (); $AD->TimedWait (1);
77 exit 1;
79 if ($server->PutFile ($iorfile_admin) == -1) {
80 print STDERR "ERROR: cannot set file <$server_iorfile_admin>\n";
81 $AD->Kill (); $AD->TimedWait (1);
82 exit 1;
85 $server_status = $SV->Spawn ();
87 if ($server_status != 0) {
88 print STDERR "ERROR: server returned $server_status\n";
89 exit 1;
92 sub KillServers{
93 $SV->Kill (); $SV->TimedWait (1);
94 $AD->Kill (); $AD->TimedWait (1);
97 if ($server->WaitForFileTimed ($iorfile,
98 $server->ProcessStartWaitInterval()) == -1) {
99 print STDERR "ERROR: cannot find file <$iorfile>\n";
100 KillServers();
101 exit 1;
104 if ($server->GetFile ($iorfile) == -1) {
105 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
106 KillServers();
107 exit 1;
109 if ($client->PutFile ($iorfile) == -1) {
110 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
111 KillServers();
112 exit 1;
115 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 15);
117 if ($client_status != 0) {
118 print STDERR "ERROR: client returned $client_status\n";
119 $status = 1;
122 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
124 if ($server_status != 0) {
125 print STDERR "ERROR: server returned $server_status\n";
126 $status = 1;
129 $admin_status = $AD->WaitKill ($admin->ProcessStopWaitInterval());
131 if ($admin_status != 0) {
132 print STDERR "ERROR: admin returned $admin_status\n";
133 $status = 1;
136 $server->DeleteFile($iorfile);
137 $client->DeleteFile($iorfile);
138 $client->DeleteFile($iorfile_admin);
139 $server->DeleteFile($iorfile_admin);
140 $admin->DeleteFile($iorfile_admin);
142 exit $status;