Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / Trading / run_test.pl
blobdece4fd55a0c0e3d05328e468252af7aa5ce2bac
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 $status = 0;
11 $debug_level = '0';
14 foreach $i (@ARGV) {
15 if ($i eq '-debug') {
16 $debug_level = '10';
20 ## Specify and endpoint so that we may test the corbaloc in the
21 ## -ORBInitRef. We retain one -ORBInitRef using the file just to test
22 ## both ways.
24 my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
25 my $import_test = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
26 my $export_test = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
28 $port = $server->RandomPort();
30 my $iorbase = "trading.ior";
31 my $ready = "export_test_ready";
33 my $server_iorfile = $server->LocalFile ($iorbase);
34 my $import_iorfile = $import_test->LocalFile ($iorbase);
35 $server->DeleteFile($iorbase);
36 $import_test->DeleteFile($iorbase);
38 #For ready file
39 my $export_ready_file = $export_test->LocalFile ($ready);
40 $export_test->DeleteFile($ready);
42 $SV = $server->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Trading_Service/tao_costrading",
43 "-ORBdebuglevel $debug_level ".
44 "-ORBlogfile trader.log " .
45 "-ORBEndpoint iiop://:$port " .
46 "-TSdumpior $server_iorfile");
48 $CL1 = $export_test->CreateProcess ("export_test",
49 "-ORBInitRef TradingService=corbaloc:::$port/TradingService " .
50 "-d $export_ready_file " .
51 "-quiet");
53 $CL2 = $import_test->CreateProcess ("import_test",
54 "-ORBInitRef TradingService=file://$import_iorfile " .
55 "-quiet");
57 $server_status = $SV->Spawn ();
59 if ($server_status != 0) {
60 print STDERR "ERROR: server returned $server_status\n";
61 exit 1;
64 if ($server->WaitForFileTimed ($iorbase,
65 $server->ProcessStartWaitInterval()) == -1) {
66 print STDERR "ERROR: cannot find file <$server_iorfile>\n";
67 $SV->Kill (); $SV->TimedWait (1);
68 exit 1;
71 $client_status = $CL1->Spawn ();
73 if ($client_status != 0) {
74 print STDERR "ERROR: server returned $server_status\n";
75 $SV->Kill (); $SV->TimedWait (1);
76 exit 1;
79 if ($export_test->WaitForFileTimed ($ready,
80 $export_test->ProcessStartWaitInterval()) == -1) {
81 print STDERR "ERROR: cannot find file <$ready>\n";
82 $SV->Kill (); $SV->TimedWait (1);
83 $CL1->Kill (); $CL1->TimedWait (1);
84 exit 1;
87 if ($server->GetFile ($iorbase) == -1) {
88 print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
89 $SV->Kill (); $SV->TimedWait (1);
90 exit 1;
92 if ($import_test->PutFile ($iorbase) == -1) {
93 print STDERR "ERROR: cannot set file <$import_iorfile>\n";
94 $SV->Kill (); $SV->TimedWait (1);
95 exit 1;
98 $client_status = $CL2->SpawnWaitKill ($import_test->ProcessStartWaitInterval());
100 if ($client_status != 0) {
101 print STDERR "ERROR: client returned $client_status\n";
102 $status = 1;
105 $CL1->Kill ();
106 $SV->Kill ();
108 $server->DeleteFile($iorbase);
109 $import_test->DeleteFile($iorbase);
110 $export_test->DeleteFile($ready);
112 exit $status;