Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / TAO / tests / MT_NoUpcall_Client_Leader / run_test.pl
blob9e56dcff3ec62148a3ef2ca56e2c0659066bcaa9
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 $client_conf_base = "mt_noupcall$PerlACE::svcconf_ext";
16 my $client_conf = $server->LocalFile ($client_conf_base);
17 if ($client->PutFile ($client_conf_base) == -1) {
18 print STDERR "ERROR: cannot set file <$client_conf>\n";
19 exit 1;
23 my $server_conf_base = "mt_noupcall$PerlACE::svcconf_ext";
24 my $server_conf = $server->LocalFile ($server_conf_base);
25 if ($client->PutFile ($server_conf_base) == -1) {
26 print STDERR "ERROR: cannot set file <$server_conf>\n";
27 exit 1;
30 $debug_level = '0';
31 foreach $i (@ARGV) {
32 if ($i eq '-d') {
33 $debug_level = '10';
37 my $server_iorbase = "server.ior";
38 my $client_iorbase = "client.ior";
39 my $server_iorfile = $server->LocalFile ($server_iorbase);
40 my $client_iorfile = $client->LocalFile ($client_iorbase);
42 $server->DeleteFile($server_iorbase);
43 $client->DeleteFile($client_iorbase);
45 $SV = $server->CreateProcess ("server",
46 "-ORBDebugLevel $debug_level -ORBSvcConf $server_conf " .
47 "-t 1");
48 $server_status = $SV->Spawn ();
49 if ($server_status != 0) {
50 print STDERR "ERROR: server returned $server_status\n";
51 exit 1;
53 if ($server->WaitForFileTimed ($server_iorbase,
54 $server->ProcessStartWaitInterval()) == -1) {
55 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
56 $SV->Kill (); $SV->TimedWait (1);
57 exit 1;
60 $CL = $client->CreateProcess ("client", "-t 1");
61 $client_status = $CL->Spawn ();
62 if ($client_status != 0) {
63 print STDERR "ERROR: client returned $client_status\n";
64 $SV->Kill (); $SV->TimedWait (1);
65 exit 1;
68 if ($client->WaitForFileTimed ($client_iorbase,
69 $client->ProcessStartWaitInterval()) == -1) {
70 print STDERR "ERROR: cannot find file <$client_iorfile>\n";
71 $SV->Kill (); $SV->TimedWait (1);
72 exit 1;
75 print "INFO: Awaiting server ...\n";
76 $server_status = $SV->WaitKill ($server->ProcessStopWaitInterval() + 60);
77 if ($server_status != 0) {
78 print STDERR "ERROR: server returned $server_status\n";
79 $exit_status = 1;
82 print "INFO: Awaiting client ...\n";
83 $client_status = $CL->WaitKill ($client->ProcessStartWaitInterval() + 10);
84 if ($client_status != 0) {
85 print STDERR "ERROR: client returned $client_status\n";
86 $exit_status = 1;
89 $server->DeleteFile($server_iorfile);
90 $client->DeleteFile($client_iorfile);
92 if ($exit_status == 0) {
93 print "INFO: Test succeeded\n";
95 else {
96 print "INFO: Test Failed!\n";
99 exit $exit_status;