Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Mixed_Sync_ASync_Events / run_exclusive_rw.pl
blob2d3bc44c32b2d71a497c5ff54e0873584e67da4b
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 = "exclusive_rw$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;
19 $server_conf = $server->LocalFile ($client_conf_base);
20 if ($server->PutFile ($client_conf_base) == -1) {
21 print STDERR "ERROR: cannot set file <$server_conf>\n";
22 exit 1;
25 $server_debug_level = '0';
26 $client_debug_level = '0';
28 foreach $i (@ARGV) {
29 if ($i eq '-debug') {
30 $server_debug_level = '10';
31 $client_debug_level = '10';
35 my $iorbase_master = "master.ior";
36 my $iorbase_slave = "slave.ior";
37 my $server_master_iorfile = $server->LocalFile ($iorbase_master);
38 my $server_slave_iorfile = $server->LocalFile ($iorbase_slave);
39 my $client_master_iorfile = $client->LocalFile ($iorbase_master);
40 my $client_slave_iorfile = $client->LocalFile ($iorbase_slave);
41 $server->DeleteFile($iorbase_master);
42 $server->DeleteFile($iorbase_slave);
43 $client->DeleteFile($iorbase_master);
44 $client->DeleteFile($iorbase_slave);
46 $SV = $server->CreateProcess ("tester", "-ORBsvcconf $server_conf -ORBdebuglevel $server_debug_level -o $server_slave_iorfile -k file://$server_master_iorfile");
48 $server_status = $SV->Spawn ();
50 if ($server_status != 0) {
51 print STDERR "ERROR: server returned $server_status\n";
52 exit 1;
55 if ($server->WaitForFileTimed ($iorbase_slave,
56 $server->ProcessStartWaitInterval()) == -1) {
57 print STDERR "ERROR: cannot find file <$server_slave_iorfile>\n";
58 $SV->Kill (); $SV->TimedWait (1);
59 exit 1;
61 if ($server->GetFile ($iorbase_slave) == -1) {
62 print STDERR "ERROR: cannot get file <$server_slave_iorfile>\n";
63 $SV->Kill (); $SV->TimedWait (1);
64 exit 1;
66 if ($client->PutFile ($iorbase_slave) == -1) {
67 print STDERR "ERROR: cannot set file <$client_slave_iorfile>\n";
68 $SV->Kill (); $SV->TimedWait (1);
69 exit 1;
72 $CL = $client->CreateProcess ("tester",
73 "-ORBsvcconf $client_conf "
74 . "-ORBdebuglevel $client_debug_level"
75 . " -o $client_master_iorfile"
76 . " -m -k file://$client_slave_iorfile ");
78 $client_status = $CL->Spawn ();
80 if ($client_status != 0) {
81 print STDERR "ERROR: client returned $client_status\n";
82 $status = 1;
85 if ($client->WaitForFileTimed ($iorbase_master,
86 $client->ProcessStartWaitInterval()) == -1) {
87 print STDERR "ERROR: cannot find file <$client_master_iorfile>\n";
88 $CL->Kill (); $CL->TimedWait (1);
89 exit 1;
91 if ($client->GetFile ($iorbase_master) == -1) {
92 print STDERR "ERROR: cannot get file <$client_master_iorfile>\n";
93 $CL->Kill (); $CL->TimedWait (1);
94 exit 1;
96 if ($server->PutFile ($iorbase_master) == -1) {
97 print STDERR "ERROR: cannot set file <$server_master_iorfile>\n";
98 $CL->Kill (); $CL->TimedWait (1);
99 exit 1;
102 $client_status = $CL->WaitKill ($client->ProcessStartWaitInterval());
104 if ($client_status != 0) {
105 print STDERR "ERROR: client returned $client_status\n";
106 $status = 1;
109 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
111 if ($server_status != 0) {
112 print STDERR "ERROR: server returned $server_status\n";
113 $status = 1;
116 $server->DeleteFile($iorbase_master);
117 $server->DeleteFile($iorbase_slave);
118 $client->DeleteFile($iorbase_master);
119 $client->DeleteFile($iorbase_slave);
121 exit $status;