Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / Mixed_Sync_ASync_Events / run_test.pl
blob2bc9f4de55db369c38e0ed9b878ca1af5047b045
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";
14 $server_debug_level = '0';
15 $client_debug_level = '0';
17 foreach $i (@ARGV) {
18 if ($i eq '-debug') {
19 $server_debug_level = '10';
20 $client_debug_level = '10';
24 my $iorbase_master = "master.ior";
25 my $iorbase_slave = "slave.ior";
26 my $server_master_iorfile = $server->LocalFile ($iorbase_master);
27 my $server_slave_iorfile = $server->LocalFile ($iorbase_slave);
28 my $client_master_iorfile = $client->LocalFile ($iorbase_master);
29 my $client_slave_iorfile = $client->LocalFile ($iorbase_slave);
30 $server->DeleteFile($iorbase_master);
31 $server->DeleteFile($iorbase_slave);
32 $client->DeleteFile($iorbase_master);
33 $client->DeleteFile($iorbase_slave);
35 $SV = $server->CreateProcess ("tester", "-ORBdebuglevel $server_debug_level -o $server_slave_iorfile -k file://$server_master_iorfile");
37 $server_status = $SV->Spawn ();
39 if ($server_status != 0) {
40 print STDERR "ERROR: server returned $server_status\n";
41 exit 1;
44 if ($server->WaitForFileTimed ($iorbase_slave,
45 $server->ProcessStartWaitInterval()) == -1) {
46 print STDERR "ERROR: cannot find file <$server_slave_iorfile>\n";
47 $SV->Kill (); $SV->TimedWait (1);
48 exit 1;
50 if ($server->GetFile ($iorbase_slave) == -1) {
51 print STDERR "ERROR: cannot get file <$server_slave_iorfile>\n";
52 $SV->Kill (); $SV->TimedWait (1);
53 exit 1;
55 if ($client->PutFile ($iorbase_slave) == -1) {
56 print STDERR "ERROR: cannot set file <$client_slave_iorfile>\n";
57 $SV->Kill (); $SV->TimedWait (1);
58 exit 1;
61 $CL = $client->CreateProcess ("tester",
62 "-ORBdebuglevel $client_debug_level"
63 . " -o $client_master_iorfile"
64 . " -m -k file://$client_slave_iorfile ");
66 $client_status = $CL->Spawn ();
68 if ($client_status != 0) {
69 print STDERR "ERROR: client returned $client_status\n";
70 $status = 1;
73 if ($client->WaitForFileTimed ($iorbase_master,
74 $client->ProcessStartWaitInterval()) == -1) {
75 print STDERR "ERROR: cannot find file <$client_master_iorfile>\n";
76 $CL->Kill (); $CL->TimedWait (1);
77 exit 1;
79 if ($client->GetFile ($iorbase_master) == -1) {
80 print STDERR "ERROR: cannot get file <$client_master_iorfile>\n";
81 $CL->Kill (); $CL->TimedWait (1);
82 exit 1;
84 if ($server->PutFile ($iorbase_master) == -1) {
85 print STDERR "ERROR: cannot set file <$server_master_iorfile>\n";
86 $CL->Kill (); $CL->TimedWait (1);
87 exit 1;
90 $client_status = $CL->WaitKill ($client->ProcessStartWaitInterval());
92 if ($client_status != 0) {
93 print STDERR "ERROR: client returned $client_status\n";
94 $status = 1;
97 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
99 if ($server_status != 0) {
100 print STDERR "ERROR: server returned $server_status\n";
101 $status = 1;
104 $server->DeleteFile($iorbase_master);
105 $server->DeleteFile($iorbase_slave);
106 $client->DeleteFile($iorbase_master);
107 $client->DeleteFile($iorbase_slave);
109 exit $status;