Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / MT_NoUpcall_Connect / run_test.pl
blob0b88f295e77c3cc8855e351e8789341e92900b9c
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 $exit_status = 0;
12 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
13 my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
15 my $server_conf_base = "mt_noupcall$PerlACE::svcconf_ext";
16 my $server_conf = $server->LocalFile ($server_conf_base);
17 if ($server->PutFile ($server_conf_base) == -1) {
18 print STDERR "ERROR: cannot set file <$server_conf>\n";
19 exit 1;
22 $debug_level = '0';
23 foreach $i (@ARGV) {
24 if ($i eq '-d') {
25 $debug_level = '10';
29 my $debugarg = "-ORBDebugLevel $debug_level -ORBVerboseLogging 1 -ORBLogFile ";
30 my $server_debug = $debugarg . " server.log" if ($debug_level > 0);
31 my $client_debug = $debugarg . " client.log" if ($debug_level > 0);
33 my $server_iorbase = "server.ior";
34 my $server_iorfile = $server->LocalFile ($server_iorbase);
36 $server->DeleteFile($server_iorbase);
37 $server->DeleteFile("server.log");
38 $client->DeleteFile("client.log");
41 $SV = $server->CreateProcess ("server", "-ORBSvcConf $server_conf_base $server_debug");
42 $server_status = $SV->Spawn ();
43 if ($server_status != 0) {
44 print STDERR "ERROR: server returned $server_status\n";
45 exit 1;
47 if ($server->WaitForFileTimed ($server_iorbase,
48 $server->ProcessStartWaitInterval()) == -1) {
49 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
50 $SV->Kill (); $SV->TimedWait (1);
51 exit 1;
54 $CL = $client->CreateProcess ("client", "$client_debug");
55 $client_status = $CL->SpawnWaitKill ($client->ProcessStartWaitInterval() + 300);
56 if ($client_status != 0) {
57 print STDERR "ERROR: client returned $client_status\n";
58 $exit_status = 1;
61 print "INFO: Awaiting server ...\n";
62 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
63 if ($server_status != 0) {
64 print STDERR "ERROR: server returned $server_status\n";
65 $exit_status = 1;
68 $server->DeleteFile($server_iorfile);
70 if ($exit_status == 0) {
71 print "INFO: Test succeeded\n";
73 else {
74 print "INFO: Test Failed!\n";
77 exit $exit_status;