Skip to content
Open
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1ab161f
DPCat Docs fix transposed words
Willmac16 Aug 27, 2025
5df1d5e
Migrate file processing into processFile & Fix/ReEnable most DpCat UTs
Willmac16 Aug 27, 2025
1471acf
substring_find_last & addToCat handler
Willmac16 Aug 28, 2025
c67494a
New Warnings & Style Tweaks
Willmac16 Sep 5, 2025
f5af805
Migrate DpCat to new register_fprime_* format
Willmac16 Sep 8, 2025
8970ee3
Prevent UT State Files from Persisting
Willmac16 Sep 8, 2025
7a1904b
Ignore /Testing & *.swp
Willmac16 Sep 8, 2025
f79d5b0
Test Runtime Addition & Add remainActive parameter
Willmac16 Sep 9, 2025
e7e17d4
Only Reset DpCat Traversal Stack if addition is higher priority
Willmac16 Sep 9, 2025
23e5a41
Leave binary tree intact upon insertion error
Willmac16 Sep 9, 2025
2b84c5f
Implement, but don't yet use deallocateNode
Willmac16 Sep 9, 2025
f46a0d9
Deallocate and shift nodes after transmit
Willmac16 Sep 9, 2025
37d44e9
WIP: Stitching behavior to ensure every finished file's node gets dea…
Willmac16 Sep 10, 2025
b5ab14f
WIP: No more assert/UB, but UTs stall
Willmac16 Sep 10, 2025
11b6579
Log pending counters @ file complete & Fix UTs w/ deallocate logic
Willmac16 Sep 10, 2025
526ccac
Make deallocateNode more assertive and ensure things are set
Willmac16 Sep 10, 2025
e5f99c9
Use the same CompareEntries function in code and UT
Willmac16 Sep 10, 2025
32fc47b
Fix CompareEntries & overload comparison operators
Willmac16 Sep 10, 2025
5967d32
partial_sort_copy all output lists & ignore issue on RandomTransmitte…
Willmac16 Sep 10, 2025
ed1514d
Use the DpStateEntry comparison when inserting nodes
Willmac16 Sep 10, 2025
fac3b8c
Transmited -> Transmitted
Willmac16 Sep 10, 2025
a253af2
Randomized Testing of Data Product addition & transmission
Willmac16 Sep 10, 2025
3a81fe5
Try Passing Partial and untransmitted to random test
Willmac16 Sep 10, 2025
282e201
Add sub-second time comparison & move to stackless navigation
Willmac16 Sep 11, 2025
8640c88
Bound those while loops, bound the free list allocation, & add "subse…
Willmac16 Sep 11, 2025
0316726
Update .github/actions/spelling/expect.txt
LeStarch Sep 30, 2025
788e8f0
First Couple Points of Feedback Addressed & Compiles on macOS 26
Willmac16 Oct 12, 2025
be25d03
Switch to FileNameStringSize, Move DpStateEntry comparisons to cpp, &…
Willmac16 Oct 12, 2025
216c846
determineDirectory in addToCat handler & correct spelling of delimiter
Willmac16 Oct 12, 2025
a867afe
Remove freeListFoot
Willmac16 Oct 12, 2025
0ddc680
Fix Spelling of Stitch in DpCatalog.cpp
Willmac16 Oct 31, 2025
60831af
StringUtils::substring_find to compare & ensure single slotSize is al…
Willmac16 Nov 2, 2025
723dfdd
Early Return Styled compareEntries
Willmac16 Nov 2, 2025
2635b34
Replace freeListFoot w/ nullptr, use comparison when loading stateFil…
Willmac16 Nov 2, 2025
4e875cf
Spelling Fixes
Willmac16 Nov 2, 2025
60beafa
Spelling take two
Willmac16 Nov 2, 2025
0322b34
Create a FwSizeType repr of match index in substring_find_last
Willmac16 Nov 2, 2025
3bfe420
Fix match_index
Willmac16 Nov 2, 2025
9e5bb8d
Move substring_find_last to a standard, three term for loop
Willmac16 Nov 2, 2025
28fab53
DpCatalog docs tweaks
Willmac16 Nov 2, 2025
270477b
Spelling
Willmac16 Nov 2, 2025
2237265
Prevent Duplicate Cmd Responses
Willmac16 Nov 2, 2025
a5afc42
Remove numDpRecords & improve comments
Willmac16 Nov 2, 2025
fb7599f
Check State file has been opened
Willmac16 Nov 2, 2025
9fd9624
Use a catalogBuilt flag to prevent runtime insertion until ready
Willmac16 Nov 2, 2025
e740f54
Tweaking readDps add and done sequencing
Willmac16 Nov 3, 2025
67e520a
Test Catalog Stop, Clear, & Faulty Restart
Willmac16 Nov 3, 2025
d86a108
Fixes for deallocateNode w/ left hand branch
Willmac16 Nov 3, 2025
7d7fd18
Test XmitStop warning
Willmac16 Nov 3, 2025
0064434
Test StartXmit before config
Willmac16 Nov 3, 2025
cad827f
Delaying dispatch seems to break random test file counts
Willmac16 Nov 3, 2025
f38385e
Print the DpCatalog Tree
Willmac16 Nov 15, 2025
cc060f0
One Hundred Random Dp Testing Iters & Cleanup Random Dps btw runs
Willmac16 Nov 15, 2025
e4b494f
Remove Tree Printing
Willmac16 Nov 15, 2025
81c7862
Add rm -rf to tester construction
Willmac16 Nov 15, 2025
fb416cb
Ensure all test artifacts are in DpTest*
Willmac16 Nov 15, 2025
c99d949
Low Hanging Coverage & Delete Print Functions
Willmac16 Nov 15, 2025
9a50880
Test FileDone failure EVR & delayed cmd response and allow built time…
Willmac16 Nov 15, 2025
17c7e4e
Consolidate & Test the WAIT response mode
Willmac16 Nov 16, 2025
1a097ad
add unconfigured to spelling
Willmac16 Nov 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ strnlen
subgrouping
subhist
subhistory
subseconds
subsecond
subtopology
suppr
suseconds
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ build-artifacts/
gtest/
docs-cache/
CMakePresets.json
/DpTest*/
/Testing/

