Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / RTCORBA / Bug_3643_Regression / run_test.pl
blobdc8133995ef4a70d24d0e8aa17ad39eeac5f22c7
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 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
11 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
13 $number_of_clients = 4;
14 $status = 0;
15 $continuous = ($^O eq 'hpux');
17 @configurations =
19 file => "ior_1",
20 description => "Invoking methods on servant in default thread pool",
21 },{
22 file => "ior_2",
23 description => "Invoking methods on servant in first RT thread pool (without lanes)",
24 },{
25 file => "ior_3",
26 description => "Invoking methods on servant in second RT thread pool (with lanes)",
30 for $test (@configurations) {
31 $server->DeleteFile ($test->{file});
32 $client->DeleteFile ($test->{file});
35 sub run_clients
37 my @parms = @_;
38 $arg = $parms[0];
39 $clients = $parms[1];
42 for ($i = 0; $i < $clients; $i++) {
43 $CL[$i] = $client->CreateProcess ("client", $arg);
44 $CL[$i]->Spawn ();
47 for ($i = 0; $i < $clients; $i++) {
48 $client_status = $CL[$i]->WaitKill ($client->ProcessStopWaitInterval (120));
49 if ($client_status != 0) {
50 print STDERR "ERROR: client returned $client_status\n";
51 $status = 1;
52 goto kill_server;
55 print STDERR "Finished running clients";
58 $SV = $server->CreateProcess ("server");
60 if ($continuous) {
61 $SV->Arguments ("-ORBSvcConf continuous$PerlACE::svcconf_ext");
64 $SV->Spawn ();
66 for $test (@configurations) {
67 if ($server->WaitForFileTimed ($test->{file},
68 $server->ProcessStartWaitInterval()) == -1) {
69 $server_status = $SV->TimedWait (1);
70 if ($server_status == 2) {
71 # Mark as no longer running to avoid errors on exit.
72 $SV->{RUNNING} = 0;
73 exit $status;
75 else {
76 print STDERR "ERROR: cannot find ior file: $test->{file}\n";
77 $status = 1;
78 goto kill_server;
83 for $test (@configurations) {
84 print STDERR "\n*************************************************************\n";
85 print STDERR "$test->{description}\n";
86 print STDERR "*************************************************************\n\n";
88 $iorfile = $client->LocalFile ($test->{file});
89 run_clients ("-k file://$iorfile", $number_of_clients);
90 print STDERR "Prepare next cycle";
93 print STDERR "\n************************\n";
94 print STDERR "Shutting down the server\n";
95 print STDERR "************************\n\n";
97 $client_iorfile = $client->LocalFile ($configurations[0]->{file});
98 run_clients ("-k file://$client_iorfile -i 0 -x", 1);
100 kill_server:
102 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval () + (2 * $number_of_clients * 100));
104 if ($server_status != 0) {
105 print STDERR "ERROR: server returned $server_status\n";
106 $status = 1;
109 for $test (@configurations) {
110 $client->DeleteFile ($test->{file});
111 $server->DeleteFile ($test->{file});
114 exit $status