summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/tests/CosEvent/Timeout/run_test.pl
blob: 31bb090e606c5680a6afd5ddf64ebc26967fa45d (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
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;
# $Id$

use Env (ACE_ROOT);
use lib "$ACE_ROOT/bin";
use PerlACE::Run_Test;

$nsiorfile = PerlACE::LocalFile ("ns.ior");
$esiorfile = PerlACE::LocalFile ("es.ior");
$arg_ns_ref = "-ORBInitRef NameService=file://$nsiorfile";

$status = 0;

unlink $nsiorfile;
unlink $esiorfile;

# start Naming Service

$NameService = "$PerlACE::TAO_ROOT/orbsvcs/Naming_Service/Naming_Service";
$NS = new PerlACE::Process($NameService, "-o $nsiorfile");
$NS->Spawn();
if (PerlACE::waitforfile_timed ($nsiorfile, 5) == -1) {
    print STDERR "ERROR: cannot find file <$nsiorfile>\n";
    $NS->Kill();
    exit 1;
}

# start Event Service
$EventService = "$PerlACE::TAO_ROOT/orbsvcs/CosEvent_Service/CosEvent_Service";
$ES = new PerlACE::Process($EventService, "-ORBSvcConf cosevent.conf "
                                          ."-b -o $esiorfile $arg_ns_ref");
$ES->Spawn();
if (PerlACE::waitforfile_timed ($esiorfile, 5) == -1) {
    print STDERR "ERROR: cannot find file <$esiorfile>\n";
    $ES->Kill();
    unlink $nsiorfile;
    exit 1;
}


$S = new PerlACE::Process("TimeoutTest", "-supplier -consumer -hang "
                          . $arg_ns_ref);
$ret = $S->SpawnWaitKill(30);
if ($ret != 0) {
    print STDERR "ERROR: application returned $ret\n";
    $status = 1;
}

$ret = $ES->Kill();
if ($ret != 0) {
    print STDERR "ERROR: event channel returned $ret\n";
    $status = 1;
}

$ret = $NS->Kill();
if ($ret != 0) {
    print STDERR "ERROR: name service returned $ret\n";
    $status = 1;
}

unlink $nsiorfile;
unlink $esiorfile;

exit $status;