Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / OctetSeq / run_test2.pl
blob937d2a688b91f4cdea1ad85e87a58485100e3cb2
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 $client_iterations = '5000';
15 $octet_iterations = '32';
16 $low = '8192';
17 $high = '8192';
18 $step = '1';
20 foreach $i (@ARGV) {
21 if ($i eq '-debug') {
22 $debug_level = '10';
26 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
27 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
28 my $t3 = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
30 $status = 0;
32 my $iorbase = "test.ior";
33 my $server_iorfile = $server->LocalFile ($iorbase);
34 my $client_iorfile = $t3->LocalFile ($iorbase);
36 my $conf_base = "svc1" . $PerlACE::svcconf_ext;
37 my $server_conf = $server->LocalFile ($conf_base);
38 my $client_conf = $client->LocalFile ($conf_base);
39 my $t3_conf = $t3->LocalFile ($conf_base);
41 if ($server->PutFile ($conf_base) == -1) {
42 print STDERR "ERROR: cannot set file <$server_conf>\n";
43 exit 1;
46 if ($client->PutFile ($conf_base) == -1) {
47 print STDERR "ERROR: cannot set file <$client_conf>\n";
48 exit 1;
51 if ($t3->PutFile ($conf_base) == -1) {
52 print STDERR "ERROR: cannot set file <$t3_conf>\n";
53 exit 1;
56 $server->DeleteFile($iorbase);
57 $client->DeleteFile($iorbase);
59 $SV = $server->CreateProcess ("server",
60 "-ORBdebuglevel $debug_level " .
61 "-ORBSvcConf $server_conf " .
62 "-o $server_iorfile");
64 $T = $client->CreateProcess ("OctetSeq",
65 "-ORBdebuglevel $debug_level " .
66 "-ORBSvcConf $client_conf " .
67 "-n $octet_iterations -l $low -h $high -s $step -q");
69 $CL = $t3->CreateProcess ("client",
70 "-ORBSvcConf $t3_conf " .
71 "-i $client_iterations -k file://$client_iorfile");
73 print STDERR "\n\n==== Octet sequence passing test\n";
75 $server_status = $SV->Spawn ();
77 if ($server_status != 0) {
78 print STDERR "ERROR: server returned $server_status\n";
79 exit 1;
82 if ($server->WaitForFileTimed ($iorbase,
83 $server->ProcessStartWaitInterval()) == -1) {
84 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
85 $SV->Kill (); $SV->TimedWait (1);
86 exit 1;
89 if ($server->GetFile ($iorbase) == -1) {
90 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
91 $SV->Kill (); $SV->TimedWait (1);
92 exit 1;
94 if ($client->PutFile ($iorbase) == -1) {
95 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
96 $SV->Kill (); $SV->TimedWait (1);
97 exit 1;
100 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 100);
102 if ($client_status != 0) {
103 print STDERR "ERROR: client returned $client_status\n";
104 $status = 1;
107 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 10);
109 if ($server_status != 0) {
110 print STDERR "ERROR: server returned $server\n";
111 $status = 1;
114 print STDERR "\n\n==== Octet sequence performance test\n";
116 $test = $T->SpawnWaitKill ($t3->ProcessStartWaitInterval() + 45);
118 if ($test != 0) {
119 print STDERR "ERROR: test returned $test\n";
120 $status = 1;
123 $server->DeleteFile($iorbase);
124 $client->DeleteFile($iorbase);
126 exit $status;