Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_3891_Regression / run_test.pl
blob8fc7f262df502dbac0856651c4c885bd2d9f1b51
2 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
3 & eval 'exec perl -S $0 $argv:q'
4 if 0;
6 use lib "$ENV{ACE_ROOT}/bin";
7 use PerlACE::TestTarget;
8 use strict;
10 my $status = 0;
11 my $debug_level = '0';
13 foreach my $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $imr = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $si = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
22 my $implrepo_server = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_locator";
24 my $implrepo_ior = "implrepo.ior";
26 my $imr_imriorfile = $imr->LocalFile ($implrepo_ior);
27 my $si_imriorfile = $si->LocalFile ($implrepo_ior);
29 # Make sure the files are gone, so we can wait on them.
30 $imr->DeleteFile ($implrepo_ior);
31 $si->DeleteFile ($implrepo_ior);
33 my $SVR = $imr->CreateProcess ("server", "-ORBDebugLevel $debug_level " .
34 "-ORBUseImr 1 " .
35 "-ORBInitRef ImplRepoService=file://$si_imriorfile");
37 my $IR = $imr->CreateProcess ($implrepo_server, "-d 1 -t 5 " .
38 "-o $imr_imriorfile");
39 print ">>> " . $IR->CommandLine() . "\n";
41 my $IR_status = $IR->Spawn ();
43 if ($IR_status != 0) {
44 print STDERR "ERROR: ImplRepo Service returned $IR_status\n";
45 exit 1;
48 if ($imr->WaitForFileTimed ($implrepo_ior,$imr->ProcessStartWaitInterval()) == -1) {
49 print STDERR "ERROR: cannot find file <$imr_imriorfile>\n";
50 $IR->Kill (); $IR->TimedWait (1);
51 exit 1;
54 if ($imr->GetFile ($implrepo_ior) == -1) {
55 print STDERR "ERROR: cannot retrieve file <$imr_imriorfile>\n";
56 $IR->Kill (); $IR->TimedWait (1);
57 exit 1;
59 if ($si->PutFile ($implrepo_ior) == -1) {
60 print STDERR "ERROR: cannot set file <$si_imriorfile>\n";
61 $IR->Kill (); $IR->TimedWait (1);
62 exit 1;
65 print ">>> " . $SVR->CommandLine() . "\n";
67 my $SVR_status = $SVR->SpawnWaitKill ($si->ProcessStartWaitInterval());
69 if ($SVR_status != 0) {
70 print STDERR "ERROR: server returned $SVR_status\n";
71 $IR->Kill (); $IR->TimedWait (1);
72 exit 1;
76 $IR_status = $IR->TerminateWaitKill ($imr->ProcessStopWaitInterval());
78 if ($IR_status != 0) {
79 print STDERR "ERROR: ImplRepo Server returned $IR_status\n";
80 $status = 1;
83 $imr->DeleteFile ($implrepo_ior);
84 $si->DeleteFile ($implrepo_ior);
86 exit $status;