summaryrefslogtreecommitdiff
path: root/modules/CIAO/tests/IDL3_to_XMI/XMI_For_Native/run_test.pl
blob: 15ec0930389fa66798c9f9e031aa91da63d3886a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 = "test.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);

$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;
}

$native_correct = 0;
@data = ();

# search for right tag in generated xmi
open (DAT, $xmi) || die ("ERROR: Could not open file <$xmi>!");
while ($line = <DAT>) {
    push @data, $line;
    if ($line =~ /name\s*=\s*\"CORBAnative\"/) {
        $native_correct = 1;
    }
}
close (DAT);

if ($native_correct) {
    print "TEST OK. Correct tags are there.\n";
} else {
    print STDERR "ERROR: generated XMI is not correct!\n\nXMI is:\n\n";
    print "@data\n\n";
    $status = 1;
}

$target->DeleteFile($xmi);

exit $status;