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

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

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

$iorfile = "ior";

sub run_client
{
  my $args = shift;

  $CL = Process::Create ($EXEPREFIX."client$EXE_EXT ",
                         $args);

  $client = $CL->TimedWait (200);
  if ($client == -1) {
      $time = localtime;
      print STDERR "ERROR: client timedout at $time\n";
      $CL->Kill (); $CL->TimedWait (1);
  }
}

sub run_clients
{
  print STDERR "\n\n*** No event loop threads ***\n\n\n";

  print STDERR "\nSelect Reactor\n\n";

  run_client ("-e 0");

  print STDERR "\nTP Reactor\n\n";

  run_client ("-ORBsvcconf multi_threaded_event_loop.conf -e 0");

  print STDERR "\n\n*** Single-threaded client event loop: Select Reactor ***\n\n\n";

  print STDERR "\nSingle-threaded client running event loop for 3 seconds\n\n";

  run_client ("-e 1 -t 3000");

  print STDERR "\nSingle-threaded client running event loop for 10 seconds\n\n";

  run_client ("-e 1 -t 10000");

  print STDERR "\nSingle-threaded client running event loop for 20 seconds\n\n";

  run_client ("-e 1 -t 20000");

  print STDERR "\n\n*** Single-threaded client event loop: TP Reactor ***\n\n\n";

  print STDERR "\nSingle-threaded client running event loop for 3 seconds\n\n";

  run_client ("-ORBsvcconf multi_threaded_event_loop.conf -e 1 -t 3000");

  print STDERR "\nSingle-threaded client running event loop for 10 seconds\n\n";

  run_client ("-ORBsvcconf multi_threaded_event_loop.conf -e 1 -t 10000");

  print STDERR "\nSingle-threaded client running event loop for 20 seconds\n\n";

  run_client ("-ORBsvcconf multi_threaded_event_loop.conf -e 1 -t 20000");

  print STDERR "\n\n*** Multi-threaded client event loop: TP Reactor ***\n\n\n";

  print STDERR "\nMulti-threaded client running event loop for 3 seconds\n\n";

  run_client ("-ORBsvcconf multi_threaded_event_loop.conf -e 5 -t 3000");

  print STDERR "\nMulti-threaded client running event loop for 10 seconds\n\n";

  run_client ("-ORBsvcconf multi_threaded_event_loop.conf -e 5 -t 10000");

  print STDERR "\nMulti-threaded client running event loop for 20 seconds\n\n";

  run_client ("-ORBsvcconf multi_threaded_event_loop.conf -e 5 -t 20000 -x");
}

unlink $iorfile;

print STDERR "\n\n*** Single threaded server ***\n\n\n";

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

if (ACE::waitforfile_timed ($iorfile, 5) == -1) {
  print STDERR "ERROR: cannot find file <$iorfile>\n";
  $SV->Kill (); $SV->TimedWait (1);
  exit 1;
}

run_clients ();

$server = $SV->TimedWait (100);
if ($server == -1) {
  $time = localtime;
  print STDERR "ERROR: server timedout at $time\n";
  $SV->Kill (); $SV->TimedWait (1);
}

unlink $iorfile;

if ($server != 0 || $client != 0) {
  exit 1;
}

print STDERR "\n\n*** Thread-Pool server ***\n\n\n";

$SV = Process::Create ($EXEPREFIX."server$EXE_EXT",
                       "multi_threaded_event_loop.conf -e 5");

if (ACE::waitforfile_timed ($iorfile, 5) == -1) {
  print STDERR "ERROR: cannot find file <$iorfile>\n";
  $SV->Kill (); $SV->TimedWait (1);
  exit 1;
}

run_clients ();

$server = $SV->TimedWait (100);
if ($server == -1) {
  $time = localtime;
  print STDERR "ERROR: server timedout at $time\n";
  $SV->Kill (); $SV->TimedWait (1);
}

unlink $iorfile;

if ($server != 0 || $client != 0) {
  exit 1;
}

exit 0;