Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / RTCORBA / Banded_Connections / run_test.pl
blob36fb1648c9fbdfe4d00b964f4573d05ff836b3f2
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 $iorbase1 = "test1.ior";
14 $iorbase2 = "test2.ior";
16 $client_iorfile1 = $client->LocalFile ($iorbase1);
17 $client_iorfile2 = $client->LocalFile ($iorbase2);
18 $server_iorfile1 = $server->LocalFile ($iorbase1);
19 $server_iorfile2 = $server->LocalFile ($iorbase2);
21 $client->DeleteFile ($iorbase1);
22 $client->DeleteFile ($iorbase2);
23 $server->DeleteFile ($iorbase1);
24 $server->DeleteFile ($iorbase2);
26 $status = 0;
28 my $svc_conf = 'svc.conf';
30 # copy the configuation files
31 if ($server->PutFile ($svc_conf) == -1) {
32 print STDERR "ERROR: cannot set file <".$server->LocalFile ($svc_conf).">\n";
33 exit 1;
35 if ($server->PutFile ($svc_conf.'.xml') == -1) {
36 print STDERR "ERROR: cannot set file <".$server->LocalFile ($svc_conf.'.xml').">\n";
37 exit 1;
39 if ($client->PutFile ($svc_conf) == -1) {
40 print STDERR "ERROR: cannot set file <".$client->LocalFile ($svc_conf).">\n";
41 exit 1;
43 if ($client->PutFile ($svc_conf.'.xml') == -1) {
44 print STDERR "ERROR: cannot set file <".$client->LocalFile ($svc_conf.'.xml').">\n";
45 exit 1;
48 print STDERR "\n********** RTCORBA Priority Banded Connections Unit Test\n";
50 # Different priority values for the bands on each OS.
52 if ($^O eq "MSWin32") {
53 $server_args =
54 "-b bands.nt";
56 else {
57 $server_args =
58 "-b bands.unix";
59 # since we only do remote testing on *nix platforms
60 if ($server->PutFile ('bands.unix') == -1) {
61 print STDERR "ERROR: cannot set file <".$server->LocalFile ('bands.unix').">\n";
62 exit 1;
66 $SV = $server->CreateProcess ("server", $server_args . " -n $server_iorfile1 -o $server_iorfile2"),
68 $CL = $client->CreateProcess ("client", "-n file://$client_iorfile1 -o file://$client_iorfile2");
70 $server_status = $SV->Spawn();
72 if ($server_status != 0) {
73 print STDERR "ERROR: server returned $server_status\n";
74 exit 1;
77 if ($server->WaitForFileTimed ($iorbase2,
78 $server->ProcessStartWaitInterval()) == -1) {
79 $server_status = $SV->TimedWait (1);
80 if ($server_status == 2) {
81 # Mark as no longer running to avoid errors on exit.
82 $SV->{RUNNING} = 0;
83 exit $status;
85 else {
86 print STDERR "ERROR: cannot find file <$client_iorfile2>\n";
87 $SV->Kill ();
88 exit 1;
92 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ());
94 if ($client_status != 0) {
95 print STDERR "ERROR: client returned $client_status\n";
96 $status = 1;
99 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval () + 15);
101 if ($server_status != 0) {
102 print STDERR "ERROR: server returned $server_status\n";
103 $status = 1;
106 $client->DeleteFile ($iorbase1);
107 $client->DeleteFile ($iorbase2);
108 $server->DeleteFile ($iorbase1);
109 $server->DeleteFile ($iorbase2);
111 # Clean up SHMIOP files
112 PerlACE::check_n_cleanup_files ("server_shmiop_*");
114 exit $status;