nasa / nasa/SC

Unit Test SC_SendHkPacket_Test Fails

Open
#53 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue unit-test
Dominant language
C
Stars
46
Forks
39
PR merge metrics
No merged PRs in 30d

Description

Checklist (Please check before submitting)

  • I reviewed the Contributing Guide.
  • I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.

Describe the bug
The SC_SendHkPacket_Test unit test fails. The expected RtsExecutingStatus and RtsDisabledStatus are not sent to the SB.

To Reproduce

  1. Create a cFS bundle that includes a cFE, OSAL, PSP, and SC as an app
  2. make SIMULATION=native ENABLE_UNIT_TESTS=true prep && make && make install
  3. make test

The SC_SendHkPacket_Test unit test will fail:

[BEGIN] 24 SC_SendHkPacket_Test
[ PASS] 24.001 sc_cmds_tests.c:1438 - SC_OperData.HkPacket.CmdErrCtr == 1
[ PASS] 24.002 sc_cmds_tests.c:1439 - SC_OperData.HkPacket.CmdCtr == 2
[ PASS] 24.003 sc_cmds_tests.c:1440 - SC_OperData.HkPacket.RtsActiveErrCtr == 3
[ PASS] 24.004 sc_cmds_tests.c:1441 - SC_OperData.HkPacket.RtsActiveCtr == 4
[ PASS] 24.005 sc_cmds_tests.c:1442 - SCSC_OperData.HkPacket.AtsCmdCtr == 5
[ PASS] 24.006 sc_cmds_tests.c:1443 - SC_OperData.HkPacket.AtsCmdErrCtr == 6
[ PASS] 24.007 sc_cmds_tests.c:1444 - SC_OperData.HkPacket.RtsCmdCtr == 7
[ PASS] 24.008 sc_cmds_tests.c:1445 - SC_OperData.HkPacket.RtsCmdErrCtr == 8
[ PASS] 24.009 sc_cmds_tests.c:1446 - SC_OperData.HkPacket.LastAtsErrSeq == 9
[ PASS] 24.010 sc_cmds_tests.c:1447 - SC_OperData.HkPacket.LastAtsErrCmd == 10
[ PASS] 24.011 sc_cmds_tests.c:1448 - SC_OperData.HkPacket.LastRtsErrSeq == 11
[ PASS] 24.012 sc_cmds_tests.c:1449 - SC_OperData.HkPacket.LastRtsErrCmd == 12
[ PASS] 24.013 sc_cmds_tests.c:1450 - SC_OperData.HkPacket.AppendCmdArg == 13
[ PASS] 24.014 sc_cmds_tests.c:1451 - SC_OperData.HkPacket.AppendEntryCount == 14
[ PASS] 24.015 sc_cmds_tests.c:1452 - SC_OperData.HkPacket.AppendLoadCount == 16
[ PASS] 24.016 sc_cmds_tests.c:1453 - SC_OperData.HkPacket.AtpFreeBytes[0] == (SC_ATS_BUFF_SIZE32 * SC_BYTES_IN_WORD)
[ PASS] 24.017 sc_cmds_tests.c:1457 - SC_OperData.HkPacket.AtpFreeBytes[1] == (SC_ATS_BUFF_SIZE32 * SC_BYTES_IN_WORD)
[ PASS] 24.018 sc_cmds_tests.c:1461 - SC_OperData.HkPacket.AtsNumber == 17
[ PASS] 24.019 sc_cmds_tests.c:1462 - SC_OperData.HkPacket.AtpState == 18
[ PASS] 24.020 sc_cmds_tests.c:1463 - SC_OperData.HkPacket.AtpCmdNumber == 19
[ PASS] 24.021 sc_cmds_tests.c:1464 - SC_OperData.HkPacket.SwitchPendFlag == 0
[ PASS] 24.022 sc_cmds_tests.c:1465 - SC_OperData.HkPacket.NextAtsTime == 0
[ PASS] 24.023 sc_cmds_tests.c:1466 - SC_OperData.HkPacket.NumRtsActive == 20
[ PASS] 24.024 sc_cmds_tests.c:1467 - SC_OperData.HkPacket.RtsNumber == 21
[ PASS] 24.025 sc_cmds_tests.c:1468 - SC_OperData.HkPacket.NextRtsTime == 0
[ PASS] 24.026 sc_cmds_tests.c:1469 - SC_OperData.HkPacket.ContinueAtsOnFailureFlag == 1
[ FAIL] 24.027 sc_cmds_tests.c:1477 - SC_OperData.HkPacket.RtsExecutingStatus[0] (1) == 65535 (65535)
[ FAIL] 24.028 sc_cmds_tests.c:1478 - SC_OperData.HkPacket.RtsDisabledStatus[0] (1) == 65535 (65535)
[ FAIL] 24.029 sc_cmds_tests.c:1485 - SC_OperData.HkPacket.RtsExecutingStatus[2] (0) == 65535 (65535)
[ FAIL] 24.030 sc_cmds_tests.c:1486 - SC_OperData.HkPacket.RtsDisabledStatus[2] (0) == 65535 (65535)
[ FAIL] 24.031 sc_cmds_tests.c:1489 - SC_OperData.HkPacket.RtsExecutingStatus[LastRtsHkIndex] (1) == 32767 (32767)
[ FAIL] 24.032 sc_cmds_tests.c:1490 - SC_OperData.HkPacket.RtsDisabledStatus[LastRtsHkIndex] (1) == 32767 (32767)
[ PASS] 24.033 sc_cmds_tests.c:1494 - CFE_EVS_SendEvent was called 0 time(s), expected 0
[  END] 24 SC_SendHkPacket_Test TOTAL::33    PASS::27    FAIL::6     MIR::0     TSF::0     TTF::0     WARN::0   

