summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/ImplRepo/run_test.pl
blob: ef900cfe40ee14b85108003e5e8ac763999e8ddf (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#$Id$
# -*- perl -*-
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

use lib "../../../../bin";

require ACEutils;

$airplane_ior = "airplane.ior";
$simple_ior = "simple.ior";
$implrepo_ior = "implrepo.ior";

# Make sure the files are gone, so we can wait on them.
unlink $airplane_ior;
unlink $simple_ior;
unlink $implrepo_ior;

# The Tests

sub airplane_test
{
  $SV = Process::Create ($EXEPREFIX."airplane_server".$Process::EXE_EXT,
                         "-o $airplane_ior -r");

  ACE::waitforfile ($airplane_ior);

  $status = system ($EXEPREFIX."airplane_client".$Process::EXE_EXT.
                    " -f $airplane_ior");

  $SV->Kill (); $SV->Wait ();
  unlink $airplane_ior;
}

sub airplane_ir_test
{
  $IR = Process::Create ("..".$DIR_SEPARATOR."..".$DIR_SEPARATOR."ImplRepo_Service".$DIR_SEPARATOR."ImplRepo_Service".$Process::EXE_EXT, 
                         "-ORBsvcconf implrepo.conf -ORBobjrefstyle url -d 0");

  ACE::waitforfile ($implrepo_ior);

  $SV = Process::Create ($EXEPREFIX."airplane_server".$Process::EXE_EXT,
                         "-o $airplane_ior -i -r -ORBobjrefstyle url");

  ACE::waitforfile ($airplane_ior);

  system($EXEPREFIX."airplane_client -f $airplane_ior -ORBobjrefstyle url");

  $IR->Kill (); $IR->Wait ();
}

sub simple_test
{
  $SV = Process::Create ($EXEPREFIX."server".$Process::EXE_EXT,
                         "-o $simple_ior");

  ACE::waitforfile ($simple_ior);

  $status = system ($EXEPREFIX."client".$Process::EXE_EXT.
                    " -f $simple_ior");

  $SV->Kill (); $SV->Wait ();

  unlink $simple_ior;
}

sub implrepo_test
{
  $IR = Process::Create ("..".$DIR_SEPARATOR."..".$DIR_SEPARATOR."ImplRepo_Service".$DIR_SEPARATOR."ImplRepo_Service".$Process::EXE_EXT, 
                         "-ORBsvcconf implrepo.conf");

  ACE::waitforfile ("implrepo.ior");

  system ($EXEPREFIX."server -r -o svr.ior");

  $SV = Process::Create ($EXEPREFIX."server".$Process::EXE_EXT, "");

  sleep $ACE::sleeptime;

  $PSV = Process::Create ($EXEPREFIX."airplane_server".$Process::EXE_EXT,
                          "-o $airplane_ior -i -r");

  ACE::waitforfile ($airplane_ior);

  $PCL = Process::Create ($EXEPREFIX."airplane_client".$Process::EXE_EXT,
                          " -f $airplane_ior");

  system ($EXEPREFIX."client -f svr.ior");

  $IR->Kill (); $IR->Wait ();
}

sub implrepo2_test
{
  $IR = Process::Create ("..".$DIR_SEPARATOR."..".$DIR_SEPARATOR."ImplRepo_Service".$DIR_SEPARATOR."ImplRepo_Service".$Process::EXE_EXT, 
                         "-ORBsvcconf implrepo.conf");

  ACE::waitforfile ("implrepo.ior");

  system ($EXEPREFIX."server -r -o svr.ior");

  $SV = Process::Create ($EXEPREFIX."server".$Process::EXE_EXT, "");

  sleep $ACE::sleeptime;

  $PSV = Process::Create ($EXEPREFIX."airplane_server".$Process::EXE_EXT,
                          "-o $airplane_ior -i -r");

  ACE::waitforfile ($airplane_ior);

  $PCL = Process::Create ($EXEPREFIX."client".$Process::EXE_EXT,
                          " -f $svr_ior");

  system ($EXEPREFIX."airplane_client -f $airplane_ior");

  $IR->Kill (); $IR->Wait ();
}



# Parse the arguments

for ($i = 0; $i <= $#ARGV; $i++)
{
  SWITCH:
  {
    if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?")
    {
      print "run_test test1 test2...\n";
      print "\n";
      print "test1               -- Runs a specific test\n";
      print "                       airplane, simple, or implrepo\n";
      exit;
    }
    if ($ARGV[$i] eq "airplane")
    {
      airplane_test ();    
      last SWITCH;
    }
    if ($ARGV[$i] eq "airplane_ir")
    {
      airplane_ir_test ();    
      last SWITCH;
    }
    if ($ARGV[$i] eq "simple")
    {
      simple_test ();    
      last SWITCH;
    }
    if ($ARGV[$i] eq "implrepo")
    {
      implrepo_test ();    
      last SWITCH;
    }
    if ($ARGV[$i] eq "implrepo2")
    {
      implrepo2_test ();    
      last SWITCH;
    }


    print "run_test: Unknown Option: ".$ARGV[$i]."\n";
  }
}