Skip to content

Unit tests fail when TLMCHAN_HASH_BUCKETS is set below 47 #8

@celskeggs

Description

@celskeggs

When I configure TLMCHAN_HASH_BUCKETS for my project to 47, the unit tests pass. But if I configure TLMCHAN_HASH_BUCKETS to 46 or lower, the unit tests for Svc.TlmLinearChan fail:

# fprime-util check
[6/6] cd /workspaces/[...]/build-fprime-automatic-linux-static-ut && /usr/bin/ctest
FAILED: CMakeFiles/check /workspaces/[...]/build-fprime-automatic-linux-static-ut/CMakeFiles/check 
cd /workspaces/[...]/build-fprime-automatic-linux-static-ut && /usr/bin/ctest
Test project /workspaces/[...]/build-fprime-automatic-linux-static-ut
[...]
    Start 2: fprime-baremetal_Svc_TlmLinearChan_ut_exe
2/5 Test #2: fprime-baremetal_Svc_TlmLinearChan_ut_exe ...Subprocess aborted***Exception:   0.18 sec
[...]
[...] tests passed, 1 tests failed out of [...]

Total Test time (real) =   [...]

The following tests FAILED:
          2 - fprime-baremetal_Svc_TlmLinearChan_ut_exe (Subprocess aborted)
Errors while running CTest
Output from these tests are in: /workspaces/[...]/build-fprime-automatic-linux-static-ut/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
ninja: build stopped: subcommand failed.
[ERROR] CMake erred with return code 1

Here is the full output:

2/5 Testing: fprime-baremetal_Svc_TlmLinearChan_ut_exe
2/5 Test: fprime-baremetal_Svc_TlmLinearChan_ut_exe
Command: "/workspaces/[...]/build-fprime-automatic-linux-static-ut/bin/linux-static/fprime-baremetal_Svc_TlmLinearChan_ut_exe"
Directory: /workspaces/[...]/build-fprime-automatic-linux-static-ut/fprime-baremetal/Svc/TlmLinearChan
"fprime-baremetal_Svc_TlmLinearChan_ut_exe" start time: May 13 00:10 UTC
Output:
----------------------------------------------------------
[==========] Running 4 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 4 tests from TlmLinearChanTest
[ RUN      ] TlmLinearChanTest.InitTest
[       OK ] TlmLinearChanTest.InitTest (0 ms)
[ RUN      ] TlmLinearChanTest.NominalChannelTest

***************************************
TESTCASE 107.1.1: Nominal channelized telemetry
***************************************

***************************************
Write a single channel and verify it is read back and pushed correctly.
***************************************

***************************************
(RQ)       TLC-001
***************************************

***************************************
(RQ)       TLC-002
***************************************

***************************************
(RQ)       TLC-004
***************************************

***************************************
(RQ)       TLC-003
***************************************
[       OK ] TlmLinearChanTest.NominalChannelTest (0 ms)
[ RUN      ] TlmLinearChanTest.MultiChannelTest
Assert: "/workspaces/[...]/lib/fprime-baremetal/fprime-baremetal/Svc/TlmLinearChan/TlmLinearChan.cpp:67" 46
Assertion failed: 0 (/workspaces/[...]/lib/fprime/Fw/Types/Assert.cpp: defaultSwAssert: 121)
<end of output>
Test time =   0.22 sec
----------------------------------------------------------
Test Failed.
"fprime-baremetal_Svc_TlmLinearChan_ut_exe" end time: May 13 00:10 UTC
"fprime-baremetal_Svc_TlmLinearChan_ut_exe" time elapsed: 00:00:00
----------------------------------------------------------

Here is where the assertion occurs:

void TlmLinearChan::TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time& timeTag, Fw::TlmBuffer& val) {
    // Compute index for entry

    NATIVE_UINT_TYPE entry;
    for (entry = 0; entry < TLMCHAN_HASH_BUCKETS; entry++) {
        if (this->m_tlmEntries[entry].id == id || this->m_tlmEntries[entry].used == false) {  
            break;
        }
    }

    // copy into entry
    FW_ASSERT(entry < TLMCHAN_HASH_BUCKETS, entry);  // <----------- ASSERTION OCCURS HERE
    this->m_tlmEntries[entry].used = true;
    this->m_tlmEntries[entry].id = id;
    this->m_tlmEntries[entry].updated = true;
    this->m_tlmEntries[entry].lastUpdate = timeTag;
    this->m_tlmEntries[entry].buffer = val;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions