From 5f8adc63b70298c0d6163219ad8782de76c22460 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 26 Oct 2021 17:16:21 +0200 Subject: [PATCH] some more fixes for integration tests --- .../integration/assemblies/TestAssembly.cpp | 4 ++-- .../integration/controller/TestController.cpp | 11 ++++++----- .../integration/controller/TestController.h | 3 ++- .../integration/devices/TestDeviceHandler.cpp | 8 +------- .../devices/devicedefinitions/testDeviceDefinitions.h | 3 --- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp index 1c497ebd..0ead4bfd 100644 --- a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp +++ b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp @@ -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; } diff --git a/tests/src/fsfw_tests/integration/controller/TestController.cpp b/tests/src/fsfw_tests/integration/controller/TestController.cpp index 385d07bd..96da5fe3 100644 --- a/tests/src/fsfw_tests/integration/controller/TestController.cpp +++ b/tests/src/fsfw_tests/integration/controller/TestController.cpp @@ -5,10 +5,11 @@ #include #include -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( - 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( - objects::TEST_DEVICE_HANDLER_1); + deviceDataset0.getCreatorObjectId()); if(device1 == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 1 " diff --git a/tests/src/fsfw_tests/integration/controller/TestController.h b/tests/src/fsfw_tests/integration/controller/TestController.h index 8092f945..475d8703 100644 --- a/tests/src/fsfw_tests/integration/controller/TestController.h +++ b/tests/src/fsfw_tests/integration/controller/TestController.h @@ -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; diff --git a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp index 91019487..46138c56 100644 --- a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp +++ b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp @@ -644,13 +644,7 @@ ReturnValue_t TestDevice::initializeLocalDataPool(localpool::DataPool &localData localDataPoolMap.emplace(td::PoolIds::TEST_FLOAT_VEC_3_ID, new PoolEntry({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); diff --git a/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h b/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h index 10668b94..1c112e3f 100644 --- a/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h +++ b/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h @@ -3,7 +3,6 @@ #include #include -#include 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: