Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / AMI / run_mt_noupcall.pl
blob831590e30402bfff83a5c0430c373e6919f25ce8
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
10 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
11 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
13 $client_conf_base = "mt_noupcall$PerlACE::svcconf_ext";
14 $client_conf = $client->LocalFile ($client_conf_base);
15 if ($client->PutFile ($client_conf_base) == -1) {
16 print STDERR "ERROR: cannot set file <$client_conf>\n";
17 exit 1;
20 $server_debug_level = '0';
21 $client_debug_level = '0';
22 $iterations = '1';
24 foreach $i (@ARGV) {
25 if ($i eq '-debug') {
26 $server_debug_level = '1';
27 $client_debug_level = '1';
31 my $iorbase = "server.ior";
32 my $server_iorfile = $server->LocalFile ($iorbase);
33 my $client_iorfile = $client->LocalFile ($iorbase);
34 $server->DeleteFile($iorbase);
35 $client->DeleteFile($iorbase);
37 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $server_debug_level -o $server_iorfile");
39 $server_status = $SV->Spawn ();
41 if ($server_status != 0) {
42 print STDERR "ERROR: server returned $server_status\n";
43 exit 1;
46 if ($server->WaitForFileTimed ($iorbase,
47 $server->ProcessStartWaitInterval()) == -1) {
48 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
49 $SV->Kill (); $SV->TimedWait (1);
50 exit 1;
52 if ($server->GetFile ($iorbase) == -1) {
53 print STDERR "ERROR: cannot get file <$server_iorfile>\n";
54 $SV->Kill (); $SV->TimedWait (1);
55 exit 1;
57 if ($client->PutFile ($iorbase) == -1) {
58 print STDERR "ERROR: cannot set file <$client_iorfile>\n";
59 $SV->Kill (); $SV->TimedWait (1);
60 exit 1;
63 $CL = $client->CreateProcess ("simple_client",
64 "-ORBsvcconf $client_conf "
65 . "-ORBdebuglevel $client_debug_level"
66 . " -k file://$client_iorfile "
67 . " -i $iterations -d -x");
69 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval());
71 if ($client_status != 0) {
72 print STDERR "ERROR: client returned $client_status\n";
73 $status = 1;
76 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
78 if ($server_status != 0) {
79 print STDERR "ERROR: server returned $server_status\n";
80 $status = 1;
83 $server->DeleteFile($iorbase);
84 $client->DeleteFile($iorbase);
86 exit $status;