diff options
Diffstat (limited to 'modules/CIAO/tests/IDL3_to_XMI/XMI_For_Included_File/run_test.pl')
-rwxr-xr-x | modules/CIAO/tests/IDL3_to_XMI/XMI_For_Included_File/run_test.pl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/CIAO/tests/IDL3_to_XMI/XMI_For_Included_File/run_test.pl b/modules/CIAO/tests/IDL3_to_XMI/XMI_For_Included_File/run_test.pl new file mode 100755 index 00000000000..73300c2ccec --- /dev/null +++ b/modules/CIAO/tests/IDL3_to_XMI/XMI_For_Included_File/run_test.pl @@ -0,0 +1,56 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; + +my $target = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +my $idl = "File2.idl"; +my $dtd = "../XMI.dtd"; +my $xmi = "generated.xmi"; +my $target_idl = $target->LocalFile ($idl); +my $target_dtd = $target->LocalFile ($dtd); +my $target_xmi = $target->LocalFile ($xmi); +$target->DeleteFile($xmi); +unlink $xmi; + +$I2X = $target->CreateProcess ("$ENV{'CIAO_ROOT'}/bin/tao_idl3_to_xmi", + "-f -xd $target_dtd -of $target_xmi $target_idl"); + +$target_status = $I2X->SpawnWaitKill ($target->ProcessStartWaitInterval()); + +if ($target_status != 0) { + print STDERR "ERROR: tao_idl3_to_xmi returned $target_status\n"; + exit 1; +} + +if ($target->GetFile ($xmi) == -1) { + print STDERR "ERROR: cannot retrieve file <$xmi>\n"; + exit 1; +} + +# search for right tag in generated xmi +open (DAT, $xmi) || die ("ERROR: Could not open file <$xmi>!"); +@data=<DAT>; +close (DAT); + +$num = grep (/<UML:Attribute/, @data); +if ($num == 2) { + print "TEST OK. Correct tags in there.\n"; +} else { + print STDERR "ERROR: generated XMI does not contain a brace of UML:Attribute tags !\n\nXMI is:\n\n"; + print "@data\n\n"; + $status = 1; +} + +$target->DeleteFile($xmi); +unlink $xmi; + +exit $status; |