summaryrefslogtreecommitdiff
path: root/tests/Bug_3755_Ext_Regression/run_test.pl
blob: db6aa704d5cf9b9d3aed135239b02ace3e66ccb9 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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;
$debug_level = '0';
$bidir = 0;
$messaging = 0;
$csd = 0;
$ziop = 0;

foreach $i (@ARGV) {
    if ($i eq '-debug') {
        $debug_level = '10';
    } elsif ($i eq '-bidir') {
        $bidir = 1;
    } elsif ($i eq '-messaging') {
        $messaging = 1;
    } elsif ($i eq '-csd') {
        $csd = 1;
    } elsif ($i eq '-ziop') {
        $ziop = 1;
    }
}

my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";

sub run_one_test {
    my $name = shift;
    my $svc1 = shift;
    my $svc2 = shift;

    print "\nRunning $name test\n";

    my $server_svc_conf1 = $server->LocalFile ($svc1);
    my $server_svc_conf2 = $server->LocalFile ($svc2);
    my $dopt = "-ORBdebuglevel $debug_level";

    $SV = $server->CreateProcess ("server",
        "-a \"AAA $dopt -ORBSvcConf $server_svc_conf1\" " .
        "-b \"BBB $dopt -ORBGestalt LOCAL -ORBSvcConf $server_svc_conf2\"");
    $server_status = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval());

    if ($server_status != 0) {
        print STDERR "ERROR: server returned $server_status\n";
        return 1;
    }

    print "$name test succeeded\n";
    return 0;
}

# Common tests.
my @svcs = (
    ["PI_Server", "pi_server_svc.conf", "pi_server_svc.conf"],
    ["RTCORBA", "rt_svc.conf", "rt_svc.conf"],
    ["RTScheduler", "rt_scheduler_svc.conf", "rt_scheduler_svc.conf"],
    ["EndpointPolicy", "ep_svc.conf", "ep_svc.conf"],
    ["DiffservPolicy", "dp_svc.conf", "dp_svc.conf"]
);

if ($bidir) {
    @svcs = (
        ["BiDir_GIOP", "bidir_svc.conf", "bidir_svc.conf"],
    );
} elsif ($messaging) {
    @svcs = (
        ["Messaging", "messaging_svc.conf", "messaging_svc.conf"],
    );
} elsif ($csd) {
    @svcs = (
        ["CSD_Framework", "csd_svc.conf", "csd_svc.conf"],
    );
} elsif ($ziop) {
    @svcs = (
        ["ZIOP", "ziop_svc.conf", "ziop_svc.conf"],
    );
}

foreach my $svc_pair (@svcs) {
    $status += run_one_test (@$svc_pair);
}

exit $status;