Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Exposed_Policies / run_test.pl
blobde5271382f714020b9387f2572fcccda7b8e869f
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
8 use lib "$ENV{ACE_ROOT}/bin";
9 use PerlACE::TestTarget;
11 $status = 0;
12 $debug_level = '0';
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = '10';
20 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
21 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
23 my $ior_base = "default.ior";
24 my $ior_overridden = "overridden.ior";
25 my $cfg_poa = "POA.cfg";
26 my $cfg_object = "Object.cfg";
28 my $server_ior_base = $server->LocalFile ($ior_base);
29 my $server_ior_overridden = $server->LocalFile ($ior_overridden);
30 my $client_ior_base = $client->LocalFile ($ior_base);
31 my $client_ior_overridden = $client->LocalFile ($ior_overridden);
32 $server->DeleteFile($ior_base);
33 $server->DeleteFile($ior_overridden);
34 $client->DeleteFile($ior_base);
35 $client->DeleteFile($ior_overridden);
37 my $server_cfg_poa = $server->LocalFile ($cfg_poa);
38 my $server_cfg_object = $server->LocalFile ($cfg_object);
39 my $client_cfg_poa = $client->LocalFile ($cfg_poa);
40 my $client_cfg_object = $client->LocalFile ($cfg_object);
42 if ($server->PutFile ($cfg_poa) == -1) {
43 print STDERR "ERROR: cannot set file <$server_cfg_poa>\n";
44 return 1;
46 if ($server->PutFile ($cfg_object) == -1) {
47 print STDERR "ERROR: cannot set file <$server_cfg_object>\n";
48 return 1;
51 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level ".
52 "-POAConfigFile $server_cfg_poa ".
53 "-ObjectConfigFile $server_cfg_object ".
54 "-BaseObjectIOR $server_ior_base ".
55 "-OverriddenIOR $server_ior_overridden");
57 $CL = $client->CreateProcess ("client", "-POAConfigFile $client_cfg_poa ".
58 "-ObjectConfigFile $client_cfg_object ".
59 "-BaseObjectIOR $client_ior_base ".
60 "-OverriddenIOR $client_ior_overridden");
62 $server_status = $SV->Spawn ();
64 if ($server_status != 0) {
65 print STDERR "ERROR: server returned $server_status\n";
66 exit 1;
69 if ($server->WaitForFileTimed ($ior_base,
70 $server->ProcessStartWaitInterval()) == -1) {
71 print STDERR "ERROR: cannot find file <$server_ior_base>\n";
72 $SV->Kill (); $SV->TimedWait (1);
73 exit 1;
76 if ($server->GetFile ($ior_base) == -1) {
77 print STDERR "ERROR: cannot retrieve file <$server_ior_base>\n";
78 $SV->Kill (); $SV->TimedWait (1);
79 exit 1;
82 if ($server->GetFile ($ior_overridden) == -1) {
83 print STDERR "ERROR: cannot retrieve file <$server_ior_overridden>\n";
84 $SV->Kill (); $SV->TimedWait (1);
85 exit 1;
88 if ($client->PutFile ($ior_base) == -1) {
89 print STDERR "ERROR: cannot set file <$client_ior_base>\n";
90 $SV->Kill (); $SV->TimedWait (1);
91 exit 1;
94 if ($client->PutFile ($ior_overridden) == -1) {
95 print STDERR "ERROR: cannot set file <$client_ior_overridden>\n";
96 $SV->Kill (); $SV->TimedWait (1);
97 exit 1;
100 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 15);
102 if ($client_status != 0) {
103 print STDERR "ERROR: client returned $client_status\n";
104 $status = 1;
107 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
109 if ($server_status != 0) {
110 print STDERR "ERROR: server returned $server_status\n";
111 $status = 1;
114 $server->DeleteFile($ior_base);
115 $server->DeleteFile($ior_overridden);
116 $client->DeleteFile($ior_base);
117 $client->DeleteFile($ior_overridden);
119 exit $status;