Example #1
0
static int run(void) {
	int ret;
	initialize_tests ();
	start_tests ();
	ret = g_test_run ();
	if (ret == 0)
		run_externals (&ret);
	stop_tests();
	return ret;
}
Example #2
0
File: client.cpp Project: manut/TAO
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  int result = 0;
  try
    {
      CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return 1;

      Test::Hello_var hello = prepare_tests (orb.in ());

      if (CORBA::is_nil (hello.in ()))
        {
          ACE_ERROR_RETURN ((LM_DEBUG,
                             "ERROR : Nil Test::Hello reference <%C>\n",
                             ior),
                            1);
        }

      try
        {
          result += start_tests(hello.in (), orb.in ());
        }
      catch (const CORBA::Exception& ex)
        {
          ex._tao_print_exception ("Exception caught:");
          ++result;
        }

      if (test == 2)
        {
          ACE_DEBUG((LM_DEBUG,
                     ACE_TEXT("*** NOTE TestCompressor is EXPECTED to throw IDL:omg.org/Compression/CompressionException ***\n")));
        }

      hello->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught:");
      ++result;
    }

  return result;
}
Example #3
0
File: client.cpp Project: manut/TAO
int
check_results (CORBA::ORB_ptr orb)
{
#if defined TAO_HAS_ZIOP && TAO_HAS_ZIOP == 1
  switch (test)
    {
    case 1:
      try
        {
          // should throw an exception
          ::Compression::Compressor_var compressor (
            compression_manager->get_compressor (
              ::Compression::COMPRESSORID_LZO,
              LEAST_COMPRESSION_LEVEL ));
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("ERROR : check_results, ")
                             ACE_TEXT ("no exception thrown when applying for ")
                             ACE_TEXT ("LZO Compressor\n")),
                            1);
        }
      catch (::Compression::UnknownCompressorId)
        {
          ACE_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("check_results, expected exception caught, ")
                      ACE_TEXT ("(unknown factory)\n")));
          Test::Hello_var hello = prepare_tests (orb, false);
          test = -1;
          return start_tests (hello.in (), orb);
        }
      break;
    case 4:
    case -1:
      {
        ::Compression::Compressor_var compressor (
          compression_manager->get_compressor (
            ::Compression::COMPRESSORID_ZLIB,
            LEAST_COMPRESSION_LEVEL ));
        if (!CORBA::is_nil (compressor))
          {
            if (compressor->compressed_bytes () == 0)
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("ERROR : check_results, no compression used ")
                                 ACE_TEXT ("during test 1a\n")),
                                1);
            else
               return 0;
          }
        else
          {
            ACE_ERROR_RETURN ((LM_ERROR,
                               ACE_TEXT ("ERROR : check_results, zlib compressor not found ")
                               ACE_TEXT ("during test 1a\n")),
                              1);
          }
      }
      break;
    case 2:
      return 0;
      break;
    case 3:
      {
        // low value policy test. No compression should be used.
        ::Compression::Compressor_var compressor (
        compression_manager->get_compressor (
          ::Compression::COMPRESSORID_ZLIB,
          LEAST_COMPRESSION_LEVEL ));
        if (!CORBA::is_nil (compressor))
          {
            if (compressor->compressed_bytes () != 0)
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("ERROR : check_results, compression used ")
                                 ACE_TEXT ("during test %d\n"), test),
                                1);
            else
              return 0;
          }
        else
          {
            ACE_ERROR_RETURN ((LM_ERROR,
                               ACE_TEXT ("ERROR : check_results, zlib compressor not found ")
                               ACE_TEXT ("during test %d\n"), test),
                              1);
          }
      }
      break;
    default:
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("ERROR : check_results, unknown test ID\n")),
                        1);
    }
  ACE_ERROR_RETURN ((LM_ERROR,
                     ACE_TEXT ("ERROR : check_results, unexpected\n")),
                    1);
#else
  ACE_UNUSED_ARG (orb);
  return 0;
#endif
}