Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / Security / ssliop_CSD / run_test.pl
blob49bf16f5162f42a0a77bf6acc172db13db868461
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 $options = "csd|ssliop|ssliop-csd";
20 my $ssliop_conf = "ssliop.conf";
21 my $csd_conf = "csd.conf";
22 my $ssliop_csd_conf = "ssliop-csd.conf";
23 my $client_conf = "client1.conf";
25 my $serv_opts = "-ORBSvcConf $ssliop_conf";
26 my $client_opts = "-ORBSvcConf $client_conf";
28 $args = @ARGV;
29 if ($args > 0) {
30 if (($ARGV[0] =~ /\-h/) || ($ARGV[0] =~ /\-\?/)) {
31 print $0. " $options\n";
32 } elsif ($ARGV[0] =~ /ssliop\-csd/) {
33 $serv_opts = "-ORBSvcConf $ssliop_csd_conf";
34 } elsif ($ARGV[0] =~ /csd/) {
35 $serv_opts = "-ORBSvcConf $csd_conf";
36 $client_opts = "";
37 } else {
38 print "Using default ssliop configuration.\n";
40 } else {
41 print "Using default ssliop configuration.\n";
44 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
45 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
47 $ENV{'SSL_CERT_FILE'} = "cacert.pem";
48 my $iorbase = "Messenger.ior";
49 my $server_iorfile = $server->LocalFile ($iorbase);
50 my $client_iorfile = $client->LocalFile ($iorbase);
51 $server->DeleteFile($iorbase);
52 $client->DeleteFile($iorbase);
54 $SV = $server->CreateProcess ("MessengerServer", "-ORBdebuglevel $debug_level -o $server_iorfile $serv_opts");
55 $CL = $client->CreateProcess ("MessengerClient", "-k file://$client_iorfile $client_opts");
57 print STDERR "\n\nSecurity Unaware Application Examples\n";
58 print STDERR "-------------------------------------\n";
59 print STDERR "Starting Messenger Server...\n\n";
61 print $SV->CommandLine(). "\n";
63 $server_status = $SV->Spawn ();
65 if ($server_status != 0) {
66 print STDERR "ERROR: server returned $server_status\n";
67 exit 1;
70 if ($server->WaitForFileTimed ($iorbase,
71 $server->ProcessStartWaitInterval()) == -1) {
72 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
73 $SV->Kill (); $SV->TimedWait (1);
74 exit 1;
77 if ($server->GetFile ($iorbase) == -1) {
78 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
79 $SV->Kill (); $SV->TimedWait (1);
80 exit 1;
82 if ($client->PutFile ($iorbase) == -1) {
83 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
84 $SV->Kill (); $SV->TimedWait (1);
85 exit 1;
88 print $CL->CommandLine(). "\n";
89 print STDERR "\nStarting MessengerClient, example 3...\n\n";
91 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
93 if ($client_status != 0) {
94 print STDERR "ERROR: client returned $client_status\n";
95 $status = 1;
98 $ENV{'SSL_CERT_FILE'} = "";
100 $server_status = $SV->Kill ();
102 if ($server_status != 0) {
103 print STDERR "ERROR: server returned $server_status\n";
104 $status = 1;
107 $server->DeleteFile($iorbase);
108 $client->DeleteFile($iorbase);
110 exit $status;