Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / tests / Strategies / run_test.pl
blob346c78efcae090bcc0ca5d9b6a3e940a1a1aef86
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 $svcconf = "svc$PerlACE::svcconf_ext";
24 my $advsvcconf = "advanced_svc$PerlACE::svcconf_ext";
25 my $server_iorfile = $server->LocalFile ($iorbase);
26 my $client_iorfile = $client->LocalFile ($iorbase);
27 my $server_svcconf = $server->LocalFile ($svcconf);
28 my $client_svcconf = $client->LocalFile ($svcconf);
29 my $server_advsvcconf = $server->LocalFile ($advsvcconf);
30 my $client_advsvcconf = $client->LocalFile ($advsvcconf);
31 $server->DeleteFile($iorbase);
32 $client->DeleteFile($iorbase);
34 $SV = $server->CreateProcess ("server",
35 "-ORBdebuglevel $debug_level ".
36 "-ORBSvcConf $server_svcconf ".
37 "-o $server_iorfile");
38 $CL = $client->CreateProcess ("client",
39 "-ORBSvcConf $client_svcconf ".
40 "-k file://$client_iorfile -x");
42 print STDERR "\nrunning Strategies test with static config\n\n";
44 $server_status = $SV->Spawn ();
46 if ($server_status != 0) {
47 print STDERR "ERROR: server returned $server_status\n";
48 exit 1;
51 if ($server->WaitForFileTimed ($iorbase,
52 $server->ProcessStartWaitInterval()) == -1) {
53 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
54 $SV->Kill (); $SV->TimedWait (1);
55 exit 1;
58 if ($server->GetFile ($iorbase) == -1) {
59 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
60 $SV->Kill (); $SV->TimedWait (1);
61 exit 1;
63 if ($client->PutFile ($iorbase) == -1) {
64 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
65 $SV->Kill (); $SV->TimedWait (1);
66 exit 1;
69 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
71 if ($client_status != 0) {
72 print STDERR "ERROR: client returned $client_status\n";
73 $status = 1;
76 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
78 if ($server_status != 0) {
79 print STDERR "ERROR: server returned $server_status\n";
80 $status = 1;
83 $server->DeleteFile($iorbase);
84 $client->DeleteFile($iorbase);
86 print STDERR "\nrunning Strategies test with dynamic config\n\n";
88 $SV->Arguments ("-ORBdebuglevel $debug_level ".
89 "-ORBSvcConf $server_advsvcconf ".
90 "-o $server_iorfile");
91 $CL->Arguments ("-ORBSvcConf $client_advsvcconf ".
92 "-k file://$client_iorfile -x");
94 $server_status = $SV->Spawn ();
96 if ($server_status != 0) {
97 print STDERR "ERROR: server returned $server_status\n";
98 exit 1;
101 if ($server->WaitForFileTimed ($iorbase,
102 $server->ProcessStartWaitInterval()) == -1) {
103 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
104 $SV->Kill (); $SV->TimedWait (1);
105 exit 1;
108 if ($server->GetFile ($iorbase) == -1) {
109 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
110 $SV->Kill (); $SV->TimedWait (1);
111 exit 1;
113 if ($client->PutFile ($iorbase) == -1) {
114 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
115 $SV->Kill (); $SV->TimedWait (1);
116 exit 1;
119 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
121 if ($client_status != 0) {
122 print STDERR "ERROR: client returned $client_status\n";
123 $status = 1;
126 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
128 if ($server_status != 0) {
129 print STDERR "ERROR: server returned $server_status\n";
130 $status = 1;
133 $server->DeleteFile($iorbase);
134 $client->DeleteFile($iorbase);
136 exit $status;