示例#1
0
//! \cond internal
ReferenceDataEntry::EntryPointer
readReferenceDataFile(const std::string &path)
{
    tinyxml2::XMLDocument document;
    document.LoadFile(path.c_str());
    if (document.Error())
    {
        std::string errorString("Error was ");
        errorString += document.GetErrorStr1();
        errorString += document.GetErrorStr2();
        GMX_THROW(TestException("Reference data not parsed successfully: " + path + "\n." + errorString + "\n"));
    }
    XMLElementPtr rootNode = document.RootElement();
    if (rootNode == nullptr)
    {
        GMX_THROW(TestException("Reference data is empty: " + path));
    }
    if (std::strcmp(rootNode->Value(), c_RootNodeName) != 0)
    {
        GMX_THROW(TestException("Invalid root node type in " + path));
    }

    ReferenceDataEntry::EntryPointer rootEntry(ReferenceDataEntry::createRoot());
    readEntry(rootNode, rootEntry.get());
    return rootEntry;
}
示例#2
0
ACE_INET_Addr
TestDriver::parse_address(const std::string& spec)
{
  std::string::size_type pos;

  if ((pos = spec.find(':')) == std::string::npos) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad address (%s) - missing ':' char.\n",
               spec.c_str()));
    throw TestException();
  }

  if (pos == 0) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad address (%s) - "
               "':' char can't be first char.\n",
               spec.c_str()));
    throw TestException();
  }

  if (pos == (spec.length() - 1)) {
    ACE_ERROR((LM_ERROR,
               "(%P|%t) Bad address (%s) - "
               "':' char can't be last char.\n",
               spec.c_str()));
    throw TestException();
  }

  return ACE_INET_Addr(spec.c_str());
}
示例#3
0
void
SubDriver::parse_arg_d(const char* arg, bool& flag)
{
  if (flag)
    {
      ACE_ERROR((LM_ERROR,
             "(%P|%t) Only one -d allowed on command-line.\n"));
      throw TestException();
    }

  int value = ACE_OS::atoi(arg);

  if (value <= 0)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Value following -d option must be > 0.\n"));
      throw TestException();
    }

  if (value > 32)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Value following -d option must be < 32.\n"));
      throw TestException();
    }

  char data_size = value;
  this->subscriber_.set_data_size(data_size);

  flag = true;
}
示例#4
0
void PubDriver::attach_to_transport ()
{
  // create TransportImpl.
  TAO::DCPS::TransportImpl_rch transport_impl
    = TheTransportFactory->create_transport_impl (ALL_TRAFFIC, "SimpleTcp", TAO::DCPS::DONT_AUTO_CONFIG);

  TAO::DCPS::TransportConfiguration_rch config
    = TheTransportFactory->create_configuration (ALL_TRAFFIC, "SimpleTcp");

  TAO::DCPS::SimpleTcpConfiguration* tcp_config
    = static_cast <TAO::DCPS::SimpleTcpConfiguration*> (config.in ());

  tcp_config->local_address_ = this->pub_addr_;

  if (transport_impl->configure(config.in ()) != 0)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Failed to configure the transport impl\n"));
      throw TestException();
    }

  // Attach the Publisher with the TransportImpl.
  ::TAO::DCPS::PublisherImpl* pub_servant
    = ::TAO::DCPS::reference_to_servant < ::TAO::DCPS::PublisherImpl, ::DDS::Publisher_ptr>
      (publisher_.in ());

  TEST_CHECK (pub_servant != 0);

  TAO::DCPS::AttachStatus status
    = pub_servant->attach_transport(transport_impl.in ());

  if (status != TAO::DCPS::ATTACH_OK)
  {
    // We failed to attach to the transport for some reason.
    std::string status_str;

    switch (status)
      {
        case TAO::DCPS::ATTACH_BAD_TRANSPORT:
          status_str = "ATTACH_BAD_TRANSPORT";
          break;
        case TAO::DCPS::ATTACH_ERROR:
          status_str = "ATTACH_ERROR";
          break;
        case TAO::DCPS::ATTACH_INCOMPATIBLE_QOS:
          status_str = "ATTACH_INCOMPATIBLE_QOS";
          break;
        default:
          status_str = "Unknown Status";
          break;
      }

    ACE_ERROR((LM_ERROR,
                "(%P|%t) Failed to attach to the transport. "
                "AttachStatus == %s\n", status_str.c_str()));
    throw TestException();
  }
}
示例#5
0
Writer::Writer(::DDS::DomainParticipant_ptr dp,
               ::DDS::Topic_ptr topic,
               int history_depth,
               int max_samples_per_instance)
