Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / InterfaceRepo / IDL_Test / run_test.pl
blobaf717586ae6e343ef3a31621848626d05fa5d413
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 lib ".";
9 use PerlACE::TestTarget;
11 my $ifr_service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
12 my $tao_ifr = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
14 my $iorbase = "ifr.ior";
16 my $ifr_service_iorfile = $ifr_service->LocalFile ($iorbase);
17 $ifr_service->DeleteFile ($iorbase);
18 my $tao_ifr_iorfile = $tao_ifr->LocalFile ($iorbase);
19 $tao_ifr->DeleteFile ($iorbase);
21 # Generate an array containing the path to the IDL files
22 sub idl_filenames {
23 # Need to figure out the platform-independent way to
24 # list all the files matching that pattern.
25 my @f;
26 my $dirpath = "$ENV{TAO_ROOT}/tests/IDL_Test";
27 opendir(DIR, $dirpath);
28 @idl_files = grep(/.*\.idl$/, readdir(DIR));
29 close(DIR);
30 return map { "$dirpath/$_" } @idl_files;
33 # Input: array of idl file names
34 # Output: array of idl file names that had a failure
35 sub phase1 {
36 my $SVC = $ifr_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/IFR_Service/tao_ifr_service",
37 "-o $ifr_service_iorfile");
39 my $CMP = $tao_ifr->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_ifr",
40 "-ORBinitref InterfaceRepository=file://$tao_ifr_iorfile");
42 my @failures = ();
44 my $sep = "\n" . '-' x 70 . "\n\n";
46 foreach $idlfile (@_) {
47 print $sep;
48 print "phase1: checking $idlfile\n";
50 $server_status = $SVC->Spawn ();
52 if ($server_status != 0) {
53 print STDERR "ERROR: server returned $server_status\n";
54 push(@failures, $idlfile);
55 next;
58 if ($ifr_service->WaitForFileTimed ($iorbase,
59 $ifr_service->ProcessStartWaitInterval()) == -1) {
60 print STDERR "ERROR: cannot find file <$ifr_service_iorfile>\n";
61 $SVC->Kill (); $SVC->TimedWait (1);
62 push(@failures, $idlfile);
63 next;
66 if ($ifr_service->GetFile ($iorbase) == -1) {
67 print STDERR "ERROR: cannot retrieve file <$tao_ifr_iorfile>\n";
68 $SVC->Kill (); $SVC->TimedWait (1);
69 push(@failures, $idlfile);
70 next;
73 if ($tao_ifr->PutFile ($iorbase) == -1) {
74 print STDERR "ERROR: cannot set file <$tao_ifr_iorfile>\n";
75 $SVC->Kill (); $SVC->TimedWait (1);
76 push(@failures, $idlfile);
77 next;
80 $CMP->Arguments ("-ORBInitRef InterfaceRepository=file://$tao_ifr_iorfile " .
81 "-I$ENV{TAO_ROOT}/tests/IDL_Test " .
82 "$idlfile");
83 print STDOUT $CMP->Arguments () . "\n";
84 $client_status = $CMP->SpawnWaitKill ($tao_ifr->ProcessStartWaitInterval());
86 $server_status = $SVC->Wait (0);
88 if ($server_status != -1) {
89 push(@failures, $idlfile);
90 warn "Service crashed during compilation of $idlfile.\n";
91 next;
94 print "phase1: $add_r\n";
95 if ($client_status != 0) {
96 push(@failures, $idlfile);
97 warn "Failure during compilation of $idlfile.\n";
98 next;
101 $CMP->Arguments ("-ORBinitref InterfaceRepository=file://$tao_ifr_iorfile " .
102 "-I$ENV{TAO_ROOT}/tests/IDL_Test " .
103 "$idlfile -r");
105 $client_status = $CMP->SpawnWaitKill ($tao_ifr->ProcessStartWaitInterval());
107 $server_status = $SVC->Wait (0);
109 if ($server_status != -1) {
110 push(@failures, $idlfile);
111 warn "Service crashed during removal of $idlfile.\n";
112 next;
115 print "phase1: $add_r\n";
116 if ($client_status != 0) {
117 push(@failures, $idlfile);
118 warn "Failure during removal of $idlfile.\n";
119 next;
122 continue {
123 $SVC->Kill (); $SVC->TimedWait (1);
124 $ifr_service->DeleteFile ($iorbase);
125 $tao_ifr->DeleteFile ($iorbase);
128 return @failures;
131 sub phase2 {
136 @files = ($#ARGV > -1) ? @ARGV : idl_filenames;
138 @phase1_failures = phase1(@files);
140 print "END: the following failed phase1:\n", join("\n", @phase1_failures), "\n";