summaryrefslogtreecommitdiff
path: root/TAO/CIAO/tests/RTCCM/Priority_Test/descriptors/rate_test.pl
blob: 4232b9953150b94e07cc35cfaa86f55d20bfa211 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

# $Id$
# -*- perl -*-

#
# @@ Run this script from ../descriptors/ instead.
#

use lib "$ENV{'ACE_ROOT'}/bin";
use PerlACE::Run_Test;

## Source in the environment setting
$ACE_ROOT=$ENV{'ACE_ROOT'};
$CIAO_ROOT=$ENV{'CIAO_ROOT'};

if ($CIAO_ROOT eq "") {
    $CIAO_ROOT="$ACE_ROOT/TAO/CIAO";
}


$status = 0;
$local = 1;
$assembly = PerlACE::LocalFile ("no-rt-3rates.cad");
$daemon_ior = PerlACE::LocalFile ("daemon.ior");
$am_ior = PerlACE::LocalFile ("am.ior");
$c25_ior = PerlACE::LocalFile ("c25.ior");
$c50_ior = PerlACE::LocalFile ("c50.ior");
$c75_ior = PerlACE::LocalFile ("c75.ior");
$cookie = PerlACE::LocalFile ("ck_demo_deployment");

## The following control how to iterate thru various work amount
$start_work = 300;
$end_work = 301;
$work_step = 100;
$run_time = 40;                 # run for $run_time sec.

unlink $daemon_ior;
unlink $am_ior;
unlink $cookie;

$test_deploy = 0;
$no_daemon = 0;

# Parse command line argument
while ( $#ARGV >= 0)
{
    if ($ARGV[0] =~ m/^-test_deploy/i) {
        $test_deploy = 1;
    }
    elsif ($ARGV[0] =~ m/^-remote/i) {
        $local = 0;
    }
    elsif ($ARGV[0] =~ m/^-assmbly/i) {
        shift;
        if ($#ARGV >= 0) {
            $assembly = PerlACE::LocalFile ("$ARGV[0]");
        }
    }
    else {
        die "Invalid flag: $ARGV[0]\n";
    }

    shift;
}

if ($local == 1) {
    $deploy_config = PerlACE::LocalFile ("test.dat");
}
else {
    $deploy_config = PerlACE::LocalFile ("remote.dat");
}

# CIAO Daemon command line arguments
$daemon_args1 = "-ORBEndpoint iiop://localhost:10000 -o $daemon_ior -i CIAO_Installation_Data.ini -n $CIAO_ROOT/tools/ComponentServer/ComponentServer";

$assembly_manager_args = "-o $am_ior -c $deploy_config";

$ad_deploy = " -k file://$am_ior -o $cookie -a $assembly";

$ad_teardown = " -k file://$am_ior -d $cookie -x";

# CIAO daemon process definition
$DS = new PerlACE::Process ("$CIAO_ROOT/tools/Daemon/CIAO_Daemon",
                            "$daemon_args1");

if ($local == 1) {
## Starting up the CIAO daemon
    $DS->Spawn ();
    if (PerlACE::waitforfile_timed ($daemon_ior, 15) == -1) {
        print STDERR "ERROR: Could not find daemon ior file <$daemon_ior>\n";
        $DS->Kill ();
        exit 1;
    }
}

## Starting up the CIAO Assembly Manager
$AM = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Manager",
                           $assembly_manager_args);
$AM->Spawn ();
if (PerlACE::waitforfile_timed ($am_ior, 15) == -1) {
    print STDERR "ERROR: Could not find assembly ior file <$am_ior>\n";
    $AM->Kill ();
    $DS->Kill ();
    exit 1;
}

## Now actually deploy the application
$AD = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Deployer",
                           $ad_deploy);
if ($AD->SpawnWaitKill (60) == -1) {
    print STDERR "ERROR: Failed to deploy assembly file <$assembly>\n";
    $AD->Kill ();
    $AM->Kill ();
    $DS->Kill ();
}

## Make sure the application is up and running
if (PerlACE::waitforfile_timed ($c75_ior, 15) == -1) {
    print STDERR "ERROR: Could not find controller ior file <$controller_ior>\n";
    $AM->Kill ();
    $DS->Kill ();
    exit 1;
}

# Don't start the test
if ($test_deploy == 0) {
    for ($work = $start_work; $work < $end_work; $work += $work_step)
    {
        printf "Test work: $work\n";

#Start the client to send the trigger message
        $CL = new PerlACE::Process ("../Controllers/client",
                                    "-k file://$c25_ior -k file://$c50_ior -k file://$c75_ior -w $work");
        $CL->SpawnWaitKill(60);

## Now wait for the test to complete.  Need to figure out a way to
## detect this.
        sleep ($run_time);

#Start the client to send the trigger message
        $CL = new PerlACE::Process ("../Controllers/client",
                                    "-k file://$c25_ior -k file://$c50_ior -k file://$c75_ior -f");
        $CL->SpawnWaitKill(60);
    }
}
else {
    print "Test deploying the application -=-=- Not invoking client\n";
    sleep (1);
}

## Now teardown the application
$AD = new PerlACE::Process("$CIAO_ROOT/tools/Assembly_Deployer/Assembly_Deployer",
                           $ad_teardown);
if ($AD->SpawnWaitKill (60) == -1) {
    print STDERR "ERROR: Failed to teardown assembly file <$assembly>\n";
    $AD->Kill ();
    $AM->Kill ();
    $DS->Kill ();
    exit 1;
}

#$ctrl = $DS->WaitKill (5);
#$AM->WaitKill(5);
#$AD->WaitKill(5);

$AM->WaitKill (2);
$DS->Kill ();


unlink $cookie;
unlink $c25_ior;
unlink $c50_ior;
unlink $c75_ior;
unlink $daemon_ior;
unlink $am_ior;

exit $status;