: dp_(::DDS::DomainParticipant::_duplicate (dp))
{
  // Create the publisher
  pub_ = dp->create_publisher(PUBLISHER_QOS_DEFAULT,
                              ::DDS::PublisherListener::_nil(),
                              ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
  if (CORBA::is_nil (pub_.in ()))
  {
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT("(%P|%t) create_publisher failed.\n")));
    throw TestException() ;
  }

  // Create the datawriter
  ::DDS::DataWriterQos dw_qos;
  pub_->get_default_datawriter_qos (dw_qos);

  dw_qos.history.depth = history_depth  ;
  dw_qos.resource_limits.max_samples_per_instance =
            max_samples_per_instance ;
  dw_qos.liveliness.lease_duration.sec =
          static_cast<CORBA::Long> (max_blocking_time.sec ());
  dw_qos.liveliness.lease_duration.nanosec = 0 ;

  dw_ = pub_->create_datawriter(topic,
                                dw_qos,
                                ::DDS::DataWriterListener::_nil(),
                                ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);

  if (CORBA::is_nil (dw_.in ()))
  {
    ACE_ERROR ((LM_ERROR,
               ACE_TEXT("(%P|%t) create_datawriter failed.\n")));
    throw TestException() ;
  }

  ::Xyz::FooDataWriter_var foo_dw = ::Xyz::FooDataWriter::_narrow(
      dw_.in ());
  if (CORBA::is_nil (foo_dw.in ()))
  {
    ACE_ERROR ((LM_ERROR,
               ACE_TEXT("(%P|%t) ::Xyz::FooDataWriter::_narrow failed.\n")));
    throw TestException() ;
  }

  fast_dw_ =
    dynamic_cast< ::Xyz::FooDataWriterImpl*> (foo_dw.in ());

}
示例#6
0
void
SubDriver::parse_arg_s(const char* arg, bool& flag)
{
  if (flag)
    {
      ACE_ERROR((LM_ERROR,
             "(%P|%t) Only one -s allowed on command-line.\n"));
      throw TestException();
    }

  std::string arg_str = arg;
  std::string::size_type pos;

  // Find the first ':' character, and make sure it is in a legal spot.
  if ((pos = arg_str.find_first_of(':')) == std::string::npos)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Bad -s value (%s). "
                 "Missing ':' chars.\n",
                 arg));
      throw TestException();
    }

  if (pos == 0)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Bad -s value (%s). "
                 "':' char cannot be first char.\n",
                 arg));
      throw TestException();
    }

  if (pos == arg_str.length() - 1)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Bad -s value (%s). "
                 "':' char cannot be last char.\n",
                 arg));
      throw TestException();
    }

  // Parse the sub_id from left of ':' char, and remainder to right of ':'.
  std::string sub_id_str(arg_str,0,pos);
  std::string sub_addr_str(arg_str,pos+1,std::string::npos); //use 3-arg constructor to build with VC6

  TAO::DCPS::RepoId sub_id = ACE_OS::atoi(sub_id_str.c_str());

  this->local_address_ = ACE_INET_Addr(sub_addr_str.c_str());

  this->subscriber_.set_local_subscriber(sub_id);

  flag = true;
}
示例#7
0
Reader::Reader(::DDS::DomainParticipant_ptr dp,
               int history_depth,
               int max_samples_per_instance)
    : max_samples_per_instance_(max_samples_per_instance),
    dp_(::DDS::DomainParticipant::_duplicate (dp))
{
  sub_ = dp->create_subscriber(SUBSCRIBER_QOS_DEFAULT,
                             ::DDS::SubscriberListener::_nil(),
                             ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
  if (CORBA::is_nil (sub_.in ()))
  {
    ACE_ERROR ((LM_ERROR,
               ACE_TEXT("(%P|%t) create_subscriber failed.\n")));
    throw TestException() ;
  }


  ::DDS::TopicDescription_var description =
      dp->lookup_topicdescription(MY_TOPIC);
  if (CORBA::is_nil (description.in ()))
  {
    ACE_ERROR ((LM_ERROR,
               ACE_TEXT("(%P|%t) lookup_topicdescription failed.\n")));
    throw TestException() ;
  }

  ::DDS::DataReaderQos dr_qos;
  sub_->get_default_datareader_qos (dr_qos);

  dr_qos.history.depth = history_depth  ;
  dr_qos.resource_limits.max_samples_per_instance =
            max_samples_per_instance ;

  dr_qos.liveliness.lease_duration.sec =
          static_cast<CORBA::Long> (max_blocking_time.sec ());
  dr_qos.liveliness.lease_duration.nanosec = 0 ;

  ::DDS::DataReaderListener_var drl (new DataReaderListenerImpl);

  ::DDS::DataReader_var dr = sub_->create_datareader(description.in (),
                                dr_qos,
//                                ::DDS::DataReaderListener::_nil()
                                drl.in (),
                                ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);

  if (CORBA::is_nil (dr.in ()))
  {
    ACE_ERROR ((LM_ERROR,
               ACE_TEXT("(%P|%t) create_datareader failed.\n")));
    throw TestException() ;
  }
}
示例#8
0
Callback_ptr
ServerApp::create_callback(
    PortableServer::POA_ptr poa,
    const char* servant_name)
{
    PortableServer::ServantBase_var servant
        = new Callback_i();

    PortableServer::ObjectId_var id =
        PortableServer::string_to_ObjectId("callback");

    poa->activate_object_with_id(id.in(), servant.in());

    CORBA::Object_var obj = poa->id_to_reference(id.in());

    if (CORBA::is_nil(obj.in()))
    {
        ACE_ERROR((LM_ERROR,
                   "(%P|%t) Failed to activate servant (%s).\n",
                   servant_name));
        throw TestException();
    }

    Callback_var callback = Callback::_narrow (obj.in ());

    return callback._retn ();
}
示例#9
0
	void Throw()
	{
		CFIXCC_ASSERT( setupCalled );
		CFIXCC_ASSERT_EQUALS( counter, 1 );
		counter++;
		throw TestException();
	}
示例#10
0
void
SubDriver::parse_args(int& argc, char* argv[])
{
  // Command-line arguments:
  //
  // -n <num samples to send>
  // -d <data size>
  // -p <pub_id:pub_host:pub_port>
  // -s <sub_id:sub_host:sub_port>
  //

  ACE_Arg_Shifter arg_shifter(argc, argv);

  bool flag_n = false;
  bool flag_d = false;
  bool flag_p = false;
  bool flag_s = false;

  const char* current_arg = 0;

  while (arg_shifter.is_anything_left())
    {
      if ((current_arg = arg_shifter.get_the_parameter("-n")))
        {
          this->parse_arg_n(current_arg, flag_n);
          arg_shifter.consume_arg();
        }
      else if ((current_arg = arg_shifter.get_the_parameter("-d")))
        {
          this->parse_arg_d(current_arg, flag_d);
          arg_shifter.consume_arg();
        }
      else if ((current_arg = arg_shifter.get_the_parameter("-p")))
        {
          this->parse_arg_p(current_arg, flag_p);
          arg_shifter.consume_arg();
        }
      else if ((current_arg = arg_shifter.get_the_parameter("-s")))
        {
          this->parse_arg_s(current_arg, flag_s);
          arg_shifter.consume_arg();
        }
      else if (arg_shifter.cur_arg_strncasecmp("-?") == 0)
        {
          this->print_usage(argv[0]);
          arg_shifter.consume_arg();
          throw TestException();
        }
      else
        {
          arg_shifter.ignore_arg();
        }
    }

  this->required_arg('n', flag_n);
  this->required_arg('d', flag_d);
  this->required_arg('p', flag_p);
  this->required_arg('s', flag_s);
}
示例#11
0
void
PubDriver::parse_arg_s(const char* arg, bool& flag)
{
  std::string arg_str = arg;
  std::string::size_type pos;

  // Find the first ':' character, and make sure it is in a legal spot.
  if ((pos = arg_str.find_first_of(':')) == std::string::npos)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Bad -s value (%s). "
                 "Missing ':' chars.\n",
                 arg));
      throw TestException();
    }

  if (pos == 0)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Bad -s value (%s). "
                 "':' char cannot be first char.\n",
                 arg));
      throw TestException();
    }

  if (pos == arg_str.length() - 1)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Bad -s value (%s). "
                 "':' char cannot be last char.\n",
                 arg));
      throw TestException();
    }

  // Parse the sub_id from left of ':' char, and remainder to right of ':'.
  std::string sub_id_str(arg_str,0,pos);
  std::string sub_addr_str(arg_str,pos+1,std::string::npos); //use 3-arg constructor to build with VC6

  OpenDDS::DCPS::RepoId sub_id = ACE_OS::atoi(sub_id_str.c_str());

  ACE_INET_Addr sub_addr(sub_addr_str.c_str());

  this->publisher_.add_remote_subscriber(sub_id,sub_addr, sub_addr_str);

  flag = true;
}
示例#12
0
	std::string BlakeTest::Run()
	{
		try
		{
			Initialize();

			CEX::Digest::Blake256* dgt256 = new CEX::Digest::Blake256();
			CompareVector(dgt256, m_message[0], m_expected[0]);
			CompareVector(dgt256, m_message[1], m_expected[1]);
			CompareVector(dgt256, m_message[2], m_expected[2]);
			CompareVector(dgt256, m_message[3], m_expected[3]);
			CompareVector(dgt256, m_message[4], m_expected[4]);
			CompareVector(dgt256, m_message[5], m_expected[5]);
			CompareVector(dgt256, m_message[6], m_expected[6]);
			CompareVector(dgt256, m_message[7], m_expected[7]);
			CompareVector(dgt256, m_message[8], m_expected[8]);
			CompareVector(dgt256, m_message[9], m_expected[9]);
			delete dgt256;
			OnProgress("Passed Blake 256 vector tests..");

			CEX::Digest::Blake512* dgt512 = new CEX::Digest::Blake512();
			CompareVector(dgt512, m_message[10], m_expected[10]);
			CompareVector(dgt512, m_message[11], m_expected[11]);
			CompareVector(dgt512, m_message[12], m_expected[12]);
			CompareVector(dgt512, m_message[13], m_expected[13]);
			CompareVector(dgt512, m_message[14], m_expected[14]);
			CompareVector(dgt512, m_message[15], m_expected[15]);
			CompareVector(dgt512, m_message[16], m_expected[16]);
			CompareVector(dgt512, m_message[17], m_expected[17]);
			CompareVector(dgt512, m_message[18], m_expected[18]);
			CompareVector(dgt512, m_message[19], m_expected[19]);
			delete dgt512;
			OnProgress("Passed Blake 512 vector tests..");

			return SUCCESS;
		}
		catch (std::string const& ex)
		{
			throw TestException(std::string(FAILURE + " : " + ex));
		}
		catch (...)
		{
			throw TestException(std::string(FAILURE + " : Internal Error"));
		}
	}
