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

# This is a Perl script that runs the client and all the other servers that
# are needed

unshift @INC, '../../../../bin';
require Process;

$nsiorfile = "theior";

# amount of delay between running the servers

$sleeptime = 3;

# Get the userid (or ip on NT)

if ($^O eq "MSWin32")
{
  system ("ipconfig | find \"Address\">ipnum");

  open (IPNUM, "ipnum");

  read (IPNUM, $line, 80);

  ($junk, $ip1, $ip2, $ip3, $ip4) = split (/: (\d+)\.(\d+)\.(\d+)\.(\d+)/, $line);

  close IPNUM;

  system ("del /q ipnum");

  $uid = $ip4;
}
else
{
  $uid = getpwnam (getlogin ());
}

# variables for parameters

$nsport = 20000 + $uid;
$svport = 0; 

# other variables

$n = 1;
$leave = 1;
$ior = 0;
$done = "";
$debug = "";
$cm = "";
$sm = "";
$other = "";
$c_conf = "client.conf";
$s_conf = "server.conf";

sub read_nsior
{
  open (FH, "<$nsiorfile");

  read (FH, $ior, 255);

  close (FH);
}

sub name_server
{
  my $args = "$other -ORBport $nsport -ORBobjrefstyle url -o $nsiorfile";
  my $prog = "..$DIR_SEPARATOR..$DIR_SEPARATOR"."Naming_Service".$DIR_SEPARATOR.
      "Naming_Service".$Process::EXE_EXT;

  $NS = Process::Create ($prog, $args);
}

sub server
{
    my $args = "";
    my $prog = "server".$Process::EXE_EXT;
    
    $SV = Process::Create ($prog, $args);
}

sub client
{
    my $args = "";
    my $prog = "client".$Process::EXE_EXT;
    
    $CL = Process::Create ($prog, $args);
}

name_server ();
sleep $sleeptime;
read_nsior ();

server ();

sleep $sleeptime;

client ();

sleep $sleeptime;
if ($leave)
{
  $SV->Kill ();
  $NS->Kill ();
  $CL->Kill ();
}


if ($^O eq "MSWin32")
{
  system ("del /q $nsiorfile");
}
else
{
  system ("rm $nsiorfile");
}