mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 17:47:10 -06:00
* Revise GenericHub model * Revise GenericHub model * Revise GenericHub model * Update spelling * Revise annotations * Revise annotations for GenericHub model * Revise annotations in GenericHub model * Revise GenericHub model * Revise GenericHub model * Revise GenericHub model * Revise GenericHub * Revise GenericHub * Revise GenericHub model * Revise GenericHub model * Revise GenericHub config * Revise GenericHub model * Revise GenericHub model * Clean up naming in GenericHub implementation * Revise GenericHub port names * Revise annotations in GenericHub model * Revise annotations in GenericHub model * Revise annotations in GenericHub model * Add ByteStreamDriverClient * Revise ByteStreamDriverClient * Revise ByteStreamDriverClient * Revise driver interfaces * Add PassiveByteStreamDriverClientSendAsync interface * Add PassiveAsyncByteStreamDriverClient interface * Add PassiveBufferDriver * Revise PassiveByteStreamDriverClient interfaces * Revise PassiveBufferDriver * Revise Drv interfaces * Revise PassiveBufferDriver * Add PassiveBufferDriverClient * Revise GenericHub model Use interfaces from Drv * Revise annotations in GenericHub model * Revise FPP models Point FPP to a non-released version with a bug fix * Add ByteStreamBufferAdapter * Revise ByteStreamBufferAdapter model * Revise ByteStreamBufferAdapter * Revise ByteStreamBufferAdapter * Add AsyncByteStreamBufferAdapter * Revise AsyncByteStreamBufferAdapter * Revsie AsyncByteStreamBufferAdapter * Revise AsyncByteStreamBufferAdapter * Revise annotations in FPP model * Revise ByteStreamBufferAdapter * Bump fpp version * Revise GenericHub model * Revise GenericHub interface * Revise GenericHub interface * Fix typo in FPP annotations * Revise Generic Hub model * Fix spelling and formatting * Review recommendations --------- Co-authored-by: Rob Bocchino <bocchino@jpl.nasa.gov> Co-authored-by: thomas-bc <thomas.boyerchammard@gmail.com>
164 lines
5.2 KiB
C++
164 lines
5.2 KiB
C++
// ======================================================================
|
|
// \title GenericHub/test/ut/Tester.hpp
|
|
// \author mstarch
|
|
// \brief hpp file for GenericHub test harness implementation class
|
|
//
|
|
// \copyright
|
|
// Copyright 2009-2015, by the California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#ifndef TESTER_HPP
|
|
#define TESTER_HPP
|
|
#include <Fw/Com/ComBuffer.hpp>
|
|
#include "GenericHubGTestBase.hpp"
|
|
#include "Svc/GenericHub/GenericHub.hpp"
|
|
|
|
// Larger than com buffer size
|
|
#define DATA_SIZE (FW_COM_BUFFER_MAX_SIZE * 10 + sizeof(U32) + sizeof(U32) + sizeof(FwBuffSizeType))
|
|
|
|
namespace Svc {
|
|
|
|
class GenericHubTester : public GenericHubGTestBase {
|
|
// ----------------------------------------------------------------------
|
|
// Construction and destruction
|
|
// ----------------------------------------------------------------------
|
|
|
|
public:
|
|
//! Construct object GenericHubTester
|
|
//!
|
|
GenericHubTester();
|
|
|
|
//! Destroy object GenericHubTester
|
|
//!
|
|
~GenericHubTester();
|
|
|
|
public:
|
|
// ----------------------------------------------------------------------
|
|
// Tests
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Test of basic in/out of a set of serialized ports
|
|
//!
|
|
void test_in_out();
|
|
|
|
//! Test of buffer in/out of a set of buffer ports
|
|
//!
|
|
void test_buffer_io();
|
|
|
|
//! Test of random in/out of a set of file and normal ports
|
|
//!
|
|
void test_random_io();
|
|
|
|
//! Test of telemetry in-out
|
|
//!
|
|
void test_telemetry();
|
|
|
|
//! Test of event in-out
|
|
//!
|
|
void test_events();
|
|
|
|
private:
|
|
// ----------------------------------------------------------------------
|
|
// Handlers for typed from ports
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Handler for from_eventOut
|
|
//!
|
|
void from_eventOut_handler(const FwIndexType portNum, /*!< The port number*/
|
|
FwEventIdType id, /*!< Log ID */
|
|
Fw::Time& timeTag, /*!< Time Tag */
|
|
const Fw::LogSeverity& severity, /*!< The severity argument */
|
|
Fw::LogBuffer& args /*!< Buffer containing serialized log entry */
|
|
);
|
|
|
|
//! Handler for from_tlmOut
|
|
//!
|
|
void from_tlmOut_handler(const FwIndexType portNum, /*!< The port number*/
|
|
FwChanIdType id, /*!< Telemetry Channel ID */
|
|
Fw::Time& timeTag, /*!< Time Tag */
|
|
Fw::TlmBuffer& val /*!< Buffer containing serialized telemetry value */
|
|
);
|
|
|
|
//! Handler for from_bufferOut
|
|
//!
|
|
void from_bufferOut_handler(const FwIndexType portNum, /*!< The port number*/
|
|
Fw::Buffer& fwBuffer);
|
|
|
|
//! Handler for from_bufferInReturn
|
|
//!
|
|
void from_bufferInReturn_handler(const FwIndexType portNum, /*!< The port number*/
|
|
Fw::Buffer& fwBuffer);
|
|
|
|
//! Handler for from_allocate
|
|
//!
|
|
Fw::Buffer from_allocate_handler(const FwIndexType portNum, /*!< The port number*/
|
|
FwSizeType size);
|
|
|
|
//! Handler for from_toBufferDriver
|
|
//!
|
|
void from_toBufferDriver_handler(const FwIndexType portNum, /*!< The port number*/
|
|
Fw::Buffer& fwBuffer);
|
|
|
|
//! Handler for from_dataDeallocate
|
|
//!
|
|
void from_fromBufferDriverReturn_handler(const FwIndexType portNum, /*!< The port number*/
|
|
Fw::Buffer& fwBuffer);
|
|
|
|
private:
|
|
// ----------------------------------------------------------------------
|
|
// Handlers for serial from ports
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Handler for from_serialOut
|
|
//!
|
|
void from_serialOut_handler(FwIndexType portNum, /*!< The port number*/
|
|
Fw::SerializeBufferBase& Buffer /*!< The serialization buffer*/
|
|
);
|
|
|
|
private:
|
|
void send_random_comm(U32 port);
|
|
|
|
void send_random_buffer(U32 port);
|
|
|
|
void random_fill(Fw::SerializeBufferBase& buffer, U32 max_size);
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Helper methods
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Connect ports
|
|
//!
|
|
void connectPorts();
|
|
|
|
//! Initialize components
|
|
//!
|
|
void initComponents();
|
|
|
|
private:
|
|
// ----------------------------------------------------------------------
|
|
// Variables
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! The component under test
|
|
//!
|
|
GenericHub componentIn;
|
|
GenericHub componentOut;
|
|
Fw::ComBuffer m_comm;
|
|
Fw::Buffer m_buffer;
|
|
Fw::Buffer m_allocate;
|
|
U32 m_comm_in;
|
|
U32 m_buffer_in;
|
|
U32 m_comm_out;
|
|
U32 m_buffer_out;
|
|
U32 m_current_port;
|
|
U8 m_data_store[DATA_SIZE];
|
|
U8 m_data_for_allocation[DATA_SIZE];
|
|
};
|
|
|
|
} // end namespace Svc
|
|
|
|
#endif
|