Merge pull request #2303 from jwillemsen/jwi-803
[ACE_TAO.git] / TAO / tests / TransportCurrent / IIOP / run_test.pl
blob293f4c2bf34e88c4549cf174da3e4ac4c3810853
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 Config;
9 use PerlACE::TestTarget;
11 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
12 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
14 $server->AddLibPath ('../lib');
15 $client->AddLibPath ('../lib');
17 my $iorbase = "server.ior";
18 my $server_iorfile = $server->LocalFile ($iorbase);
19 my $client_iorfile = $client->LocalFile ($iorbase);
20 $server->DeleteFile($iorbase);
21 $client->DeleteFile($iorbase);
23 $status = 0;
25 $mode = shift (@ARGV);
26 if ($mode =~ /-dynamic/) {
27 $base_client_conf = "client_dynamic" . $PerlACE::svcconf_ext;
28 $base_server_conf = "server_dynamic" . $PerlACE::svcconf_ext;
29 $client_conf_file = $client->LocalFile ("$base_client_conf");
30 $server_conf_file = $server->LocalFile ("$base_server_conf");
32 elsif ($mode =~ /-static/) {
33 $base_client_conf = "client_static" . $PerlACE::svcconf_ext;
34 $base_server_conf = "server_static" . $PerlACE::svcconf_ext;
35 $client_conf_file = $client->LocalFile ("$base_client_conf");
36 $server_conf_file = $server->LocalFile ("$base_server_conf");
38 else {
39 print STDERR "Unknown $mode. Specify -static or -dynamic\n";
40 exit 1;
43 if ($server->PutFile ($base_server_conf) == -1) {
44 print STDERR "ERROR: cannot set file <$server_conf_file>\n";
45 exit 1;
47 if ($client->PutFile ($base_client_conf) == -1) {
48 print STDERR "ERROR: cannot set file <$client_conf_file>\n";
49 exit 1;
52 $SV = $server->CreateProcess ("server",
53 "@ARGV -c 0 -ORBSvcConf $server_conf_file -o $server_iorfile");
55 $CL = $client->CreateProcess ("client",
56 "@ARGV -n 1 -ORBSvcConf $client_conf_file -k file://$client_iorfile");
58 $SV->Spawn ();
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);
64 exit 1;
67 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval ());
69 if ($client_status != 0) {
70 print STDERR "$0: ERROR: client returned $client_status\n";
71 $status = 1;
74 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval ());
76 if ($server_status != 0) {
77 print STDERR "$0: ERROR: server returned $server_status\n";
78 $status = 1;
81 $server->DeleteFile($iorbase);
82 $client->DeleteFile($iorbase);
84 exit $status;