AutoXML/
test_harness/src/test_harness-C/application.out
Expand All @@ -26,6 +28,7 @@ RemoteSystemsTempFiles
*.stackdump
Dict
*.core
*.swp

**/coverage/
*.gcov
Expand Down Expand Up @@ -58,6 +61,7 @@ test_harness/.autotools
core

*.swp4
*dpState.dat

*AppDictionary.xml
*TopologyAppID.csv
Expand Down
55 changes: 54 additions & 1 deletion Fw/Types/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
return -1;
}
// Confirm that the output type can hold the range of valid results
FW_ASSERT(static_cast<FwSignedSizeType>(source_size - sub_size) <= std::numeric_limits<FwSignedSizeType>::max());
FW_ASSERT(source_size - sub_size <= static_cast<FwSizeType>(std::numeric_limits<FwSignedSizeType>::max()));

// Loop from zero to source_size - sub_size (inclusive)
for (FwSizeType source_index = 0;
Expand All @@ -73,3 +73,56 @@
// if we make it here, no matches were found
return -1;
}

Check warning

Code scanning / CppCheck

Could not find a newline character at the end of the file. Warning

Could not find a newline character at the end of the file.
FwSignedSizeType Fw::StringUtils::substring_find_last(const CHAR* source_string,

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.

Check notice

Code scanning / CodeQL

Use of basic integral type Note

source_string uses the basic integral type char rather than a typedef with size and signedness.
FwSizeType source_size,
const CHAR* sub_string,

Check notice

Code scanning / CodeQL

Use of basic integral type Note

sub_string uses the basic integral type char rather than a typedef with size and signedness.
FwSizeType sub_size) {
FW_ASSERT(source_string != nullptr);
FW_ASSERT(sub_string != nullptr);

FwSizeType match_index = 0;

// zero size sub-strings should always match
if ((source_size > 0) && (0 == sub_size)) {
match_index = source_size - 1;

// Ensure we can represent the match_index in a signed num
FW_ASSERT(static_cast<FwSizeType>(static_cast<FwSignedSizeType>(match_index)) == match_index);

return static_cast<FwSignedSizeType>(match_index);
}

// Cannot find a substring larger than the source
if (source_size < sub_size) {
return -1;
}
// Confirm that the output type can hold the range of valid results
FW_ASSERT(source_size - sub_size <= static_cast<FwSizeType>(std::numeric_limits<FwSignedSizeType>::max()));

// Loop from source_size - sub_size to zero (inclusive)
for (FwSizeType ii = 0; ii <= (source_size - sub_size); ii++) {
const FwSizeType source_index = (source_size - sub_size) - ii;

// if the current character matches
for (FwSizeType sub_index = 0; sub_index < sub_size; sub_index++) {
// Prevent read overrun
FW_ASSERT((source_index + sub_index) < source_size);
// if there is a mismatch, go to next character
if (source_string[source_index + sub_index] != sub_string[sub_index]) {
break;
} else if (sub_index == (sub_size - 1)) {
// if we matched all the way to the end of the substring
match_index = source_index;

// Ensure the result converts properly
FW_ASSERT(static_cast<FwSizeType>(static_cast<FwSignedSizeType>(match_index)) == match_index);

return static_cast<FwSignedSizeType>(match_index);
}
}
}
Comment on lines +104 to +124

Check warning

Code scanning / CodeQL

Unbounded loop Warning

This loop does not have a fixed bound.

// if we make it here, no matches were found
return -1;
}
14 changes: 14 additions & 0 deletions Fw/Types/StringUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ FwSignedSizeType substring_find(const CHAR* source_string,
const CHAR* sub_string,
FwSizeType sub_size);

