Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Bug_2186_Regression / run_test.pl
blob4010539abd93f11380db3434ff04d6f73969e3f1
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 $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
22 my $iorbase = "server.ior";
23 my $client_iorbase = "client.ior";
25 my $server_iorfile = $server->LocalFile ($iorbase);
26 my $client_iorfile = $client->LocalFile ($iorbase);
27 $server->DeleteFile($iorbase);
28 $client->DeleteFile($iorbase);
30 my $client_iorbase_file = $client->LocalFile ($client_iorbase);
31 $client->DeleteFile($client_iorbase);
33 my $server_conf_file = "server.conf";
34 my $server_conf = $server->LocalFile ($server_conf_file);
37 # copy the configuation file
38 if ($server->PutFile ($server_conf_file) == -1) {
39 print STDERR "ERROR: cannot set file <$server_conf>\n";
40 $SV->Kill (); $SV->TimedWait (1);
41 return 1;
44 $SV = $server->CreateProcess ("server",
45 "-ORBdebuglevel $debug_level " .
46 "-ORBSvcConf $server_conf " .
47 "-o $server_iorfile");
49 $port = $client->RandomPort ();
51 $CL = $client->CreateProcess ("client",
52 "-ORBEndpoint iiop://:$port " .
53 "-k file://$client_iorfile " .
54 "-o $client_iorbase_file");
56 $server_status = $SV->Spawn ();
58 if ($server_status != 0) {
59 print STDERR "ERROR: server returned $server_status\n";
60 exit 1;
63 if ($server->WaitForFileTimed ($iorbase,
64 $server->ProcessStartWaitInterval()) == -1) {
65 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
66 $SV->Kill (); $SV->TimedWait (1);
67 exit 1;
70 if ($server->GetFile ($iorbase) == -1) {
71 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
72 $SV->Kill (); $SV->TimedWait (1);
73 exit 1;
75 if ($client->PutFile ($iorbase) == -1) {
76 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
77 $SV->Kill (); $SV->TimedWait (1);
78 exit 1;
81 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 285);
83 if ($client_status != 0) {
84 print STDERR "ERROR: First client spawn returned $client_status. Indicates a problem other than a regression.\n";
85 $status = 1;
88 if ($client_status == 0){
89 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 285);
91 if ($client_status != 0) {
92 print STDERR "ERROR: REGRESSION - Second client spawn returned $client\n";
93 $status = 1;
98 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
100 if ($server_status != 0) {
101 print STDERR "ERROR: server returned $server_status\n";
102 $status = 1;
105 $server->DeleteFile($iorbase);
106 $client->DeleteFile($iorbase);
107 $client->DeleteFile($client_iorbase);
109 exit $status;