summaryrefslogtreecommitdiff
path: root/TAO/tests/NestedUpcall/MT_Client_Test/run_test.pl
blob: 4b3ca7cc204b9b6cdad24fead1762941d98e439a (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
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;

$ior1file = "server1.ior";
$ior2file = "server2.ior";

# Make sure the files are gone
unlink $ior1file;
unlink $ior2file;

$SV1 = Process::Create ($EXEPREFIX."server".$Process::EXE_EXT,
                        " -o $ior1file ");

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

$SV2 = Process::Create ($EXEPREFIX."server".$Process::EXE_EXT,
                        " -o $ior2file ");

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

$CL = Process::Create ($EXEPREFIX."client".$Process::EXE_EXT,
                       " -f $ior1file -g $ior2file -n 2 -i 10 -s 5");

$client = $CL->TimedWait (60);
if ($client == -1) {
    print STDERR "ERROR: client timedout\n";
    $CL->Kill (); $CL->TimedWait (1);
}

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

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

# Clean up
unlink $ior1file;
unlink $ior2file;

if ($client == -1 || $server1 == -1 || $server2 == -1) {
    exit 1;
}

exit 0;