mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 17:47:10 -06:00
* Save point for PRM_SET_FILE work, add basic infrastruture * fprime-format * Create prime and backup DB, initial implementation of file based set, some UT updates * More work on Prime and Backup DBs including helper methods, utilizing those for copy, and UTs * spelling * printf in Tester fix * printf in Tester fix * printf in Tester fix * Remove a debug printf, update new method args, additional offNom Set File tests * Spelling and format * Clean up comments * Sync with upstream devel updates * Add additional UT for reverting parameter db on set file failure * Spelling and format * Updates to PrmDb after first review; change to active/staging design * Spelling * Remove FIXME comment * Review fixes * Fix UT * Format * Format II * Format III --------- Co-authored-by: M Starch <LeStarch@googlemail.com>
83 lines
2.1 KiB
C++
83 lines
2.1 KiB
C++
/*
|
|
* PrmDbTester.hpp
|
|
*
|
|
* Created on: Mar 18, 2015
|
|
* Author: tcanham
|
|
*/
|
|
|
|
#ifndef PRMDB_TEST_UT_PRMDBTESTER_HPP_
|
|
#define PRMDB_TEST_UT_PRMDBTESTER_HPP_
|
|
|
|
#include <Os/Stub/test/File.hpp>
|
|
#include <PrmDbGTestBase.hpp>
|
|
#include <Svc/PrmDb/PrmDbImpl.hpp>
|
|
#include <config/PrmDbImplTesterCfg.hpp>
|
|
|
|
namespace Svc {
|
|
|
|
class PrmDbTester : public PrmDbGTestBase {
|
|
public:
|
|
PrmDbTester(Svc::PrmDbImpl& inst);
|
|
virtual ~PrmDbTester();
|
|
|
|
void runNominalPopulate();
|
|
void runNominalSaveFile();
|
|
void runNominalLoadFile();
|
|
void runMissingExtraParams();
|
|
void runFileReadError();
|
|
void runFileWriteError();
|
|
void runDbEqualTest();
|
|
void runDbCopyTest();
|
|
void runDbCommitTest();
|
|
void runPrmFileLoadNominal();
|
|
void runPrmFileLoadWithErrors();
|
|
void runPrmFileLoadIllegal();
|
|
|
|
void runRefPrmFile();
|
|
|
|
private:
|
|
//! Handler for from_pingOut
|
|
//!
|
|
void from_pingOut_handler(const FwIndexType portNum, /*!< The port number*/
|
|
U32 key /*!< Value to return to pinger*/
|
|
);
|
|
Svc::PrmDbImpl& m_impl;
|
|
void resetEvents();
|
|
|
|
// enumeration to tell what kind of error to inject
|
|
enum ErrorType {
|
|
FILE_STATUS_ERROR, // return a bad read status
|
|
FILE_SIZE_ERROR, // return a bad size
|
|
FILE_DATA_ERROR, // return unexpected data
|
|
FILE_READ_NO_ERROR, // No error
|
|
};
|
|
Os::File::Status m_status;
|
|
FwSizeType m_waits = 0;
|
|
ErrorType m_errorType = FILE_READ_NO_ERROR;
|
|
|
|
BYTE m_io_data[PRMDB_IMPL_TESTER_MAX_READ_BUFFER];
|
|
|
|
// write call modifiers
|
|
|
|
Os::File::Status WriteInterceptor();
|
|
Os::File::Status m_testWriteStatus;
|
|
|
|
public:
|
|
class PrmDbTestFile : public Os::Stub::File::Test::TestFile {
|
|
public:
|
|
Status read(U8* buffer, FwSizeType& size, WaitType wait) override;
|
|
|
|
Status write(const U8* buffer, FwSizeType& size, WaitType wait) override;
|
|
|
|
// Tracks the current tester
|
|
static void setTester(PrmDbTester* tester);
|
|
static PrmDbTester* s_tester;
|
|
};
|
|
|
|
void printDb(PrmDb_PrmDbType dbType);
|
|
};
|
|
|
|
} // namespace Svc
|
|
|
|
#endif /* PRMDB_TEST_UT_PRMDBTESTER_HPP_ */
|