Merge branch 'development' into mueller/cfdp-init
This commit is contained in:
commit
07a09d532e
@ -5,4 +5,4 @@ RUN apt-get --yes upgrade
|
||||
|
||||
#tzdata is a dependency, won't install otherwise
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get --yes install gcc g++ cmake lcov git nano
|
||||
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano
|
||||
|
50
automation/Jenkinsfile
vendored
50
automation/Jenkinsfile
vendored
@ -1,12 +1,10 @@
|
||||
pipeline {
|
||||
agent any
|
||||
environment {
|
||||
BUILDDIR = 'build-unittests'
|
||||
}
|
||||
stages {
|
||||
stage('Clean') {
|
||||
steps {
|
||||
sh 'rm -rf build-unittests'
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
stage('Create Docker') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
@ -15,8 +13,31 @@ pipeline {
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir('build-unittests') {
|
||||
sh 'rm -rf $BUILDDIR'
|
||||
}
|
||||
}
|
||||
stage('Configure') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir(BUILDDIR) {
|
||||
sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir(BUILDDIR) {
|
||||
sh 'cmake --build . -j'
|
||||
}
|
||||
}
|
||||
@ -29,10 +50,23 @@ pipeline {
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir('build-unittests') {
|
||||
dir(BUILDDIR) {
|
||||
sh 'cmake --build . -- fsfw-tests_coverage -j'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Valgrind') {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'automation'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
dir(BUILDDIR) {
|
||||
sh 'valgrind --leak-check=full --error-exitcode=1 ./fsfw-tests'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
add_subdirectory(integration)
|
||||
|
||||
if(FSFW_ADD_INTERNAL_TESTS)
|
||||
add_subdirectory(internal)
|
||||
endif()
|
||||
|
||||
if(FSFW_BUILD_UNITTESTS)
|
||||
add_subdirectory(unit)
|
||||
else()
|
||||
add_subdirectory(integration)
|
||||
endif()
|
||||
|
@ -160,11 +160,11 @@ ReturnValue_t TestAssembly::initialize() {
|
||||
handler1->setParentQueue(this->getCommandQueue());
|
||||
|
||||
|
||||
result = registerChild(objects::TEST_DEVICE_HANDLER_0);
|
||||
result = registerChild(deviceHandler0Id);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = registerChild(objects::TEST_DEVICE_HANDLER_1);
|
||||
result = registerChild(deviceHandler1Id);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
@ -5,10 +5,11 @@
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
|
||||
TestController::TestController(object_id_t objectId, size_t commandQueueDepth):
|
||||
TestController::TestController(object_id_t objectId, object_id_t device0, object_id_t device1,
|
||||
size_t commandQueueDepth):
|
||||
ExtendedControllerBase(objectId, objects::NO_OBJECT, commandQueueDepth),
|
||||
deviceDataset0(objects::TEST_DEVICE_HANDLER_0),
|
||||
deviceDataset1(objects::TEST_DEVICE_HANDLER_1) {
|
||||
deviceDataset0(device0),
|
||||
deviceDataset1(device1) {
|
||||
}
|
||||
|
||||
TestController::~TestController() {
|
||||
@ -163,7 +164,7 @@ ReturnValue_t TestController::initializeLocalDataPool(localpool::DataPool &local
|
||||
ReturnValue_t TestController::initializeAfterTaskCreation() {
|
||||
namespace td = testdevice;
|
||||
HasLocalDataPoolIF* device0 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
objects::TEST_DEVICE_HANDLER_0);
|
||||
deviceDataset0.getCreatorObjectId());
|
||||
if(device0 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 0 "
|
||||
@ -185,7 +186,7 @@ ReturnValue_t TestController::initializeAfterTaskCreation() {
|
||||
|
||||
|
||||
HasLocalDataPoolIF* device1 = ObjectManager::instance()->get<HasLocalDataPoolIF>(
|
||||
objects::TEST_DEVICE_HANDLER_1);
|
||||
deviceDataset0.getCreatorObjectId());
|
||||
if(device1 == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 1 "
|
||||
|
@ -8,7 +8,8 @@
|
||||
class TestController:
|
||||
public ExtendedControllerBase {
|
||||
public:
|
||||
TestController(object_id_t objectId, size_t commandQueueDepth = 10);
|
||||
TestController(object_id_t objectId, object_id_t device0, object_id_t device1,
|
||||
size_t commandQueueDepth = 10);
|
||||
virtual~ TestController();
|
||||
protected:
|
||||
testdevice::TestDataSet deviceDataset0;
|
||||
|
@ -644,13 +644,7 @@ ReturnValue_t TestDevice::initializeLocalDataPool(localpool::DataPool &localData
|
||||
localDataPoolMap.emplace(td::PoolIds::TEST_FLOAT_VEC_3_ID,
|
||||
new PoolEntry<float>({0.0, 0.0, 0.0}));
|
||||
|
||||
sid_t sid;
|
||||
if(deviceIdx == td::DeviceIndex::DEVICE_0) {
|
||||
sid = td::TEST_SET_DEV_0_SID;
|
||||
}
|
||||
else {
|
||||
sid = td::TEST_SET_DEV_1_SID;
|
||||
}
|
||||
sid_t sid(this->getObjectId(), td::TEST_SET_ID);
|
||||
/* Subscribe for periodic HK packets but do not enable reporting for now.
|
||||
Non-diangostic with a period of one second */
|
||||
poolManager.subscribeForPeriodicPacket(sid, false, 1.0, false);
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <commonSystemObjects.h>
|
||||
|
||||
namespace testdevice {
|
||||
|
||||
@ -79,8 +78,6 @@ enum PoolIds: lp_id_t {
|
||||
};
|
||||
|
||||
static constexpr uint8_t TEST_SET_ID = TEST_NORMAL_MODE_CMD;
|
||||
static const sid_t TEST_SET_DEV_0_SID = sid_t(objects::TEST_DEVICE_HANDLER_0, TEST_SET_ID);
|
||||
static const sid_t TEST_SET_DEV_1_SID = sid_t(objects::TEST_DEVICE_HANDLER_1, TEST_SET_ID);
|
||||
|
||||
class TestDataSet: public StaticLocalDataSet<3> {
|
||||
public:
|
||||
|
@ -6,9 +6,8 @@
|
||||
bool TestTask::oneShotAction = true;
|
||||
MutexIF* TestTask::testLock = nullptr;
|
||||
|
||||
TestTask::TestTask(object_id_t objectId, bool periodicPrintout, bool periodicEvent):
|
||||
SystemObject(objectId), testMode(testModes::A),
|
||||
periodicPrinout(periodicPrintout), periodicEvent(periodicEvent) {
|
||||
TestTask::TestTask(object_id_t objectId):
|
||||
SystemObject(objectId), testMode(testModes::A) {
|
||||
if(testLock == nullptr) {
|
||||
testLock = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
@ -52,17 +51,6 @@ ReturnValue_t TestTask::performOneShotAction() {
|
||||
ReturnValue_t TestTask::performPeriodicAction() {
|
||||
/* This is performed each task cycle */
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
||||
if(periodicPrinout) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "TestTask::performPeriodicAction: Hello World!" << std::endl;
|
||||
#else
|
||||
sif::printInfo("TestTask::performPeriodicAction: Hello World!\n");
|
||||
#endif
|
||||
}
|
||||
if(periodicEvent) {
|
||||
triggerEvent(TEST_EVENT, 0x1234, 0x4321);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,6 @@
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
#include <fsfw/storagemanager/StorageManagerIF.h>
|
||||
|
||||
#include "fsfw/events/Event.h"
|
||||
#include "events/subsystemIdRanges.h"
|
||||
|
||||
/**
|
||||
* @brief Test class for general C++ testing and any other code which will not be part of the
|
||||
* primary mission software.
|
||||
@ -19,12 +16,9 @@ class TestTask :
|
||||
public ExecutableObjectIF,
|
||||
public HasReturnvaluesIF {
|
||||
public:
|
||||
TestTask(object_id_t objectId, bool periodicPrintout = false, bool periodicEvent = false);
|
||||
TestTask(object_id_t objectId);
|
||||
virtual ~TestTask();
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0);
|
||||
|
||||
static constexpr uint8_t subsystemId = SUBSYSTEM_ID::TEST_TASK_ID;
|
||||
static constexpr Event TEST_EVENT = event::makeEvent(subsystemId, 0, severity::INFO);
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t performOneShotAction();
|
||||
@ -38,15 +32,8 @@ protected:
|
||||
};
|
||||
|
||||
testModes testMode;
|
||||
bool periodicPrinout = false;
|
||||
bool periodicEvent = false;
|
||||
|
||||
bool testFlag = false;
|
||||
uint8_t counter { 1 };
|
||||
uint8_t counterTrigger { 3 };
|
||||
|
||||
void performPusInjectorTest();
|
||||
void examplePacketTest();
|
||||
private:
|
||||
static bool oneShotAction;
|
||||
static MutexIF* testLock;
|
||||
|
@ -78,7 +78,7 @@ TEST_CASE("Ring Buffer Test" , "[RingBufferTest]") {
|
||||
TEST_CASE("Ring Buffer Test2" , "[RingBufferTest2]") {
|
||||
uint8_t testData[13]= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
|
||||
uint8_t readBuffer[10] = {13, 13, 13, 13, 13, 13, 13, 13, 13, 13};
|
||||
uint8_t* newBuffer = new uint8_t[10];
|
||||
uint8_t* newBuffer = new uint8_t[15];
|
||||
SimpleRingBuffer ringBuffer(newBuffer, 10, true, 5);
|
||||
|
||||
SECTION("Simple Test") {
|
||||
@ -168,7 +168,7 @@ TEST_CASE("Ring Buffer Test2" , "[RingBufferTest2]") {
|
||||
TEST_CASE("Ring Buffer Test3" , "[RingBufferTest3]") {
|
||||
uint8_t testData[13]= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
|
||||
uint8_t readBuffer[10] = {13, 13, 13, 13, 13, 13, 13, 13, 13, 13};
|
||||
uint8_t* newBuffer = new uint8_t[10];
|
||||
uint8_t* newBuffer = new uint8_t[25];
|
||||
SimpleRingBuffer ringBuffer(newBuffer, 10, true, 15);
|
||||
|
||||
SECTION("Simple Test") {
|
||||
|
@ -143,7 +143,7 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
||||
CHECK(cdsShort.msDay_h == Catch::Approx(timeCdsNow.msDay_h).margin(1));
|
||||
CHECK(cdsShort.msDay_hh == Catch::Approx(timeCdsNow.msDay_hh).margin(1));
|
||||
CHECK(cdsShort.msDay_l == Catch::Approx(timeCdsNow.msDay_l).margin(1));
|
||||
CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(1));
|
||||
CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(5));
|
||||
}
|
||||
|
||||
SECTION("VariableSnapshotTest") {
|
||||
@ -205,7 +205,7 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") {
|
||||
CHECK(cdsShort.msDay_h == Catch::Approx(timeCdsNow.msDay_h).margin(1));
|
||||
CHECK(cdsShort.msDay_hh == Catch::Approx(timeCdsNow.msDay_hh).margin(1));
|
||||
CHECK(cdsShort.msDay_l == Catch::Approx(timeCdsNow.msDay_l).margin(1));
|
||||
CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(1));
|
||||
CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(5));
|
||||
}
|
||||
|
||||
SECTION("VariableNotificationTest") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user