summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/CosEC/RtEC_Based/tests/Multiple/run_test2.pl
blob: aace5ca57de257d020d32b6ce4c590da8a66ccfb (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
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

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

use lib "../../../../../../../bin";

require ACEutils;
use Cwd;

$con_count = 10;
$sup_count = 10;
$ev_count = 8;
$status = 0;
$port = ACE::uniqueid () + 10001;  # This can't be 10000 on Chorus 4.0

ACE::checkForTarget(getcwd());

sub cosec_multiple_test2
{
    # first start the Naming service..
    $SV1 = Process::Create ($EXEPREFIX."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."Naming_Service".$DIR_SEPARATOR
			    ."Naming_Service".$EXE_EXT,
                            "-o ns.ior");

    sleep 10;

    # now start the Rt EC..
    $SV2 = Process::Create ($EXEPREFIX."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."Event_Service".$DIR_SEPARATOR
			    ."Event_Service".$EXE_EXT,
			    "-t new -ORBInitRef NameService=file://ns.ior");

    sleep 10;

    # now start the CosEC1..
    $SV3 = Process::Create ($EXEPREFIX."..".$DIR_SEPARATOR
			    ."..".$DIR_SEPARATOR
			    ."bin".$DIR_SEPARATOR
			    ."RtEC_Based_CosEC".$EXE_EXT,
			    "-ORBInitRef NameService=file://ns.ior"
			    ." $CosEC1_params");

    sleep 10;

    # now start the consumers
    for ($cntr1 = 0; $cntr1 < $con_count ; $cntr1+=1)
    {
        print "creating consumer# $cntr1\n";
        $CONS = Process::Create ($EXEPREFIX."Consumer".$EXE_EXT,
                                 "-ORBInitRef NameService=file://ns.ior"
				 ." -c $ev_count");
        sleep 10;
    }


    # now start the suppliers
    for ($cntr2 = 0; $cntr2 < $con_count ; $cntr2+=1)
    {
        print "creating supplier# $cntr2\n";
        $SUPP = Process::Create ($EXEPREFIX."Supplier".$EXE_EXT,
                                 "-ORBInitRef NameService=file://ns.ior"
				 ." -c $ev_count");
        sleep 10;
    }

    print "waiting for the last supplier to finish\n";
    if ($SUPP->TimedWait (60) == -1) {
      print STDERR "ERROR: supplier timedout\n";
      $status = 1;
      $SUPP->Kill (); $SUPP->TimedWait (1);
    }


    print "waiting for the last consumer to finish\n";
    if ($CONS->TimedWait (60) == -1) {
      print STDERR "ERROR: consumer timedout\n";
      $status = 1;
      $CONS->Kill (); $CONS->TimedWait (1);
    }


    print "cleanup...\n";
    $SV1->Kill ();
    $SV2->Kill ();
    $SV3->Kill ();

    $SV1->TimedWait (1);
    $SV2->TimedWait (1);
    $SV3->TimedWait (1);

    print "done!.\n";
}

# Parse the arguments

for ($i = 0; $i <= $#ARGV; $i++)
{
  SWITCH:
  {
    if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?")
    {
        print "usage: run_test2.pl [-chorus <target>] -e event_count -c consumers -s suppliers -h help\n";
        exit;
    }
    if ($ARGV[$i] eq "-e")
    {
        $ev_count = $ARGV[$i + 1];
        $i++;
        last SWITCH;
    }
    if ($ARGV[$i] eq "-c")
    {
        $con_count = $ARGV[$i + 1];
        $i++;
        last SWITCH;
    }
    if ($ARGV[$i] eq "-s")
    {
        $sup_count = $ARGV[$i + 1];
        $i++;
        last SWITCH;
    }
  }
}


cosec_multiple_test2 ();

exit $status;