blob: 7035cec2bcf874cf588205190ab4ddd17cc5c803 (
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
|
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;
$CIAO_ROOT = "$ENV{'CIAO_ROOT'}";
$TAO_ROOT = "$ENV{'TAO_ROOT'}";
$DAnCE = "$ENV{'DANCE_ROOT'}";
$daemons_running = 0;
$daemons = 1;
@ports = ( 60001 );
@iorfiles = ( "NodeApp1.ior" );
@nodenames = ( "Node" );
$status = 0;
PerlACE::add_lib_path ('../Components');
$E = 0;
$EM = 0;
# Delete if there are any .ior files.
sub delete_ior_files {
for ($i = 0; $i < $daemons; ++$i) {
unlink $iorfiles[$i];
}
}
sub kill_node_daemons {
for ($i = 0; $i < $daemons; ++$i) {
$Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1);
}
}
sub kill_open_processes {
if ($daemons_running == 1) {
kill_node_daemons ();
}
}
sub run_node_daemons {
for ($i = 0; $i < $daemons; ++$i)
{
$iorfile = $iorfiles[$i];
$port = $ports[$i];
$nodename = $nodenames[$i];
$iiop = "iiop://localhost:$port";
$node_app = "$CIAO_ROOT/bin/ciao_componentserver";
$d_cmd = "$DAnCE/bin/dance_node_manager";
$d_param = "-ORBEndpoint $iiop -s $node_app -n $nodename=$iorfile -t 30";
$Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param);
$result = $Daemons[$i]->Spawn ();
push(@processes, $Daemons[$i]);
if (PerlACE::waitforfile_timed ($iorfile,
30) == -1) {
print STDERR
"ERROR: The ior $iorfile file of node daemon $i could not be found\n";
for (; $i >= 0; --$i) {
$Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1);
}
return -1;
}
}
return 0;
}
if ($#ARGV == -1)
{
opendir(DIR, ".");
@files = grep(/\.cdp$/,readdir(DIR));
closedir(DIR);
} else {
@files = @ARGV;
}
foreach $file (@files) {
delete_ior_files ();
print "Running test for plan $file\n";
# Invoke node daemons.
print "Invoking node daemon\n";
$status = run_node_daemons ();
if ($status != 0) {
print STDERR "ERROR: Unable to execute the node daemon\n";
kill_open_processes ();
exit 1;
}
$daemons_running = 1;
# Invoke executor - start the application -.
print "Launching the plan. file://NodeApp1.ior \n";
$E = new PerlACE::Process ("simple_nm_launcher",
"file://NodeApp1.ior $file");
$status = $E->SpawnWaitKill (5000);
if ($status != 0)
{
print "ERROR: simple_nm_launcher returned error status $status\n";
}
print "Test for plan $file succeeded\n";
kill_open_processes ();
}
exit $status;
|