Skip to content

Commit

Permalink
Update Ref and RPI for compatibility with FPP #349 (fully qualified c…
Browse files Browse the repository at this point in the history
…omponent instance names) (#2823)

* updated ref and rpi integration tests

* fix component qualifiers

* FPP v2.2.0a1

* fix py file formatting

* add new line

* remove newline

* file py file formatting

* fprime-gds v3.4.4a3

* fix typo in integration test command name

---------

Co-authored-by: jawest <[email protected]>
  • Loading branch information
jwest115 and jawest committed Sep 4, 2024
1 parent 66d5128 commit 672538d
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 135 deletions.
18 changes: 9 additions & 9 deletions RPI/Top/RPITopologyDefs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ namespace RPI {

// Health ping entries
namespace PingEntries {
namespace rateGroup10HzComp { enum { WARN = 3, FATAL = 5 }; }
namespace rateGroup1HzComp { enum { WARN = 3, FATAL = 5 }; }
namespace cmdDisp { enum { WARN = 3, FATAL = 5 }; }
namespace cmdSeq { enum { WARN = 3, FATAL = 5 }; }
namespace chanTlm { enum { WARN = 3, FATAL = 5 }; }
namespace eventLogger { enum { WARN = 3, FATAL = 5 }; }
namespace prmDb { enum { WARN = 3, FATAL = 5 }; }
namespace fileDownlink { enum { WARN = 3, FATAL = 5 }; }
namespace fileUplink { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_rateGroup10HzComp { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_rateGroup1HzComp { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_cmdDisp { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_cmdSeq { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_chanTlm { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_eventLogger { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_prmDb { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_fileDownlink { enum { WARN = 3, FATAL = 5 }; }
namespace RPI_fileUplink { enum { WARN = 3, FATAL = 5 }; }
}

}
Expand Down
94 changes: 47 additions & 47 deletions RPI/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.configComponents """
rateGroup10HzComp.configure(
ConfigObjects::rateGroup10HzComp::context,
FW_NUM_ARRAY_ELEMENTS(ConfigObjects::rateGroup10HzComp::context)
RPI::rateGroup10HzComp.configure(
ConfigObjects::RPI_rateGroup10HzComp::context,
FW_NUM_ARRAY_ELEMENTS(ConfigObjects::RPI_rateGroup10HzComp::context)
);
"""

Expand All @@ -51,8 +51,8 @@ module RPI {
priority 20 \
{
phase Fpp.ToCpp.Phases.readParameters """
prmDb.configure("PrmDb.dat");
prmDb.readParamFile();
RPI::prmDb.configure("PrmDb.dat");
RPI::prmDb.readParamFile();
"""

}
Expand All @@ -72,18 +72,18 @@ module RPI {

phase Fpp.ToCpp.Phases.configComponents """
{
using namespace ConfigConstants::cmdSeq;
cmdSeq.allocateBuffer(
using namespace ConfigConstants::RPI_cmdSeq;
RPI::cmdSeq.allocateBuffer(
0,
Allocation::mallocator,
ConfigConstants::cmdSeq::BUFFER_SIZE
ConfigConstants::RPI_cmdSeq::BUFFER_SIZE
);
cmdSeq.setTimeout(TIMEOUT);
RPI::cmdSeq.setTimeout(TIMEOUT);
}
"""

phase Fpp.ToCpp.Phases.tearDownComponents """
cmdSeq.deallocateBuffer(Allocation::mallocator);
RPI::cmdSeq.deallocateBuffer(Allocation::mallocator);
"""

}
Expand All @@ -104,9 +104,9 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.configComponents """
rateGroup1HzComp.configure(
ConfigObjects::rateGroup1HzComp::context,
FW_NUM_ARRAY_ELEMENTS(ConfigObjects::rateGroup1HzComp::context)
RPI::rateGroup1HzComp.configure(
ConfigObjects::RPI_rateGroup1HzComp::context,
FW_NUM_ARRAY_ELEMENTS(ConfigObjects::RPI_rateGroup1HzComp::context)
);
"""

Expand All @@ -133,11 +133,11 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.configComponents """
fileDownlink.configure(
ConfigConstants::fileDownlink::TIMEOUT,
ConfigConstants::fileDownlink::COOLDOWN,
ConfigConstants::fileDownlink::CYCLE_TIME,
ConfigConstants::fileDownlink::FILE_QUEUE_DEPTH
RPI::fileDownlink.configure(
ConfigConstants::RPI_fileDownlink::TIMEOUT,
ConfigConstants::RPI_fileDownlink::COOLDOWN,
ConfigConstants::RPI_fileDownlink::CYCLE_TIME,
ConfigConstants::RPI_fileDownlink::FILE_QUEUE_DEPTH
);
"""

Expand All @@ -163,10 +163,10 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.configComponents """
health.setPingEntries(
ConfigObjects::health::pingEntries,
FW_NUM_ARRAY_ELEMENTS(ConfigObjects::health::pingEntries),
ConfigConstants::health::WATCHDOG_CODE
RPI::health.setPingEntries(
ConfigObjects::RPI_health::pingEntries,
FW_NUM_ARRAY_ELEMENTS(ConfigObjects::RPI_health::pingEntries),
ConfigConstants::RPI_health::WATCHDOG_CODE
);
"""

Expand All @@ -193,10 +193,10 @@ module RPI {
{
Svc::BufferManager::BufferBins bufferBins;
memset(&bufferBins, 0, sizeof(bufferBins));
using namespace ConfigConstants::fileUplinkBufferManager;
using namespace ConfigConstants::RPI_fileUplinkBufferManager;
bufferBins.bins[0].bufferSize = STORE_SIZE;
bufferBins.bins[0].numBuffers = QUEUE_SIZE;
fileUplinkBufferManager.setup(
RPI::fileUplinkBufferManager.setup(
MGR_ID,
0,
Allocation::mallocator,
Expand All @@ -207,7 +207,7 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.tearDownComponents """
fileUplinkBufferManager.cleanup();
RPI::fileUplinkBufferManager.cleanup();
"""

}
Expand All @@ -224,7 +224,7 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.configComponents """
downlink.setup(ConfigObjects::downlink::framing);
RPI::downlink.setup(ConfigObjects::RPI_downlink::framing);
"""

}
Expand All @@ -237,7 +237,7 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.configComponents """
uplink.setup(ConfigObjects::uplink::deframing);
RPI::uplink.setup(ConfigObjects::RPI_uplink::deframing);
"""

}
Expand All @@ -257,21 +257,21 @@ module RPI {
if (state.hostName != nullptr && state.portNumber != 0) {
Os::TaskString name("ReceiveTask");
// Uplink is configured for receive so a socket task is started
comm.configure(state.hostName, state.portNumber);
comm.start(
RPI::comm.configure(state.hostName, state.portNumber);
RPI::comm.start(
name,
ConfigConstants::comm::PRIORITY,
ConfigConstants::comm::STACK_SIZE
ConfigConstants::RPI_comm::PRIORITY,
ConfigConstants::RPI_comm::STACK_SIZE
);
}
"""

phase Fpp.ToCpp.Phases.stopTasks """
comm.stop();
RPI::comm.stop();
"""

phase Fpp.ToCpp.Phases.freeThreads """
(void) comm.join();
(void) RPI::comm.join();
"""

}
Expand All @@ -282,7 +282,7 @@ module RPI {
{

phase Fpp.ToCpp.Phases.stopTasks """
linuxTimer.quit();
RPI::linuxTimer.quit();
"""

}
Expand All @@ -295,8 +295,8 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.configComponents """
rateGroupDriverComp.configure(
ConfigObjects::rateGroupDriverComp::rgDivs
RPI::rateGroupDriverComp.configure(
ConfigObjects::RPI_rateGroupDriverComp::rgDivs
);
"""
}
Expand All @@ -323,15 +323,15 @@ module RPI {

phase Fpp.ToCpp.Phases.startTasks """
if (Init::status) {
uartDrv.start();
RPI::uartDrv.start();
}
else {
Fw::Logger::log("[ERROR] Initialization failed; not starting UART driver\\n");
}
"""

phase Fpp.ToCpp.Phases.stopTasks """
uartDrv.quitReadThread();
RPI::uartDrv.quitReadThread();
"""

}
Expand All @@ -341,7 +341,7 @@ module RPI {

phase Fpp.ToCpp.Phases.configComponents """
{
const bool status = ledDrv.open(21, Drv::LinuxGpioDriverComponentImpl::GPIO_OUT);
const bool status = RPI::ledDrv.open(21, Drv::LinuxGpioDriverComponentImpl::GPIO_OUT);
if (!status) {
Fw::Logger::log("[ERROR] Could not open LED driver\\n");
Init::status = false;
Expand All @@ -356,7 +356,7 @@ module RPI {

phase Fpp.ToCpp.Phases.configComponents """
{
const bool status = gpio23Drv.open(23, Drv::LinuxGpioDriverComponentImpl::GPIO_OUT);
const bool status = RPI::gpio23Drv.open(23, Drv::LinuxGpioDriverComponentImpl::GPIO_OUT);
if (!status) {
Fw::Logger::log("[ERROR] Could not open GPIO 23 driver\\n");
Init::status = false;
Expand All @@ -371,7 +371,7 @@ module RPI {

phase Fpp.ToCpp.Phases.configComponents """
{
const bool status = gpio24Drv.open(24, Drv::LinuxGpioDriverComponentImpl::GPIO_OUT);
const bool status = RPI::gpio24Drv.open(24, Drv::LinuxGpioDriverComponentImpl::GPIO_OUT);
if (!status) {
Fw::Logger::log("[ERROR] Could not open GPIO 24 driver\\n");
Init::status = false;
Expand All @@ -386,7 +386,7 @@ module RPI {

phase Fpp.ToCpp.Phases.configComponents """
{
const bool status = gpio25Drv.open(25, Drv::LinuxGpioDriverComponentImpl::GPIO_IN);
const bool status = RPI::gpio25Drv.open(25, Drv::LinuxGpioDriverComponentImpl::GPIO_IN);
if (!status) {
Fw::Logger::log("[ERROR] Could not open GPIO 25 driver\\n");
Init::status = false;
Expand All @@ -401,7 +401,7 @@ module RPI {

phase Fpp.ToCpp.Phases.configComponents """
{
const bool status = gpio17Drv.open(17, Drv::LinuxGpioDriverComponentImpl::GPIO_IN);
const bool status = RPI::gpio17Drv.open(17, Drv::LinuxGpioDriverComponentImpl::GPIO_IN);
if (!status) {
Fw::Logger::log("[ERROR] Could not open GPIO 17 driver\\n");
Init::status = false;
Expand All @@ -416,7 +416,7 @@ module RPI {

phase Fpp.ToCpp.Phases.configComponents """
{
const bool status = spiDrv.open(0, 0, Drv::SPI_FREQUENCY_1MHZ);
const bool status = RPI::spiDrv.open(0, 0, Drv::SPI_FREQUENCY_1MHZ);
if (!status) {
Fw::Logger::log("[ERROR] Could not open SPI driver\\n");
Init::status = false;
Expand All @@ -441,10 +441,10 @@ module RPI {
{
Svc::BufferManager::BufferBins bufferBins;
memset(&bufferBins, 0, sizeof(bufferBins));
using namespace ConfigConstants::uartBufferManager;
using namespace ConfigConstants::RPI_uartBufferManager;
bufferBins.bins[0].bufferSize = STORE_SIZE;
bufferBins.bins[0].numBuffers = QUEUE_SIZE;
uartBufferManager.setup(
RPI::uartBufferManager.setup(
MGR_ID,
0,
Allocation::mallocator,
Expand All @@ -455,7 +455,7 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.tearDownComponents """
uartBufferManager.cleanup();
RPI::uartBufferManager.cleanup();
"""
}

Expand Down
24 changes: 14 additions & 10 deletions RPI/test/int/rpi_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def set_event_filter(fprime_test_api, severity, enabled):
severity = FilterSeverity[severity].name
try:
fprime_test_api.send_command(
"eventLogger.SET_EVENT_FILTER",
"RPI.eventLogger.SET_EVENT_FILTER",
[severity, enabled],
)
return True
Expand Down Expand Up @@ -61,21 +61,25 @@ def test_is_streaming(fprime_test_api):


def test_send_command(fprime_test_api):
fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP", max_delay=0.1)
fprime_test_api.send_and_assert_command("RPI.cmdDisp.CMD_NO_OP", max_delay=0.1)
assert fprime_test_api.get_command_test_history().size() == 1
fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP", max_delay=0.1)
fprime_test_api.send_and_assert_command("RPI.cmdDisp.CMD_NO_OP", max_delay=0.1)
assert fprime_test_api.get_command_test_history().size() == 2


def test_send_and_assert_no_op(fprime_test_api):
length = 100
failed = 0
evr_seq = ["OpCodeDispatched", "NoOpReceived", "OpCodeCompleted"]
evr_seq = [
"RPI.cmdDisp.OpCodeDispatched",
"RPI.cmdDisp.NoOpReceived",
"RPI.cmdDisp.OpCodeCompleted",
]
any_reordered = False
dropped = False
for i in range(0, length):
results = fprime_test_api.send_and_await_event(
"cmdDisp.CMD_NO_OP", events=evr_seq, timeout=25
"RPI.cmdDisp.CMD_NO_OP", events=evr_seq, timeout=25
)
msg = "Send and assert NO_OP Trial #{}".format(i)
if not fprime_test_api.test_assert(len(results) == 3, msg, True):
Expand Down Expand Up @@ -129,8 +133,8 @@ def test_active_logger_filter(fprime_test_api):
# Drain time for dispatch events
time.sleep(10)

fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP")
fprime_test_api.send_and_assert_command("cmdDisp.CMD_NO_OP")
fprime_test_api.send_and_assert_command("RPI.cmdDisp.CMD_NO_OP")
fprime_test_api.send_and_assert_command("RPI.cmdDisp.CMD_NO_OP")

time.sleep(0.5)

Expand All @@ -141,8 +145,8 @@ def test_active_logger_filter(fprime_test_api):
# Drain time for dispatch events
time.sleep(10)
fprime_test_api.clear_histories()
fprime_test_api.send_command("cmdDisp.CMD_NO_OP")
fprime_test_api.send_command("cmdDisp.CMD_NO_OP")
fprime_test_api.send_command("RPI.cmdDisp.CMD_NO_OP")
fprime_test_api.send_command("RPI.cmdDisp.CMD_NO_OP")

time.sleep(0.5)

Expand All @@ -168,5 +172,5 @@ def test_seqgen(fprime_test_api):
== 0
), "Failed to run fprime-seqgen"
fprime_test_api.send_and_assert_command(
"cmdSeq.CS_RUN", args=["/tmp/ref_test_int.bin", "BLOCK"], max_delay=5
"RPI.cmdSeq.CS_RUN", args=["/tmp/ref_test_int.bin", "BLOCK"], max_delay=5
)
4 changes: 2 additions & 2 deletions RPI/test/int/test_seq.seq
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; A test sequence
;
R00:00:00 cmdDisp.CMD_NO_OP
R00:00:00 RPI.cmdDisp.CMD_NO_OP

; Let's try out some commands with arguments
R00:00:01.050 cmdDisp.CMD_NO_OP_STRING "Awesome string!";
R00:00:01.050 RPI.cmdDisp.CMD_NO_OP_STRING "Awesome string!";
Loading

0 comments on commit 672538d

Please sign in to comment.