diff options
author | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-10-30 16:27:54 +0000 |
---|---|---|
committer | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-10-30 16:27:54 +0000 |
commit | b39170b38c872b6c295e7bb7f56123d5f7c199cc (patch) | |
tree | 4a34a2a77a33277c368c81641baf72cbb16b98c3 | |
parent | 0360b3cc97ea02a7a536dc8521d71b0cd7b6d83f (diff) | |
download | ATCD-b39170b38c872b6c295e7bb7f56123d5f7c199cc.tar.gz |
Fri Oct 30 16:25:53 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com>
* tests/Bug_3755_Regression/orb1_svc.conf:
* tests/Bug_3755_Regression/orb2_svc.conf:
* tests/Bug_3755_Regression/server.cpp:
* tests/Bug_3755_Regression/run_test.pl:
* tests/Bug_3755_Regression/Bug_3755_Regression.mpc:
* bin/tao_orb_tests.lst:
Added a test for bug#3755 and scheduled it for run.
-rw-r--r-- | TAO/ChangeLog | 10 | ||||
-rw-r--r-- | TAO/bin/tao_orb_tests.lst | 1 | ||||
-rw-r--r-- | TAO/tests/Bug_3755_Regression/Bug_3755_Regression.mpc | 10 | ||||
-rw-r--r-- | TAO/tests/Bug_3755_Regression/orb1_svc.conf | 3 | ||||
-rw-r--r-- | TAO/tests/Bug_3755_Regression/orb2_svc.conf | 3 | ||||
-rwxr-xr-x | TAO/tests/Bug_3755_Regression/run_test.pl | 65 | ||||
-rw-r--r-- | TAO/tests/Bug_3755_Regression/server.cpp | 206 |
7 files changed, 298 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 82a215cc205..f12a194be0d 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,13 @@ +Fri Oct 30 16:25:53 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com> + + * tests/Bug_3755_Regression/orb1_svc.conf: + * tests/Bug_3755_Regression/orb2_svc.conf: + * tests/Bug_3755_Regression/server.cpp: + * tests/Bug_3755_Regression/run_test.pl: + * tests/Bug_3755_Regression/Bug_3755_Regression.mpc: + * bin/tao_orb_tests.lst: + Added a test for bug#3755 and scheduled it for run. + Fri Oct 30 14:50:00 UTC 2009 Simon Massey <sma at prismtech dot com> * TAO_IDL/driver/drv_preproc.cpp: diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst index 5fdff6fb0ba..76ffa5d859c 100644 --- a/TAO/bin/tao_orb_tests.lst +++ b/TAO/bin/tao_orb_tests.lst @@ -168,6 +168,7 @@ TAO/tests/Bug_3701_Regression/run_test.pl: TAO/tests/Bug_3743_Regression/run_test.pl: !NO_IFR !LabVIEW_RT !WinCE !FUZZ TAO/tests/Bug_3746_Regression/run_test.pl: TAO/tests/Bug_3748_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !DISABLE_INTERCEPTORS +TAO/tests/Bug_3755_Regression/run_test.pl: !STATIC !FIXED_BUGS_ONLY TAO/tests/DIOP/run_test.pl: !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ TAO/tests/DIOP/run_test_ipv6.pl: IPV6 !ST !NO_DIOP !ACE_FOR_TAO !CORBA_E_MICRO !LabVIEW_RT !WinCE !FUZZ TAO/tests/RTCORBA/Activate_Object_Multiple_ORBs/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST diff --git a/TAO/tests/Bug_3755_Regression/Bug_3755_Regression.mpc b/TAO/tests/Bug_3755_Regression/Bug_3755_Regression.mpc new file mode 100644 index 00000000000..e56827334f8 --- /dev/null +++ b/TAO/tests/Bug_3755_Regression/Bug_3755_Regression.mpc @@ -0,0 +1,10 @@ +// -*- MPC -*- +// $Id$ + +project(*Server) : rt_server { + exename=server + + Source_Files { + server.cpp + } +} diff --git a/TAO/tests/Bug_3755_Regression/orb1_svc.conf b/TAO/tests/Bug_3755_Regression/orb1_svc.conf new file mode 100644 index 00000000000..b7fa448fdee --- /dev/null +++ b/TAO/tests/Bug_3755_Regression/orb1_svc.conf @@ -0,0 +1,3 @@ +# $Id$ + +dynamic RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader() "-ORBPriorityMapping linear -ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM" diff --git a/TAO/tests/Bug_3755_Regression/orb2_svc.conf b/TAO/tests/Bug_3755_Regression/orb2_svc.conf new file mode 100644 index 00000000000..35532aaf96b --- /dev/null +++ b/TAO/tests/Bug_3755_Regression/orb2_svc.conf @@ -0,0 +1,3 @@ +# $Id$ + +dynamic RT_ORB_Loader Service_Object *TAO_RTCORBA:_make_TAO_RT_ORB_Loader() "-ORBPriorityMapping direct -ORBSchedPolicy SCHED_FIFO -ORBScopePolicy SYSTEM" diff --git a/TAO/tests/Bug_3755_Regression/run_test.pl b/TAO/tests/Bug_3755_Regression/run_test.pl new file mode 100755 index 00000000000..12c5317b79e --- /dev/null +++ b/TAO/tests/Bug_3755_Regression/run_test.pl @@ -0,0 +1,65 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +$status = 0; +$debug_level = '0'; + +foreach $i (@ARGV) { + if ($i eq '-debug') { + $debug_level = '10'; + } +} + +my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n"; + +my $mapping1 = "mapping_file1.dat"; +my $server_mapping1 = $server->LocalFile ($mapping1); +my $mapping2 = "mapping_file2.dat"; +my $server_mapping2 = $server->LocalFile ($mapping2); +my $svc_conf1 = "orb1_svc.conf"; +my $server_svc_conf1 = $server->LocalFile ($svc_conf1); +my $svc_conf2 = "orb2_svc.conf"; +my $server_svc_conf2 = $server->LocalFile ($svc_conf2); +$server->DeleteFile($mapping1); +$server->DeleteFile($mapping2); + +$SV = $server->CreateProcess ("server", + "-a 'AAA -ORBdebuglevel $debug_level -ORBSvcConf $server_svc_conf1' " . + "-b 'BBB -ORBdebuglevel $debug_level -ORBGestalt LOCAL -ORBSvcConf $server_svc_conf2' " . + "-y $server_mapping1 " . + "-z $server_mapping2"); +$server_status = $SV->SpawnWaitKill ($server->ProcessStartWaitInterval()); + +if ($server_status != 0) { + print STDERR "ERROR: server returned $server_status\n"; + exit 1; +} + +if ($server->GetFile ($mapping1) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_mapping1>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if ($server->GetFile ($mapping2) == -1) { + print STDERR "ERROR: cannot retrieve file <$server_mapping2>\n"; + $SV->Kill (); $SV->TimedWait (1); + exit 1; +} + +if (-s $mapping1 == -s $mapping2) { + print STDERR "ERROR: <$server_mapping1> and <$server_mapping2> are identical\n"; + $status = 1; +} + +$server->DeleteFile($mapping1); +$server->DeleteFile($mapping2); + +exit $status; diff --git a/TAO/tests/Bug_3755_Regression/server.cpp b/TAO/tests/Bug_3755_Regression/server.cpp new file mode 100644 index 00000000000..0238d60ab51 --- /dev/null +++ b/TAO/tests/Bug_3755_Regression/server.cpp @@ -0,0 +1,206 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/ARGV.h" +#include "tao/RTCORBA/RTCORBA.h" +#include "tao/RTCORBA/Priority_Mapping_Manager.h" + +ACE_TCHAR const *orb1_args = + ACE_TEXT ("AAA -ORBGestalt LOCAL -ORBSvcConf MY_TEST_ORB_1.conf"); +ACE_TCHAR const *orb2_args = + ACE_TEXT ("BBB -ORBGestalt LOCAL -ORBSvcConf MY_TEST_ORB_2.conf"); +ACE_TCHAR const *mapping_file1 = ACE_TEXT ("TAO_PRIORITY_MAPPING1.dat"); +ACE_TCHAR const *mapping_file2 = ACE_TEXT ("TAO_PRIORITY_MAPPING2.dat"); + +int +parse_args (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("a:b:y:z:")); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'a': + orb1_args = get_opts.opt_arg (); + break; + case 'b': + orb2_args = get_opts.opt_arg (); + break; + case 'y': + mapping_file1 = get_opts.opt_arg (); + break; + case 'z': + mapping_file2 = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("usage: %s ") + ACE_TEXT ("-a <orb1_args>") + ACE_TEXT ("-b <orb2_args>") + ACE_TEXT ("-y <mapping_file_for_orb1>") + ACE_TEXT ("-z <mapping_file_for_orb2>") + ACE_TEXT ("\n"), + argv [0]), + -1); + } + // Indicates sucessful parsing of the command line + return 0; +} + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + try + { + if (parse_args (argc, argv) != 0) + { + return 1; + } + + ACE_ARGV orb1_argv (orb1_args); + int orb1_argc = orb1_argv.argc (); + + ACE_ARGV orb2_argv (orb2_args); + int orb2_argc = orb2_argv.argc (); + + ACE_DEBUG ((LM_DEBUG, + "Initialize ORB instances...\n")); + + CORBA::ORB_var orb1 = + CORBA::ORB_init (orb1_argc, orb1_argv.argv (), mapping_file1); + + CORBA::ORB_var orb2 = + CORBA::ORB_init (orb2_argc, orb2_argv.argv (), mapping_file2); + + ACE_DEBUG ((LM_DEBUG, + "After ORB_init...\n")); + + + // Demonstrate the priority mapping ==================================== + + CORBA::Object_var pmMgrObj1 = + orb1->resolve_initial_references ("PriorityMappingManager"); + + RTCORBA::PriorityMappingManager_var mappingMgr1 = + RTCORBA::PriorityMappingManager::_narrow (pmMgrObj1.in ()); + + RTCORBA::PriorityMapping * priorityMapping1 = mappingMgr1->mapping (); + + ACE_DEBUG ((LM_DEBUG, + "Priority Manager & mapping interfaces resolved.\n")); + + // Write the mapping to a file + FILE *output_file = 0; + if (mapping_file1 != 0) + { + output_file = ACE_OS::fopen (mapping_file1, "w"); + + if (output_file == 0) + { + ACE_ERROR ((LM_ERROR, + "Cannot open output file for mapping 1\n")); + return -1; + } + } + + short rtCorbaPriority1 = RTCORBA::minPriority - 1; + short nativePriority1 = 0; + bool status1 = false; + + ACE_DEBUG ((LM_DEBUG, + "Sending mapped priorities to %s...\n", + mapping_file1)); + + while (rtCorbaPriority1 < RTCORBA::maxPriority) + { + ++rtCorbaPriority1; + + status1 = priorityMapping1->to_native (rtCorbaPriority1, + nativePriority1); + + if (!status1) + { + ACE_ERROR ((LM_ERROR, + "Could not map rtCorba priority %d " + "to a native priority.\n", + rtCorbaPriority1)); + } + else + { + ACE_OS::fprintf (output_file, "%d %d\n", + rtCorbaPriority1, + nativePriority1); + } + } + + ACE_OS::fclose (output_file); + + CORBA::Object_var pmMgrObj2 = + orb2->resolve_initial_references ("PriorityMappingManager"); + + RTCORBA::PriorityMappingManager_var mappingMgr2 = + RTCORBA::PriorityMappingManager::_narrow (pmMgrObj2.in ()); + + RTCORBA::PriorityMapping * priorityMapping2 = mappingMgr2->mapping (); + + ACE_DEBUG ((LM_DEBUG, + "Priority Manager & mapping interfaces resolved.\n")); + + // Write the mapping to a file + output_file = 0; + if (mapping_file2 != 0) + { + output_file = ACE_OS::fopen (mapping_file2, "w"); + + if (output_file == 0) + { + ACE_ERROR ((LM_ERROR, + "Cannot open output file for mapping 1\n")); + return -1; + } + } + + short rtCorbaPriority2 = RTCORBA::minPriority - 1; + short nativePriority2 = 0; + bool status2 = false; + + ACE_DEBUG ((LM_DEBUG, + "Sending mapped priorities to %s...\n", + mapping_file2)); + + while (rtCorbaPriority2 < RTCORBA::maxPriority) + { + ++rtCorbaPriority2; + + status2 = priorityMapping2->to_native (rtCorbaPriority2, + nativePriority2); + + if (!status2) + { + ACE_ERROR ((LM_ERROR, + "Could not map rtCorba priority %d " + "to a native priority.\n", + rtCorbaPriority2)); + } + else + { + ACE_OS::fprintf (output_file, "%d %d\n", + rtCorbaPriority2, + nativePriority2); + } + } + + ACE_OS::fclose (output_file); + + // END priority mapping demonstration + } + catch (CORBA::SystemException const &sysEx) + { + sysEx._tao_print_exception ("Caught SystemException in main:\n"); + return 1; + } + + return 0; +} |