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

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

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

# amount of delay between running the servers

$sleeptime = 5;
$distributor_time = 8;
$sender_time = 8;
$status = 0;

$nsior = PerlACE::LocalFile ("ns.ior");
$testfile = PerlACE::LocalFile ("output");

# generate test stream data
$input = PerlACE::generate_test_file("test_input", 102400);

unlink $nsior;

$NS  = new PerlACE::Process ("../../../Naming_Service/Naming_Service", "-ORBDottedDecimalAddresses 1 -o $nsior");
$SV1  = new PerlACE::Process ("sender", "-ORBDottedDecimalAddresses 1 ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s sender -r 30 -f $input");
$SV2  = new PerlACE::Process ("sender", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s sender -r 30 -f $input");
$SV3  = new PerlACE::Process ("sender", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s sender -r 30 -f $input");
$RE1 = new PerlACE::Process ("receiver", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s distributer -r receiver1 -f output1");
$RE2 = new PerlACE::Process ("receiver", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s distributer -r receiver2 -f output2");
$DI1 = new PerlACE::Process ("distributer", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s sender -r distributer");
$DI2 = new PerlACE::Process ("distributer", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s sender -r distributer");
$DI3 = new PerlACE::Process ("distributer", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s sender -r distributer");
$DI4 = new PerlACE::Process ("distributer", " -ORBDottedDecimalAddresses 1 -ORBSvcConf components_svc$PerlACE::svcconf_ext -ORBInitRef NameService=file://$nsior -s sender -r distributer");

print STDERR "\nReceiver 1 --> Receiver 2 --> Distributer 1 --> Sender1 --> Distributer 2 --> Distributer 3 --> Sender2 --> Sender3 --> Distributer4\n\n";

print STDERR "Starting Naming Service\n";

$NS->Spawn ();

if (PerlACE::waitforfile_timed ($nsior, 10) == -1) {
    print STDERR "ERROR: cannot find naming service IOR file\n";
    $NS->Kill ();
    exit 1;
}

print STDERR "Starting Receiver 1\n";

$RE1->Spawn ();

sleep $sleeptime;

print STDERR "Starting Receiver 2\n";

$RE2->Spawn ();

sleep $sleeptime;

print STDERR "Starting Distributer 1\n";

$DI1->Spawn ();

sleep $sleeptime;

print STDERR "Starting Sender1\n";

$SV1->Spawn ();

sleep $distributor_time;

print STDERR "\nStarting Distributer 2\n\n";

$DI2->Spawn ();

sleep $distributor_time;

print STDERR "\nStarting Distributer 3\n\n";

$DI3->Spawn ();

sleep $sender_time;

print STDERR "Starting Sender2\n";

$SV2->Spawn ();

sleep $sender_time;

print STDERR "Starting Sender3\n";

$SV3->Spawn ();

sleep $distributor_time;

print STDERR "\nStarting Distributer 4\n\n";

$DI4->Spawn ();

$SV2->WaitKill (300);

$SV3->WaitKill (300);

$SV1->WaitKill ( 300 );

$distributer3 = $DI3->TerminateWaitKill (5);

if ($distributer3 != 0) {
    print STDERR "ERROR: distributer3 returned $distributer3\n";
    $status = 1;
}

$distributer2 = $DI2->TerminateWaitKill (5);

if ($distributer2 != 0) {
    print STDERR "ERROR: distributer2 returned $distributer2\n";
    $status = 1;
}

$distributer1 = $DI1->TerminateWaitKill (5);

if ($distributer1 != 0) {
    print STDERR "ERROR: distributer1 returned $distributer1\n";
    $status = 1;
}

$receiver1 = $RE1->TerminateWaitKill (5);

if ($receiver1 != 0) {
    print STDERR "ERROR: receiver1 returned $receiver1\n";
    $status = 1;
}

$receiver2 = $RE2->TerminateWaitKill (5);

if ($receiver2 != 0) {
    print STDERR "ERROR: receiver2 returned $receiver2\n";
    $status = 1;
}

$distributer4 = $DI4->TerminateWaitKill (5);
if ($distributer4 != 0) {
    print STDERR "ERROR: distributer4 returned $distributer4\n";
    $status = 1;
}

$nserver = $NS->TerminateWaitKill (5);

if ($nserver != 0) {
    print STDERR "ERROR: Naming Service returned $nserver\n";
    $status = 1;
}

unlink $nsior;
unlink $testfile, $input;

exit $status;