示例#13
0
 virtual void initialize_impl(JNIEnv * env, jstring name, jobject listener)override {
   if (initializeDuration != 0) {
     std::this_thread::sleep_for(std::chrono::milliseconds(initializeDuration));
   }
   initialize_implCount++;
   if (exceptionInInitialize) {
     throw TestException("Requested exception in initialize_impl");
   }
 }
示例#14
0
 virtual void execNativeProcess_impl(unsigned long timeCodeStart, unsigned long timeCodeDuration, void * client)override {
   if (execNativeProcessDuration != 0) {
     std::this_thread::sleep_for(std::chrono::milliseconds(execNativeProcessDuration));
   }
   execNativeProcess_implCount++;
   if (exceptionInNative) {
     throw TestException("Requested exception in execNativeProcess_impl");
   }
 }
示例#15
0
 virtual void execJavaProcess_impl(JNIEnv * env, unsigned long timeCodeStart, unsigned long timeCodeDuration, bool lastCycle)override {
   if (execJavaProcessDuration != 0) {
     std::this_thread::sleep_for(std::chrono::milliseconds(execJavaProcessDuration));
   }
   execJavaProcess_implCount++;
   if (exceptionInJava) {
     throw TestException("Requested exception in execJavaProcess_impl");
   }
 }