Expected behavior
This unit test should pass. I am not sure why the unit test is expecting 65535 for the first and middle element and 32767 for the last element in sc_cmds_tests.c. Also not sure why the first and middle elements use different asserts compared to the last element but these don't appear to affect the behavior as they result in the same assert.

Code snips
/* Check first element */
UtAssert_True(SC_OperData.HkPacket.RtsExecutingStatus[0] == 65535,
"SC_OperData.HkPacket.RtsExecutingStatus[0] == 65535"); // fails
UtAssert_True(SC_OperData.HkPacket.RtsDisabledStatus[0] == 65535,
"SC_OperData.HkPacket.RtsDisabledStatus[0] == 65535"); // fails

/* Check middle element */
UtAssert_True(SC_OperData.HkPacket.RtsExecutingStatus[2] == 65535,
"SC_OperData.HkPacket.RtsExecutingStatus[2] == 65535"); // fails
UtAssert_True(SC_OperData.HkPacket.RtsDisabledStatus[2] == 65535,
"SC_OperData.HkPacket.RtsDisabledStatus[2] == 65535"); // fails

/* Check last element */
UtAssert_INT32_EQ(SC_OperData.HkPacket.RtsExecutingStatus[LastRtsHkIndex], 32767); // fails
UtAssert_INT32_EQ(SC_OperData.HkPacket.RtsDisabledStatus[LastRtsHkIndex], 32767); // fails


**System observed on:**
 - Hardware
 - OS: 20.04.1-Ubuntu
 - Versions: cfe v7.0.0-rc4+dev143, osal v6.0.0-rc4+dev87, psp v1.6.0-rc4+dev41

**Additional context**
N/A

**Reporter Info**
Jeff St. Jean
jstjean@turionspace.com

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the native unit-test build and inspect the failing assertions around lines 1477-1490 of sc_cmds_tests.c, including the test setup for RtsExecutingStatus and RtsDisabledStatus. Trace how those HkPacket fields are populated, then rerun make test; done means SC_SendHkPacket_Test passes with expectations that match the populated values.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.