diff options
Diffstat (limited to 'TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl')
-rwxr-xr-x | TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl | 115 |
1 files changed, 61 insertions, 54 deletions
diff --git a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl index 78da7eee3b2..69c35f0f832 100755 --- a/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl +++ b/TAO/orbsvcs/tests/InterfaceRepo/Application_Test/run_test.pl @@ -6,87 +6,94 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # -*- perl -*- use lib "../../../../../bin"; -use PerlACE::Run_Test; -$status = 0; +require ACEutils; +use Cwd; -$ifr_iorfile= "if_repo.ior"; -$svr_iorfile = "iorfile"; -$test_idl = PerlACE::LocalFile ("test.idl"); +BEGIN { + ### We need to BEGIN this block so we make sure ACE_ROOT is set before + ### we use it in the use lib line + $cwd = getcwd(); -if ($^O eq "MSWin32") { - $tao_ifr = "../../../../../bin/tao_ifr"; -} -else { - $tao_ifr = "../../../IFR_Service/tao_ifr"; + $ACE_ROOT = $ENV{ACE_ROOT}; + + if (!$ACE_ROOT) { + chdir ('../../../../'); + $ACE_ROOT = getcwd (); + chdir ($cwd); + print "ACE_ROOT not defined, defaulting to ACE_ROOT=$ACE_ROOT\n"; + } } -$TAO_IFR = new PerlACE::Process ($tao_ifr); -$IFR = new PerlACE::Process ("../../../IFR_Service/IFR_Service"); -$SV = new PerlACE::Process ("server"); -$CL = new PerlACE::Process ("client", "-ORBInitRef InterfaceRepository=file://$ifr_iorfile"); +use lib "$ACE_ROOT/bin"; -unlink $ifr_iorfile; -unlink $svr_iorfile; +ACE::checkForTarget($cwd); -$IFR->Spawn (); +$if_repo_service = $EXEPREFIX."..".$DIR_SEPARATOR."..".$DIR_SEPARATOR. + "..".$DIR_SEPARATOR."IFR_Service".$DIR_SEPARATOR. + "IFR_Service".$EXE_EXT; -if (PerlACE::waitforfile_timed ($ifr_iorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$ifr_iorfile>\n"; - $IFR->Kill (); - exit 1; -} -$SV->Spawn (); +$init_ref = + "-ORBInitRef InterfaceRepository=file://if_repo.ior"; -if (PerlACE::waitforfile_timed ($svr_iorfile, 15) == -1) { - print STDERR "ERROR: cannot find file <$svr_iorfile>\n"; - $IFR->Kill (); - $SV->Kill (); - exit 1; +if ($^O eq "MSWin32") { + ### It is in the path + $tao_ifr = "tao_ifr".$EXE_EXT; +} +else { + $tao_ifr = "$ACE_ROOT/TAO/orbsvcs/IFR_Service/tao_ifr".$EXE_EXT; } -$TAO_IFR->Arguments ($test_idl); - -$tresult = $TAO_IFR->SpawnWaitKill (30); +$ifr_iorfile = "$cwd$DIR_SEPARATOR" . "if_repo.ior"; +$svr_iorfile = "$cwd$DIR_SEPARATOR" . "iorfile"; -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (test.idl) returned $tresult\n"; - $status = 1; -} +unlink $ifr_iorfile; +unlink $svr_iorfile; -$client = $CL->SpawnWaitKill (60); +$IFR = Process::Create ($if_repo_service); -if ($client != 0) { - print STDERR "ERROR: client returned $client\n"; - $status = 1; +if (ACE::waitforfile_timed ($ifr_iorfile, 15) == -1) +{ + print STDERR "ERROR: cannot find file <$ifr_iorfile>\n"; + $IFR->Kill (); + $IFR->TimedWait (1); + exit 1; } -$server = $SV->TerminateWaitKill (5); +$SV = Process::Create ($EXEPREFIX."server".$EXE_EXT); -if ($server != 0) { - print STDERR "ERROR: server returned $server\n"; - $status = 1; +if (ACE::waitforfile_timed ($svr_iorfile, 15) == -1) +{ + print STDERR "ERROR: cannot find file <$svr_iorfile>\n"; + $SV->Kill (); + $SV->TimedWait (1); + exit 1; } -$TAO_IFR->Arguments ("-r $test_idl"); +system ($tao_ifr." test.idl"); -$tresult = $TAO_IFR->SpawnWaitKill (30); +$CL = Process::Create ($EXEPREFIX."client".$EXE_EXT, + " $init_ref"); -if ($tresult != 0) { - print STDERR "ERROR: tao_ifr (-r test.idl) returned $tresult\n"; - $status = 1; +$client = $CL->TimedWait (60); +if ($client == -1) +{ + print STDERR "ERROR: client timedout\n"; + $CL->Kill (); + $CL->TimedWait (1); } -$server = $IFR->TerminateWaitKill (5); +$SV->Kill (); +$SV->TimedWait (1); -if ($server != 0) { - print STDERR "ERROR: IFR returned $server\n"; - $status = 1; -} +system ($tao_ifr." -r test.idl"); + +$IFR->Kill (); +$IFR->TimedWait (1); unlink $ifr_iorfile; unlink $svr_iorfile; -exit $status; +exit 0; |