Merge pull request #2222 from jwillemsen/jwi-dllexportwarning
[ACE_TAO.git] / TAO / tests / ORB_portspan / run_test.pl
blob5e1ced9d851d35a65faa38b70d61d3efea0b2fa6
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 $usage = "Usage: ORB_portspan/run_test.pl [-iiop|-diop]";
12 my $protocol = undef;
13 foreach $i (@ARGV) {
14 if ($i eq "-iiop") {
15 $protocol = "iiop";
17 elsif ($i eq "-diop") {
18 $protocol = "diop";
20 else {
21 print STDERR "ERROR: Unknown option: $i\n$usage\n";
22 exit 1;
26 if (!$protocol) {
27 print STDERR "ERROR: $usage\n";
28 exit 1;
31 $status = 0;
33 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
35 $port = $server->RandomPort ();
36 $endpoint = "$protocol://:$port/portspan=2";
38 $svcconf = "";
39 if (-e "svc-$protocol.conf") {
40 $svcconf = "-ORBSvcConf svc-$protocol.conf";
41 print STDOUT "Using $svcconf\n";
44 print STDOUT "Creating three $protocol servers with endpoint $endpoint...\n";
46 $SV1 = $server->CreateProcess ("server", "-ORBEndpoint $endpoint $svcconf");
47 $SV2 = $server->CreateProcess ("server", "-ORBEndpoint $endpoint $svcconf");
48 $SV3 = $server->CreateProcess ("server", "-ORBEndpoint $endpoint $svcconf");
50 print STDOUT "Starting server 1\n";
51 $server_status = $SV1->Spawn ();
52 if ($server_status != 0) {
53 print STDERR "ERROR: server failed to start: $server_status\n";
54 exit 1;
56 $server_status = $SV1->Wait (1);
57 if ($server_status != -1) {
58 print STDERR "ERROR: server exited prematurely: $server_status\n";
59 exit 1;
61 print STDOUT "Started server 1\n";
63 print STDOUT "Starting server 2\n";
64 $server_status = $SV2->Spawn ();
65 if ($server_status != 0) {
66 print STDERR "ERROR: server failed to start: $server_status\n";
67 $SV1->Kill ();
68 exit 1;
70 $server_status = $SV2->Wait (1);
71 if ($server_status != -1) {
72 print STDERR "ERROR: server exited prematurely: $server_status\n";
73 exit 1;
75 print STDOUT "Started server 2\n";
77 print STDOUT "Starting server 3\n";
78 $server_status = $SV3->Spawn ();
79 if ($server_status == 0) {
80 $server_status = $SV3->Wait (1);
81 if ($server_status == -1) {
82 print STDERR "ERROR: Last server didn't fail, still running!\n";
83 $SV1->Kill ();
84 $SV2->Kill ();
85 $SV3->Kill ();
86 exit 1;
89 print STDOUT "Success: server 3 failed to start, stopping...\n";
91 $SV1->Kill();
92 $SV2->Kill();
93 $SV3->Kill();
95 print STDOUT "Portspan $protocol test completed successfully.\n\n";
97 exit $status;