summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/RtEC/Simple/run_test.pl
blob: 5b00af5aab481fdcd44eac3922407a02eee151ee (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
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

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

unshift @INC, '../../../../../bin';
require Process;
require ACEutils;

$iorfile = "ec.ior";

unlink $iorfile;

$T = Process::Create ($EXEPREFIX."Service".$EXE_EXT,
		      " -ORBsvcconf ec.conf -o $iorfile");

if (ACE::waitforfile_timed ($iorfile, 15) == -1) {
  print STDERR "ERROR: cannot find file <$iorfile>\n";
  $NS->Kill (); $NS->TimedWait (1);
  exit 1;
}

$C = Process::Create ($EXEPREFIX."Consumer".$EXE_EXT,
		      " file://$iorfile");

sleep 5;

$S = Process::Create ($EXEPREFIX."Supplier".$EXE_EXT,
		      " file://$iorfile");

if ($S->TimedWait (120) == -1) {
  print STDERR "ERROR: supplier timedout\n";
  $S->Kill (); $S->TimedWait (1);
  $C->Kill (); $C->TimedWait (1);
  $T->Kill (); $T->TimedWait (1);
  exit 1;
}

if ($C->TimedWait (15) == -1) {
  print STDERR "ERROR: consumer timedout\n";
  $C->Kill (); $C->TimedWait (1);
  $T->Kill (); $T->TimedWait (1);
  exit 1;
}

$T->Terminate (); if ($T->TimedWait (5) == -1) {
  print STDERR "ERROR: cannot terminate service\n";
  $T->Kill (); $T->TimedWait (1);
  exit 1;
}

unlink $iorfile;

exit 0;