示例#16
0
int read (::DDS::DataReader_ptr reader)
{

#endif

  try
  {
    DR_var foo_dr
      = DR::_narrow(reader);
    if (CORBA::is_nil (foo_dr.in ()))
    {
      ACE_ERROR ((LM_ERROR,
        ACE_TEXT("(%P|%t) read: _narrow failed.\n")));
      throw TestException() ;
    }

    DR_impl* dr_servant =
      dynamic_cast<DR_impl*> (foo_dr.in ());

    DT foo;
    ::DDS::SampleInfo si ;

    DDS::ReturnCode_t status  ;

    status = dr_servant->read_next_sample(foo, si) ;

    if (status == ::DDS::RETCODE_OK)
    {
      ACE_DEBUG((LM_DEBUG,
        ACE_TEXT("(%P|%t) reader %X foo.x = %f foo.y = %f, foo.data_source = %d \n"),
        reader, foo.x, foo.y, foo.data_source));
      ACE_DEBUG((LM_DEBUG,
        ACE_TEXT("(%P|%t) SampleInfo.sample_rank = %d \n"),
        si.sample_rank));
    }
    else if (status == ::DDS::RETCODE_NO_DATA)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
        ACE_TEXT("(%P|%t) ERROR: reader received ::DDS::RETCODE_NO_DATA!\n")),
        -1);
    }
    else
    {
      ACE_ERROR_RETURN ((LM_ERROR,
        ACE_TEXT("(%P|%t) ERROR: read  foo: Error: %d\n"), status),
        -1);
    }
  }
  catch (const CORBA::Exception& ex)
  {
    ex._tao_print_exception ("Exception caught in read:");
    return -1;
  }

  return 0;
}
示例#17
0
void Writer::start()
{
  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Writer::start\n")));
  if (activate(THR_NEW_LWP | THR_JOINABLE, num_thread_to_write_) == -1) {
    ACE_ERROR((LM_ERROR,
               ACE_TEXT("(%P|%t) Writer::start, %p.\n"),
               ACE_TEXT("activate")));
    throw TestException();
  }
}
示例#18
0
void thr(int n) {
  if( --n <= 0 ) {
    thrown = true;
    throw TestException();
    abort();
  }

  Z z;
  thr(n - 1);
}
示例#19
0
	std::string CipherModeTest::Run()
	{
		try
		{
			Initialize();

			// test modes with each key (128/192/256)
			CompareCBC(m_keys[0], m_input, m_output);
			CompareCBC(m_keys[1], m_input, m_output);
			CompareCBC(m_keys[2], m_input, m_output);
			OnProgress("CipherModeTest: Passed CBC 128/192/256 bit key encryption/decryption tests..");

			CompareCFB(m_keys[0], m_input, m_output);
			CompareCFB(m_keys[1], m_input, m_output);
			CompareCFB(m_keys[2], m_input, m_output);
			OnProgress("CipherModeTest: Passed CFB 128/192/256 bit key encryption/decryption tests..");

			CompareCTR(m_keys[0], m_input, m_output);
			CompareCTR(m_keys[1], m_input, m_output);
			CompareCTR(m_keys[2], m_input, m_output);
			OnProgress("CipherModeTest: Passed CTR 128/192/256 bit key encryption/decryption tests..");

			CompareECB(m_keys[0], m_input, m_output);
			CompareECB(m_keys[1], m_input, m_output);
			CompareECB(m_keys[2], m_input, m_output);
			OnProgress("CipherModeTest: Passed ECB 128/192/256 bit key encryption/decryption tests..");

			CompareOFB(m_keys[0], m_input, m_output);
			CompareOFB(m_keys[1], m_input, m_output);
			CompareOFB(m_keys[2], m_input, m_output);
			OnProgress("CipherModeTest: Passed OFB 128/192/256 bit key encryption/decryption tests..");

			return SUCCESS;
		}
		catch (std::string const& ex)
		{
			throw TestException(std::string(FAILURE + " : " + ex));
		}
		catch (...)
		{
			throw TestException(std::string(FAILURE + " : Internal Error"));
		}
	}
