From 7b6456b87976af911cfe5aef53911ce2c90e0dd0 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Thu, 4 Dec 2025 20:41:05 -0800 Subject: [PATCH] Revise top tests --- .../test/top/check-cpp-dir/Params/check | 21 ++------------- .../top/{ => params}/ParamsTopologyAc.ref.cpp | 26 ++++++++++++++++--- .../top/{ => params}/ParamsTopologyAc.ref.hpp | 0 .../fpp-to-cpp/test/top/params/components.fpp | 19 ++++++++++++++ .../top/{params.fpp => params/topology.fpp} | 16 ------------ .../topology.ref.txt} | 0 compiler/tools/fpp-to-cpp/test/top/run.sh | 4 +-- .../tools/fpp-to-cpp/test/top/update-ref.sh | 4 +-- 8 files changed, 47 insertions(+), 43 deletions(-) rename compiler/tools/fpp-to-cpp/test/top/{ => params}/ParamsTopologyAc.ref.cpp (91%) rename compiler/tools/fpp-to-cpp/test/top/{ => params}/ParamsTopologyAc.ref.hpp (100%) create mode 100644 compiler/tools/fpp-to-cpp/test/top/params/components.fpp rename compiler/tools/fpp-to-cpp/test/top/{params.fpp => params/topology.fpp} (58%) rename compiler/tools/fpp-to-cpp/test/top/{params.ref.txt => params/topology.ref.txt} (100%) diff --git a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Params/check b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Params/check index f3f146739..1050ef245 100755 --- a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Params/check +++ b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Params/check @@ -1,22 +1,5 @@ #!/bin/sh -e -echo ' removing old files' -./clean +. `dirname $0`/../check_topology.sh -echo ' generating C++' -( - cd ../..; - fpp_to_cpp=../../../../bin/fpp-to-cpp - fprime_dir=../fprime - $fpp_to_cpp -p $PWD -i $fprime_dir/config/FpConfig.fpp,$fprime_dir/Platform/PlatformTypes.fpp,$fprime_dir/Fw/Prm/Prm.fpp,phases.fpp \ - $fprime_dir/Fw/Cmd/Cmd.fpp -d check-cpp-dir/Params params.fpp -) - -fprime_gcc=../../../../../../scripts/fprime-gcc -flags="-I.. -I../../../fprime -I../../../fprime/config -Wno-unused-parameter -c" -echo ' compiling C++' -for variable_flags in '' '-DFW_DIRECT_PORT_CALLS' -do - echo " variable_flags=$variable_flags" - $fprime_gcc $variable_flags $flags ParamsTopologyAc.cpp -done +check_topology params Params diff --git a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/params/ParamsTopologyAc.ref.cpp similarity index 91% rename from compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp rename to compiler/tools/fpp-to-cpp/test/top/params/ParamsTopologyAc.ref.cpp index b7c05b34a..69596265b 100644 --- a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/params/ParamsTopologyAc.ref.cpp @@ -171,7 +171,10 @@ namespace M { return result; } - void CComponentBase::cmdRegOut_out(FwIndexType portNum) const { + void CComponentBase::cmdRegOut_out( + FwIndexType portNum, + FwOpcodeType opCode + ) const { FW_ASSERT( (0 <= portNum) && (portNum < NUM_CMDREGOUT_OUTPUT_PORTS), static_cast(portNum), @@ -185,7 +188,12 @@ namespace M { } } - void CComponentBase::cmdResponseIn_out(FwIndexType portNum) const { + void CComponentBase::cmdResponseIn_out( + FwIndexType portNum, + FwOpcodeType opCode, + U32 cmdSeq, + const Fw::CmdResponse& response + ) const { FW_ASSERT( (0 <= portNum) && (portNum < NUM_CMDRESPONSEIN_OUTPUT_PORTS), static_cast(portNum), @@ -199,21 +207,31 @@ namespace M { } } - void CComponentBase::prmGetOut_out(FwIndexType portNum) const { + Fw::ParamValid CComponentBase::prmGetOut_out( + FwIndexType portNum, + FwPrmIdType id, + Fw::ParamBuffer& val + ) const { FW_ASSERT( (0 <= portNum) && (portNum < NUM_PRMGETOUT_OUTPUT_PORTS), static_cast(portNum), static_cast(NUM_PRMGETOUT_OUTPUT_PORTS) ); const auto instance = this->getInstance(); + Fw::ParamValid _result = {}; switch (instance) { default: FW_ASSERT(0, static_cast(instance)); break; } + return _result; } - void CComponentBase::prmSetOut_out(FwIndexType portNum) const { + void CComponentBase::prmSetOut_out( + FwIndexType portNum, + FwPrmIdType id, + Fw::ParamBuffer& val + ) const { FW_ASSERT( (0 <= portNum) && (portNum < NUM_PRMSETOUT_OUTPUT_PORTS), static_cast(portNum), diff --git a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/params/ParamsTopologyAc.ref.hpp similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp rename to compiler/tools/fpp-to-cpp/test/top/params/ParamsTopologyAc.ref.hpp diff --git a/compiler/tools/fpp-to-cpp/test/top/params/components.fpp b/compiler/tools/fpp-to-cpp/test/top/params/components.fpp new file mode 100644 index 000000000..977feb396 --- /dev/null +++ b/compiler/tools/fpp-to-cpp/test/top/params/components.fpp @@ -0,0 +1,19 @@ +module M { + + passive component C { + + command recv port cmdOut + + command reg port cmdRegOut + + command resp port cmdResponseIn + + param P: U32 + + param get port prmGetOut + + param set port prmSetOut + + } + +} diff --git a/compiler/tools/fpp-to-cpp/test/top/params.fpp b/compiler/tools/fpp-to-cpp/test/top/params/topology.fpp similarity index 58% rename from compiler/tools/fpp-to-cpp/test/top/params.fpp rename to compiler/tools/fpp-to-cpp/test/top/params/topology.fpp index 23053a8a4..802da7121 100644 --- a/compiler/tools/fpp-to-cpp/test/top/params.fpp +++ b/compiler/tools/fpp-to-cpp/test/top/params/topology.fpp @@ -1,21 +1,5 @@ module M { - passive component C { - - command recv port cmdOut - - command reg port cmdRegOut - - command resp port cmdResponseIn - - param P: U32 - - param get port prmGetOut - - param set port prmSetOut - - } - instance c1: C base id 0x100 { phase Phases.readParameters """ diff --git a/compiler/tools/fpp-to-cpp/test/top/params.ref.txt b/compiler/tools/fpp-to-cpp/test/top/params/topology.ref.txt similarity index 100% rename from compiler/tools/fpp-to-cpp/test/top/params.ref.txt rename to compiler/tools/fpp-to-cpp/test/top/params/topology.ref.txt diff --git a/compiler/tools/fpp-to-cpp/test/top/run.sh b/compiler/tools/fpp-to-cpp/test/top/run.sh index 48fb7207a..d740077ea 100644 --- a/compiler/tools/fpp-to-cpp/test/top/run.sh +++ b/compiler/tools/fpp-to-cpp/test/top/run.sh @@ -36,8 +36,8 @@ no_namespace() params() { - cd $TOP_DIR - run_test "-i builtin.fpp -p $PWD" params && \ + cd $TOP_DIR/params + run_test "-p $PWD -i $FPRIME_DEPS,../phases.fpp,components.fpp" topology && \ diff_cpp ParamsTopology } diff --git a/compiler/tools/fpp-to-cpp/test/top/update-ref.sh b/compiler/tools/fpp-to-cpp/test/top/update-ref.sh index 81766b4ac..178a94afb 100644 --- a/compiler/tools/fpp-to-cpp/test/top/update-ref.sh +++ b/compiler/tools/fpp-to-cpp/test/top/update-ref.sh @@ -36,8 +36,8 @@ no_namespace() params() { - cd $TOP_DIR - update "-i builtin.fpp -p $PWD" params + cd $TOP_DIR/params + update "-p $PWD -i $FPRIME_DEPS,../phases.fpp,components.fpp" topology move_cpp ParamsTopology }