1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
7 use lib
"$ENV{ACE_ROOT}/bin";
8 use PerlACE
::TestTarget
;
13 # Amount of delay (in microseconds) that the sink-server delays a client reply.
16 # Number of calls a client makes to the AMH server
19 $conf = $PerlACE::svcconf_ext
;
27 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
28 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
31 # File used to pass AMH server ior to its clients.
32 my $iorbase = "amh.ior";
33 my $server_iorfile = $server->LocalFile ($iorbase);
34 my $client_iorfile = $client->LocalFile ($iorbase);
35 $server->DeleteFile($iorbase);
36 $client->DeleteFile($iorbase);
38 my $server_conf = $server->LocalFile ("st_server" . $conf);
40 $SV = $server->CreateProcess ("st_server",
41 "-ORBdebuglevel $debug_level " .
42 "-ORBsvcconf $server_conf " .
43 "-o $server_iorfile " .
46 $CL = $client->CreateProcess ("client",
47 "-k file://$client_iorfile " .
51 print STDERR
"\n Starting AMH Sink Server with $delay_time microseconds delayed response: \n\n";
53 $server_status = $SV->Spawn ();
55 if ($server_status != 0) {
56 print STDERR
"ERROR: server returned $server_status\n";
60 if ($server->WaitForFileTimed ($iorbase,
61 $server->ProcessStartWaitInterval()) == -1) {
62 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
63 $SV->Kill (); $SV->TimedWait (1);
67 if ($server->GetFile ($iorbase) == -1) {
68 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
69 $SV->Kill (); $SV->TimedWait (1);
72 if ($client->PutFile ($iorbase) == -1) {
73 print STDERR
"ERROR: cannot set file <$client_iorfile>\n";
74 $SV->Kill (); $SV->TimedWait (1);
79 print STDERR
"\n Client making $iterations calls to server: \n";
80 $evt_per_sec = 1000/$delay_time/1000;
81 print STDERR
"\n(Expect less than $evt_per_sec Events/sec) \n\n";
83 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 60);
85 if ($client_status != 0) {
86 print STDERR
"ERROR: client returned $client_status\n";
90 $server_status = $SV->TerminateWaitKill ($server->ProcessStopWaitInterval());
92 if ($server_status != 0) {
93 print STDERR
"ERROR: server returned $server_status\n";
97 $server->DeleteFile($iorbase);
98 $client->DeleteFile($iorbase);