示例#20
0
void
SubDriver::required_arg(char opt, bool flag)
{
  if (!flag)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Missing required command-line option: -%c.\n",
                 opt));
      throw TestException();
    }
}
示例#21
0
void
TestException::ThrowWithExtendedMessage(const char* message,...)
{
	char buffer[4096];

	va_list args;
	va_start(args, message);
	vsnprintf(buffer, sizeof(buffer), message, args);
	va_end(args);

	throw TestException(fFile, fLine, "%s\n%s", fMessage.c_str(), buffer);
}
示例#22
0
	std::string VMACTest::Run()
	{
		try
		{
			Initialize();
			CompareVector(m_key, m_iv, m_expected);
			OnProgress("Passed VMAC vector tests..");
			CompareAccess(m_key, m_iv);
			OnProgress("Passed DoFinal/ComputeHash methods output comparison..");

			return SUCCESS;
		}
		catch (std::string const& ex)
		{
			throw TestException(std::string(FAILURE + " : " + ex));
		}
		catch (...)
		{
			throw TestException(std::string(FAILURE + " : Internal Error"));
		}
	}
示例#23
0
//! \cond internal
ReferenceDataEntry::EntryPointer
readReferenceDataFile(const std::string &path)
{
    XmlDocumentPointer document(xmlParseFile(path.c_str()));
    if (!document)
    {
        GMX_THROW(TestException("Reference data not parsed successfully: " + path));
    }
    xmlNodePtr rootNode = xmlDocGetRootElement(document.get());
    if (rootNode == NULL)
    {
        GMX_THROW(TestException("Reference data is empty: " + path));
    }
    if (xmlStrcmp(rootNode->name, cRootNodeName) != 0)
    {
        GMX_THROW(TestException("Invalid root node type in " + path));
    }

    ReferenceDataEntry::EntryPointer rootEntry(ReferenceDataEntry::createRoot());
    readEntry(rootNode, rootEntry.get());
    return move(rootEntry);
}
示例#24
0
void init_listener()
{
  for (int i = 0; i < 2; ++i)
  {
    listener[i] = new DataReaderListenerImpl();

    if (CORBA::is_nil (listener[i].in ()))
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) listener is nil.")));
        throw TestException ();
      }
  }
}
示例#25
0
	std::string HMACTest::Run()
	{
		try
		{
			Initialize();

			CompareVector256(m_keys[0], m_input[0], m_expected256[0]);
			CompareVector256(m_keys[1], m_input[1], m_expected256[1]);
			CompareVector256(m_keys[2], m_input[2], m_expected256[2]);
			CompareVector256(m_keys[3], m_input[3], m_expected256[3]);
			CompareVector256(m_keys[4], m_input[4], m_expected256[4]);
			CompareVector256(m_keys[5], m_input[5], m_expected256[5]);
			CompareVector256(m_keys[6], m_input[6], m_expected256[6]);
			OnProgress("HMACTest: Passed SHA-2 256 bit known answer vector tests..");

			CompareVector512(m_keys[0], m_input[0], m_expected512[0]);
			CompareVector512(m_keys[1], m_input[1], m_expected512[1]);
			CompareVector512(m_keys[2], m_input[2], m_expected512[2]);
			CompareVector512(m_keys[3], m_input[3], m_expected512[3]);
			CompareVector512(m_keys[4], m_input[4], m_expected512[4]);
			CompareVector512(m_keys[5], m_input[5], m_expected512[5]);
			CompareVector512(m_keys[6], m_input[6], m_expected512[6]);
			OnProgress("HMACTest: Passed SHA-2 512 bit known answer vector tests..");

			CompareAccess(m_keys[3]);
			OnProgress("Passed DoFinal/ComputeHash methods output comparison..");

			return SUCCESS;
		}
		catch (std::string const& ex)
		{
			throw TestException(std::string(FAILURE + " : " + ex));
		}
		catch (...)
		{
			throw TestException(std::string(FAILURE + " : Internal Error"));
		}
	}
