Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / tests / Time / run_test.pl
blob338a36acaaf92dc6ce7c473021b1db02b6ed2037
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 $clerk = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 my $srv_ior = "server.ior";
24 my $clk_ior = "clerk.ior";
26 my $server_srv_ior = $server->LocalFile ($srv_ior);
27 my $clerk_srv_ior = $clerk->LocalFile($srv_ior);
28 my $clerk_clk_ior = $clerk->LocalFile($clk_ior);
29 my $client_clk_ior = $client->LocalFile ($clk_ior);
31 $server->DeleteFile($srv_ior);
32 $clerk->DeleteFile($srv_ior);
33 $clerk->DeleteFile($clk_ior);
34 $client->DeleteFile($clk_ior);
36 $SV = $server->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Time_Service/tao_costime_server", "-o $server_srv_ior");
37 $CK = $server->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Time_Service/tao_costime_clerk",
38 "-f $clerk_srv_ior -o $clerk_clk_ior -t 2");
39 $CL = $client->CreateProcess ("client", "-f $client_clk_ior");
41 $process_status = $SV->Spawn ();
43 if ($process_status != 0) {
44 print STDERR "ERROR: server returned $process_status\n";
45 exit 1;
48 if ($server->WaitForFileTimed ($srv_ior,
49 $server->ProcessStartWaitInterval()) == -1) {
50 print STDERR "ERROR: cannot find file <$server_srv_ior>\n";
51 $SV->Kill (); $SV->TimedWait (1);
52 exit 1;
55 if ($server->GetFile ($srv_ior) == -1) {
56 print STDERR "ERROR: cannot retrieve file <$server_srv_ior>\n";
57 $SV->Kill (); $SV->TimedWait (1);
58 exit 1;
61 if ($clerk->PutFile ($srv_ior) == -1) {
62 print STDERR "ERROR: cannot set file <$clerk_srv_ior>\n";
63 $SV->Kill (); $SV->TimedWait (1);
64 exit 1;
67 $process_status = $CK->Spawn ();
69 if ($process_status != 0) {
70 print STDERR "ERROR: clerk returned $process_status\n";
71 $SV->Kill (); $SV->TimedWait (1);
72 exit 1;
75 if ($clerk->WaitForFileTimed ($clk_ior,
76 $clerk->ProcessStartWaitInterval()) == -1) {
77 print STDERR "ERROR: cannot find file <$clerk_clk_ior>\n";
78 $CK->Kill (); $CK->TimedWait (1);
79 $SV->Kill (); $SV->TimedWait (1);
80 exit 1;
83 if ($clerk->GetFile ($clk_ior) == -1) {
84 print STDERR "ERROR: cannot retrieve file <$clerk_clk_ior>\n";
85 $CK->Kill (); $CK->TimedWait (1);
86 $SV->Kill (); $SV->TimedWait (1);
87 exit 1;
90 if ($client->PutFile ($clk_ior) == -1) {
91 print STDERR "ERROR: cannot set file <$client_clk_ior>\n";
92 $CK->Kill (); $CK->TimedWait (1);
93 $SV->Kill (); $SV->TimedWait (1);
94 exit 1;
97 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
99 if ($client_status != 0) {
100 print STDERR "ERROR: client returned $client_status\n";
101 $status = 1;
104 $process_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
105 if ($process_status != 0) {
106 print STDERR "ERROR: server returned $process_status\n";
107 $status = 1;
110 $process_status = $CK->TerminateWaitKill ($clerk->ProcessStopWaitInterval());
111 if ($process_status != 0) {
112 print STDERR "ERROR: clerk returned $process_status\n";
113 $status = 1;
116 $server->DeleteFile($srv_ior);
117 $clerk->DeleteFile($srv_ior);
118 $clerk->DeleteFile($clk_ior);
119 $client->DeleteFile($clk_ior);
121 exit $status;