Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / InterfaceRepo / IFR_Test / run_test.pl
blob43b31fc973e8d200afe3ec1bc57a08178b11643a
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;
12 $locking = "";
13 $nice = "";
14 $debug = "";
15 $test = "";
16 $iterations = "";
17 $other = "";
19 for ($i = 0; $i <= $#ARGV; $i++) {
20 if ($ARGV[$i] eq "-d") {
21 $debug = "-d";
23 elsif ($ARGV[$i] eq "-t") {
24 $test = "-t ".$ARGV[$i + 1];
25 $i++;
27 elsif ($ARGV[$i] eq "-i") {
28 $iterations = "-i ".$ARGV[$i + 1];
29 $i++;
31 else {
32 $other .= $ARGV[$i];
36 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
37 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
39 my $iorbase = "if_repo.ior";
40 my $server_iorfile = $server->LocalFile ($iorbase);
41 my $client_iorfile = $client->LocalFile ($iorbase);
42 $server->DeleteFile($iorbase);
43 $client->DeleteFile($iorbase);
45 $SV = $server->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/IFR_Service/tao_ifr_service",
46 " $nice " .
47 " -o $server_iorfile " .
48 " $locking");
50 $CL = $client->CreateProcess ("IFR_Test",
51 "-ORBInitRef InterfaceRepository=file://$client_iorfile " .
52 " $debug $test $iterations");
54 $server_status = $SV->Spawn ();
56 if ($server_status != 0) {
57 print STDERR "ERROR: server returned $server_status\n";
58 exit 1;
61 if ($server->WaitForFileTimed ($iorbase,
62 $server->ProcessStartWaitInterval()) == -1) {
63 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
64 $SV->Kill (); $SV->TimedWait (1);
65 exit 1;
68 if ($server->GetFile ($iorbase) == -1) {
69 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
70 $SV->Kill (); $SV->TimedWait (1);
71 exit 1;
73 if ($client->PutFile ($iorbase) == -1) {
74 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
75 $SV->Kill (); $SV->TimedWait (1);
76 exit 1;
79 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
81 if ($client_status != 0) {
82 print STDERR "ERROR: client returned $client_status\n";
83 $status = 1;
86 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
88 if ($server_status != 0) {
89 print STDERR "ERROR: server returned $server_status\n";
90 $status = 1;
93 $server->DeleteFile($iorbase);
94 $client->DeleteFile($iorbase);
96 exit $status;