/**
* \brief find the last occurrence of a substring
*
* \param source_string: string to search for the substring
* \param source_size: the size of the source string
* \param substring: string to search for
* \param sub_size: the size of the string to search for
* \return index of substring, -1 if not found
*/
FwSignedSizeType substring_find_last(const CHAR* source_string,
FwSizeType source_size,
const CHAR* sub_string,
FwSizeType sub_size);

enum StringToNumberStatus {
SUCCESSFUL_CONVERSION, //!< Output should be valid
NULL_INPUT, //!< A null string was supplied
Expand Down
72 changes: 72 additions & 0 deletions Fw/Types/test/ut/TypesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,12 @@ TEST(Nominal, sub_string_match_partway_1) {
ASSERT_EQ(Fw::StringUtils::substring_find(source_string, 6, sub_string, 3), 2);
}

TEST(Nominal, sub_string_match_partway_first) {
const char* source_string = "abc123c123";
const char* sub_string = "c12";
ASSERT_EQ(Fw::StringUtils::substring_find(source_string, 10, sub_string, 3), 2);
}

TEST(OffNominal, sub_string_partial_match_begin) {
const char* source_string = "abc123";
const char* sub_string = "ab1";
Expand Down Expand Up @@ -1409,6 +1415,72 @@ TEST(OffNominal, sub_string_substring_zero_size) {
ASSERT_EQ(Fw::StringUtils::substring_find(source_string, 6, sub_string, 0), 0);
}

TEST(OffNominal, sub_string_last_no_match) {
const char* source_string = "abc123";
const char* sub_string_last = "456";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), -1);
}

TEST(Nominal, sub_string_last_match_begin) {
const char* source_string = "abc123";
const char* sub_string_last = "abc";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), 0);
}

TEST(Nominal, sub_string_last_match_end) {
const char* source_string = "abc123";
const char* sub_string_last = "123";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), 3);
}

TEST(Nominal, sub_string_last_match_partway_1) {
const char* source_string = "abc123";
const char* sub_string_last = "c12";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), 2);
}

TEST(Nominal, sub_string_last_match_partway_last) {
const char* source_string = "abc123c123";
const char* sub_string_last = "c12";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 10, sub_string_last, 3), 6);
}

TEST(OffNominal, sub_string_last_partial_match_begin) {
const char* source_string = "abc123";
const char* sub_string_last = "ab1";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), -1);
}

TEST(OffNominal, sub_string_last_partial_match_middle) {
const char* source_string = "abc123";
const char* sub_string_last = "c13";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), -1);
}

TEST(OffNominal, sub_string_last_partial_match_end) {
const char* source_string = "abc123";
const char* sub_string_last = "234";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), -1);
}

TEST(Nominal, sub_string_last_exact_match) {
const char* source_string = "abc123";
const char* sub_string_last = "abc123";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 3), 0);
}

TEST(OffNominal, sub_string_last_source_zero_size) {
const char* source_string = "";
const char* sub_string_last = "234";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 0, sub_string_last, 3), -1);
}

TEST(OffNominal, sub_string_last_substring_zero_size) {
const char* source_string = "abc123";
const char* sub_string_last = "";
ASSERT_EQ(Fw::StringUtils::substring_find_last(source_string, 6, sub_string_last, 0), 5);
}

int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Expand Down
2 changes: 2 additions & 0 deletions Svc/DpCatalog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/DpTest*/
dpState.dat
41 changes: 18 additions & 23 deletions Svc/DpCatalog/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,30 @@
####
# F prime CMakeLists.txt:
#
# SOURCE_FILES: combined list of source and autocoding files
# MOD_DEPS: (optional) module dependencies
#
# Note: using PROJECT_NAME as EXECUTABLE_NAME
####

set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.fpp"
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.cpp"
register_fprime_module(
AUTOCODER_INPUTS
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.fpp"
SOURCES
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.cpp"
HEADERS
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.hpp"
)

set(HEADER_FILES
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.hpp"
)


register_fprime_module()
### UTs ###
set(UT_MOD_DEPS
register_fprime_ut(
AUTOCODER_INPUTS
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.fpp"
SOURCES
"${CMAKE_CURRENT_LIST_DIR}/test/ut/DpCatalogTester.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/DpCatalogTestMain.cpp"
DEPENDS
STest
UT_AUTO_HELPERS
)
set(UT_SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/DpCatalog.fpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/DpCatalogTester.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/DpCatalogTesterHelpers.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/DpCatalogTestMain.cpp"
)
register_fprime_ut()

set (UT_TARGET_NAME "${FPRIME_CURRENT_MODULE}_ut_exe")
if (TARGET "${UT_TARGET_NAME}")
target_compile_options("${UT_TARGET_NAME}" PRIVATE -Wno-conversion)
target_compile_options("${UT_TARGET_NAME}" PRIVATE -Wno-conversion)
endif()

Loading
Loading