示例#26
0
void ActivityLog::expect(ActivityLogLine test_log_entry, bool exact_match)
{
    string expected = test_log_entry.content;

    // Get the next result that is not part of the ignored labels.
    ActivityLogLine test_result;
    do
    {
        int counter = 0;
        while (!test_results.HasData())
        {
            boost::this_thread::sleep(boost::posix_time::milliseconds(5));
            if (++counter > 100)
            {
                //string msg = "Timed out waiting on next test result.";
                //string log_line = test_log_entry.label + ": " + expected;
                //cerr << msg << " expected " << log_line << endl;
                //throw boost::enable_current_exception(TestException(msg, log_line, ""));
            }
        }
        test_result = test_results.ReadData();
    }
    while   (test_plan.actionType(test_result) == TestActionType::ignore);

    if (test_result.label != test_log_entry.label)
    {
        cerr << "Did not get expected label, expected " << test_log_entry.label << " got " << test_result.label << endl;
        raiseError(TestException("Did not get expected label", test_log_entry.label, test_result.label));
    }
    else if (exact_match && test_result.content != test_log_entry.content)
    {
        string actual = test_result.content;

        print_error(expected, actual);

        raiseError(TestException("Did not get expected content", expected, actual));
    }
}
示例#27
0
void
Writer::start ()
{
  ACE_DEBUG((LM_DEBUG,
    ACE_TEXT(" %P|%t Writer::start \n")));
  if (activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1)
  {
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT(" %P|%t Writer::start, ")
                ACE_TEXT ("%p."),
                "activate"));
    throw TestException ();
  }
}
示例#28
0
void
SubDriver::parse_arg_n(const char* arg, bool& flag)
{
  if (flag)
    {
      ACE_ERROR((LM_ERROR,
             "(%P|%t) Only one -n allowed on command-line.\n"));
      throw TestException();
    }

  int value = ACE_OS::atoi(arg);

  if (value <= 0)
    {
      ACE_ERROR((LM_ERROR,
                 "(%P|%t) Value following -n option must be > 0.\n"));
      throw TestException();
    }

  this->subscriber_.set_num_to_receive(value);

  flag = true;
}
示例#29
0
//! \cond internal
void writeReferenceDataFile(const std::string        &path,
                            const ReferenceDataEntry &rootEntry)
{
    // TODO: Error checking
    XmlDocumentPointer  document(xmlNewDoc(cXmlVersion));
    xmlNodePtr          rootElement = createRootElement(document.get());
    createXsltReference(document.get(), rootElement);
    createChildElements(rootElement, rootEntry);

    if (xmlSaveFormatFile(path.c_str(), document.get(), 1) == -1)
    {
        GMX_THROW(TestException("Reference data saving failed in " + path));
    }
}
示例#30
0
void
TestDriver::init()
{
  // Create a temporary data packet just to get the num bytes per packet value.
  TestData::PacketHolder* packet;

  if ((packet = TestData::PacketFactory::create_packet(data_size_)) == 0) {
    throw TestException();
  }

  num_bytes_per_packet_ = packet->num_bytes();

  delete packet;
}