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

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

use lib '../../../../bin';
use PerlACE::Run_Test;

my($debug) = 1;


my($factory1_ior) = PerlACE::LocalFile ("factory1.ior");
my($factory2_ior) = PerlACE::LocalFile ("factory2.ior");
my($replica1_ior) = PerlACE::LocalFile ("replica1.ior");
my($replica2_ior) = PerlACE::LocalFile ("replica2.ior");
my($data_file) = PerlACE::LocalFile ("persistent.dat");

unlink $factory1_ior;
unlink $factory2_ior;
unlink $replica1_ior;
unlink $replica2_ior;
unlink $data_file;
my($status) = 0;

my($SV1) = new PerlACE::Process ("release/ft_replica", "-o $factory1_ior -t $replica1_ior -q -f none");
my($SV2) = new PerlACE::Process ("release/ft_replica", "-o $factory2_ior -t $replica2_ior -q -f none");
my($CL) = new PerlACE::Process ("release/ft_client", "-f file://$replica1_ior -f file://$replica2_ior -c testscript");
#my($CL) = new PerlACE::Process ("release/ft_client", "-f file://$replica1_iogr -c testscript");

print "\nTest: Starting replica 1 " . $SV1->CommandLine . "\n" if ($debug);
$SV1->Spawn ();

print "waiting for replica 1's IOR\n" if ($debug);

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

print "\nTest: Starting replica 2 " . $SV2->CommandLine . "\n" if ($debug);
$SV2->Spawn ();

print "waiting for replica 2's IOR\n" if ($debug);
if (PerlACE::waitforfile_timed ($replica2_ior, 5) == -1) {
    print STDERR "TEST ERROR: cannot find replica 2 file <$replica2_ior>\n";
    $SV1->Kill (); $SV1->TimedWait (1);
    $SV2->Kill (); $SV2->TimedWait (1);
    exit 1;
}

print "\nTest: Starting client " . $CL->CommandLine . "\n" if ($debug);

$client = $CL->SpawnWaitKill (60);

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

print "wait for server 1.\n" if ($debug);
$server = $SV1->WaitKill (60);

print "wait for server 2.\n" if ($debug);
$server = $SV2->WaitKill (60);

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

if ($status == 0) {
print "Clean up scratch files\n" if ($debug);

unlink $factory1_ior;
unlink $factory2_ior;
unlink $replica1_ior;
unlink $replica2_ior;
unlink $data_file;
}

exit $status;