Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / File_IO / run_test.pl
blob9abe84927dc2ff2c4723607f05a482ce2fe69efd
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 $server_debug_level = '0';
12 $client_debug_level = '0';
14 foreach $i (@ARGV) {
15 if ($i eq '-sdebug') {
16 $server_debug_level = '10';
18 if ($i eq '-cdebug') {
19 $client_debug_level = '10';
24 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
25 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
27 my $iorbase = "server.ior";
28 my $client_file = "test";
29 my $server_file = "big.txt";
31 my $server_iorfile = $server->LocalFile ($iorbase);
32 my $client_iorfile = $client->LocalFile ($iorbase);
34 my $client_test_file = $client->LocalFile ($client_file);
35 my $server_test_file = $server->LocalFile ($server_file);
37 $server->DeleteFile($iorbase);
38 $client->DeleteFile($iorbase);
40 $server->DeleteFile($server_file);
41 $client->DeleteFile($client_file);
44 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $server_debug_level -o $server_iorfile");
45 $CL = $client->CreateProcess ("client", "-ORBdebuglevel $client_debug_level -k $client_iorfile");
47 $server_status = $SV->Spawn ();
49 if ($server_status != 0) {
50 print STDERR "ERROR: server returned $server_status\n";
51 exit 1;
54 if ($server->WaitForFileTimed ($iorbase,
55 $server->ProcessStartWaitInterval()) == -1) {
56 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
57 $SV->Kill (); $SV->TimedWait (1);
58 exit 1;
61 if ($server->GetFile ($iorbase) == -1) {
62 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
63 $SV->Kill (); $SV->TimedWait (1);
64 exit 1;
66 if ($client->PutFile ($iorbase) == -1) {
67 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
68 $SV->Kill (); $SV->TimedWait (1);
69 exit 1;
72 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 105);
74 if ($client_status != 0) {
75 print STDERR "ERROR: client returned $client_status\n";
76 $status = 1;
79 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
81 if ($server_status != 0) {
82 print STDERR "ERROR: server returned $server_status\n";
83 $status = 1;
86 $server->DeleteFile($iorbase);
87 $client->DeleteFile($iorbase);
89 $server->DeleteFile($server_file);
90 $client->DeleteFile($client_file);
92 exit $status;