Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / tests / Security / Big_Request / run_test.pl
blobdae070b6e3bf8302c906f8d7cb1ba6f95382e6f7
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;
9 use Getopt::Long;
11 $status = 0;
12 $opt = "";
13 $debug_level = '0';
14 $svc_conf = $PerlACE::svcconf_ext;
15 $conf_client = "";
16 $conf_server = "";
18 sub options () {
19 my $help = 0; # handled locally
20 my $man = 0; # handled locally
21 my $ssl = 1; # handled locally
22 my $dotdec = 0; # handled locally
23 my $debug; # handled locally
24 my $shost; # handled locally
25 my $chost; # handled locally
26 my $clog; # handled locally
27 my $slog; # handled locally
29 # Process options.
30 if ( @ARGV > 0 ) {
31 GetOptions ('help|?' => \$help,
32 'manual' => \$man,
33 'ssl' => \$ssl,
34 'dd=s' => \$dotdec,
35 'shost=s' => \$shost,
36 'chost=s' => \$chost,
37 'slog=s' => \$slog,
38 'clog=s' => \$clog,
39 'debug=i' => \$debug) or pod2usage(2);
42 if ($ssl) {
43 $conf_client = " -ORBSvcConf client$svc_conf";
44 $conf_server = " -ORBSvcConf server$svc_conf";
47 if ($debug) {
48 $opt = "$opt -ORBDebugLevel $debug";
51 if ($dotdec) {
52 if ($dotdec =~ /client/) {
53 $conf_client = "$conf_client -ORBDottedDecimalAddresses 1";
55 if ($dotdec =~ /server/) {
56 $conf_server = "$conf_server -ORBDottedDecimalAddresses 1";
60 if ($slog) {
61 $conf_server = "$conf_server -ORBLogFile $slog";
64 if ($clog) {
65 $conf_client = "$conf_client -ORBLogFile $clog";
68 if ($shost) {
69 $conf_server = "$conf_server -ORBListenEndpoints iiop:///hostname_in_ior=$shost";
72 if ($chost) {
73 $conf_client = "$conf_client -ORBListenEndpoints iiop:///hostname_in_ior=$chost";
76 if ( $man or $help ) {
77 # Load Pod::Usage only if needed.
78 require "Pod/Usage.pm";
79 import Pod::Usage;
80 pod2usage(1) if $help;
81 pod2usage(VERBOSE => 2) if $man;
82 return 0;
84 return 1;
87 options () or die "Error: Nothing executed";
89 foreach $i (@ARGV) {
90 if ($i eq '-debug') {
91 $debug_level = '10';
95 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
96 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
98 my $iorbase = "test.ior";
99 my $server_iorfile = $server->LocalFile ($iorbase);
100 my $client_iorfile = $client->LocalFile ($iorbase);
101 $server->DeleteFile($iorbase);
102 $client->DeleteFile($iorbase);
105 $SV = $server->CreateProcess ("server",
106 "$conf_server " .
107 "$opt " .
108 "-o $server_iorfile ");
110 $CL = $client->CreateProcess ("client",
111 "$conf_client " .
112 "$opt " .
113 "-k file://$client_iorfile " .
114 "-x");
116 print STDERR "\n\n==== Running SSLIOP Big_Request test\n";
118 print STDERR "Executing: server $conf_server $opt -o $iorbase\n";
120 $server_status = $SV->Spawn ();
122 if ($server_status != 0) {
123 print STDERR "ERROR: server returned $server_status\n";
124 exit 1;
127 if ($server->WaitForFileTimed ($iorbase,
128 $server->ProcessStartWaitInterval()) == -1) {
129 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
130 $SV->Kill (); $SV->TimedWait (1);
131 exit 1;
134 if ($server->GetFile ($iorbase) == -1) {
135 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
136 $SV->Kill (); $SV->TimedWait (1);
137 exit 1;
139 if ($client->PutFile ($iorbase) == -1) {
140 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
141 $SV->Kill (); $SV->TimedWait (1);
142 exit 1;
145 print STDERR "Executing: client $conf_client $opt\n";
147 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 165);
149 if ($client_status != 0) {
150 print STDERR "ERROR: client returned $client_status\n";
151 $status = 1;
154 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
156 if ($server_status != 0) {
157 print STDERR "ERROR: server returned $server_status\n";
158 $status = 1;
161 $server->DeleteFile($iorbase);
162 $client->DeleteFile($iorbase);
164 exit $status;