Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Security / Secure_Invocation / run_test.pl
blobadce83f39cfa56e07b056d016054e53567b07b3d
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';
12 $svc_conf = $PerlACE::svcconf_ext;
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = '10';
20 # Set the SSL environment
21 # This doesn't work on Windows. For some reason,
22 # environment variables aren't propagated to child processes.
23 #$ENV{'SSL_CERT_FILE'} = 'cacert.pem';
25 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
26 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
28 my $iorbase = "test.ior";
29 my $server_iorfile = $server->LocalFile ($iorbase);
30 my $client_iorfile = $client->LocalFile ($iorbase);
31 $server->DeleteFile($iorbase);
32 $client->DeleteFile($iorbase);
35 $SV = $server->CreateProcess ("server",
36 "-ORBdebuglevel $debug_level " .
37 "-ORBSvcConf server$svc_conf " .
38 "-o $server_iorfile ");
40 $CL = $client->CreateProcess ("client",
41 "-ORBSvcConf client$svc_conf " .
42 "-k file://$client_iorfile");
44 print STDERR "\n\n==== Running Secure_Invocation test\n";
46 $server_status = $SV->Spawn ();
48 if ($server_status != 0) {
49 print STDERR "ERROR: server returned $server_status\n";
50 exit 1;
53 if ($server->WaitForFileTimed ($iorbase,
54 $server->ProcessStartWaitInterval()) == -1) {
55 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
56 $SV->Kill (); $SV->TimedWait (1);
57 exit 1;
60 if ($server->GetFile ($iorbase) == -1) {
61 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
62 $SV->Kill (); $SV->TimedWait (1);
63 exit 1;
65 if ($client->PutFile ($iorbase) == -1) {
66 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
67 $SV->Kill (); $SV->TimedWait (1);
68 exit 1;
71 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
73 if ($client_status != 0) {
74 print STDERR "ERROR: client returned $client_status\n";
75 $status = 1;
78 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
80 if ($server_status != 0) {
81 print STDERR "ERROR: server returned $server_status\n";
82 $status = 1;
85 $server->DeleteFile($iorbase);
86 $client->DeleteFile($iorbase);
88 exit $status;