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
;
19 # Current supported forward once exceptions:
20 # EF_OBJECT_NOT_EXIST = 0x1,
21 # EF_COMM_FAILURE = 0x2,
23 # EF_INV_OBJREF = 0x8,
25 description
=> "case 1: not forward upon OBJECT_NOT_EXIST exception",
26 orb_exception_forward_opt
=> "-ORBForwardOnceOnObjectNotExist 0",
28 client_expect_num_ex
=> "1",
29 client_expect_ex_kind
=> "1",
30 server_raise_ex_kind
=> "1",
33 description
=> "case 2: default Fault Tolerant always forward upon COMM_FAILURE exception",
34 orb_exception_forward_opt
=> "-ORBForwardOnceOnCommFailure 0",
36 client_expect_num_ex
=> "0",
37 client_expect_ex_kind
=> "0",
38 server_raise_ex_kind
=> "2",
39 servant_calls
=> "0", # use 0 to indicate request looping case
41 description
=> "case 3: default Fault Tolerant always forward upon TRANSIENT exception",
42 orb_exception_forward_opt
=> "-ORBForwardOnceOnTransient 0",
44 client_expect_num_ex
=> "0",
45 client_expect_ex_kind
=> "0",
46 server_raise_ex_kind
=> "4",
47 servant_calls
=> "0", # use 0 to indicate request looping case
49 description
=> "case 4: not forward upon INV_OBJREF exception",
50 orb_exception_forward_opt
=> "-ORBForwardOnceOnInvObjref 0",
52 client_expect_num_ex
=> "1",
53 client_expect_ex_kind
=> "8",
54 server_raise_ex_kind
=> "8",
57 description
=> "case 5: forward once upon OBJECT_NOT_EXIST exception",
58 orb_exception_forward_opt
=> "-ORBForwardOnceOnObjectNotExist 1",
60 client_expect_num_ex
=> "4",
61 client_expect_ex_kind
=> "1",
62 server_raise_ex_kind
=> "1",
63 servant_calls
=> "5", # 4 requests + 1 forward
65 description
=> "case 6: forward once upon COMM_FAILURE exception",
66 orb_exception_forward_opt
=> "-ORBForwardOnceOnCommFailure 1",
68 client_expect_num_ex
=> "4",
69 client_expect_ex_kind
=> "2",
70 server_raise_ex_kind
=> "2",
71 servant_calls
=> "5", # 4 requests + 1 forward
73 description
=> "case 7: forward once upon TRANSIENT exception",
74 orb_exception_forward_opt
=> "-ORBForwardOnceOnTransient 1",
76 client_expect_num_ex
=> "4",
77 client_expect_ex_kind
=> "4",
78 server_raise_ex_kind
=> "4",
79 servant_calls
=> "5", # 4 requests + 1 forward
81 description
=> "case 8: forward once upon INV_OBJREF exception",
82 orb_exception_forward_opt
=> "-ORBForwardOnceOnInvObjref 1",
84 client_expect_num_ex
=> "4",
85 client_expect_ex_kind
=> "8",
86 server_raise_ex_kind
=> "8",
87 servant_calls
=> "5", # 4 requests + 1 forward
91 my $server = PerlACE
::TestTarget
::create_target
(1) || die "Create target 1 failed\n";
92 my $client = PerlACE
::TestTarget
::create_target
(2) || die "Create target 2 failed\n";
94 my $iorbase = "test.ior";
95 my $host = $server->HostName();
96 my $server_iorfile = $server->LocalFile ($iorbase);
97 my $client_iorfile = $client->LocalFile ($iorbase);
99 for $test (@configurations) {
100 print STDERR
"\n==== Running $test->{description} \n\n";
102 my $port = $server->RandomPort();
103 $server->DeleteFile($iorbase);
104 $client->DeleteFile($iorbase);
106 $SV = $server->CreateProcess ("server", "-ORBdebuglevel $debug_level ".
107 "-o $server_iorfile ".
108 "-ORBEndpoint iiop://$host:$port ".
109 "-e $test->{server_raise_ex_kind} ".
110 "-r $test->{servant_calls}");
112 $CL = $client->CreateProcess ("client", "-k corbaloc::$host:$port/Simple_Server -x ".
113 "-e $test->{client_expect_ex_kind} " .
114 "-n $test->{client_expect_num_ex} ".
115 "-i $test->{num_requests} $test->{orb_exception_forward_opt}");
117 print STDERR
$SV->CommandLine () . "\n";
118 print STDERR
$CL->CommandLine () . "\n";
120 $server_status = $SV->Spawn ();
122 if ($server_status != 0) {
123 print STDERR
"ERROR: server returned $server_status\n";
127 if ($server->WaitForFileTimed ($iorbase,
128 $server->ProcessStartWaitInterval()) == -1) {
129 print STDERR
"ERROR: cannot find file <$server_iorfile>\n";
130 $SV->Kill (); $SV->TimedWait (1);
134 if ($server->GetFile ($iorbase) == -1) {
135 print STDERR
"ERROR: cannot retrieve file <$server_iorfile>\n";
136 $SV->Kill (); $SV->TimedWait (1);
140 if ($client->PutFile ($iorbase) == -1) {
141 print STDERR
"ERROR: cannot set file <$client_iorfile>\n";
142 $SV->Kill (); $SV->TimedWait (1);
146 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 45);
148 if ($client_status != 0) {
149 print STDERR
"ERROR: client returned $client_status\n";
153 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
155 if ($server_status != 0) {
156 print STDERR
"ERROR: server returned $server_status\n";
162 $server->DeleteFile($iorbase);
163 $client->DeleteFile($iorbase);