summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/ImplRepo/NameService/run_test.pl
blob: 037a604d364bf3352c352e6056ad102858571a56 (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
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;

################################################################################
# Program locations

$imr_ior = PerlACE::LocalFile ("imr.ior");
$name_ior = PerlACE::LocalFile ("name.ior");
$activator_ior = PerlACE::LocalFile("activator.ior");

$IMR = new PerlACE::Process ("../../../ImplRepo_Service/ImplRepo_Service");
$ACTIVATOR = new PerlACE::Process("../../../ImplRepo_Service/ImR_Activator");
$NS  = new PerlACE::Process ("../../../Naming_Service/Naming_Service");
$TAO_IMR = new PerlACE::Process ("../../../../../bin/tao_imr");

$TEST = new PerlACE::Process ("test");

$imr_init_ref = "-ORBInitRef ImplRepoService=file://$imr_ior";

################################################################################

$errors = 0;

unlink $imr_ior;
unlink $name_ior;

################################################################################
## Start the implementation Repository

$IMR->Arguments ("-o $imr_ior -d 1");
$IMR->Spawn ();

if (PerlACE::waitforfile_timed ($imr_ior, 10) == -1) {
    print STDERR "ERROR: waiting for $imr_ior\n";
    $IMR->Kill ();
    exit 1;
}

$ACTIVATOR->Arguments("-d 1 -o $activator_ior $imr_init_ref");
$ACTIVATOR->Spawn();

if (PerlACE::waitforfile_timed ($activator_ior, 10) == -1) {
    print STDERR "ERROR: waiting for $activator_ior\n";
    $IMR->Kill ();
    $ACTIVATOR->Kill();
    exit 1;
}

################################################################################
## Register the NameService

$TAO_IMR->Arguments("$imr_init_ref"
                    . " add NameService "
                    ." -c \"" . $NS->Executable ()
                       ." $imr_init_ref"
                       ." -ORBUseIMR 1 .\"");

$taoimr = $TAO_IMR->SpawnWaitKill (60);

if ($taoimr != 0) {
    print STDERR "ERROR: tao_imr (add) returned $taoimr\n";
    ++$errors;
}

################################################################################
## Create IOR for NameService

$TAO_IMR->Arguments ("$imr_init_ref ior NameService -f $name_ior");


$taoimr = $TAO_IMR->SpawnWaitKill (60);

if ($taoimr != 0) {
    print STDERR "ERROR: tao_imr (ior) returned $taoimr\n";
    ++$errors;
}

################################################################################
## Run the test

$TEST->Arguments ("-ORBInitRef NameService=file://$name_ior");

$test = $TEST->SpawnWaitKill (60);

if ($test != 0) {
    print STDERR "ERROR: test returned $test\n";
    ++$errors;
}


################################################################################
## Shutdown the NameService

$TAO_IMR->Arguments ("-ORBInitRef ImplRepoService=file://$imr_ior shutdown "
                     . "NameService ");

$taoimr = $TAO_IMR->SpawnWaitKill (60);

if ($taoimr != 0) {
    print STDERR "ERROR: tao_imr (shutdown) returned $taoimr\n";
    ++$errors;
}

################################################################################
## Kill the IMR

$iserver = $ACTIVATOR->TerminateWaitKill (5);

if ($iserver != 0) {
    print STDERR "ERROR: ImR_Activator returned $iserver\n";
    ++$errors;
}

$iserver = $IMR->TerminateWaitKill (5);

if ($iserver != 0) {
    print STDERR "ERROR: IMR returned $iserver\n";
    ++$errors;
}

exit $errors;