summaryrefslogtreecommitdiff
path: root/CIAO/examples/Display/descriptors/run_test_one_contr.pl
blob: ca318c7f1ef187abf5de6d970741a872775245e5 (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
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

# -*- perl -*-

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

$CIAO_ROOT = "$ENV{'CIAO_ROOT'}";
$TAO_ROOT = "$ENV{'TAO_ROOT'}";
$DANCE_ROOT = "$ENV{'DANCE_ROOT'}";

$controller_exec = "$CIAO_ROOT/examples/Display/RateGen/controller";

$tg_executor = 0;

$status = 0;

sub create_targets {
    #   executor (plan_launcher)
    $tg_executor = PerlACE::TestTarget::create_target (1) || die "Create target for executor failed\n";
    $tg_executor->AddLibPath ('../lib');
}

create_targets ();

print "Invoking the controller for first RateGen with rate = 2\n";
$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -o -r2");
$result = $controller->SpawnWaitKill (3 * $tg_executor->ProcessStopWaitInterval ());
if ($result != 0) {
    print STDERR "ERROR: The controller returned $result\n";
    $status = 1;
}

# put some delay here.
sleep (10);

# invoking the controller again to stop the rategen
print "Invoking the controller to stop the first RateGen\n";
$controller = $tg_executor->CreateProcess ("$controller_exec", "-k file://RateGen.ior -f");
$result = $controller->SpawnWaitKill ($tg_executor->ProcessStopWaitInterval ());
if ($result != 0) {
    print STDERR "ERROR: The controller returned $result\n";
    $status = 1;
}exit $status;