Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unit Test SC_SendHkPacket_Test Fails #53

Open
2 tasks done
jeffstjean opened this issue Sep 26, 2022 · 2 comments
Open
2 tasks done

Unit Test SC_SendHkPacket_Test Fails #53

jeffstjean opened this issue Sep 26, 2022 · 2 comments

Comments

@jeffstjean
Copy link

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
@jeffstjean
Copy link
Author

This appears to fail when SC_NUMBER_OF_RTS is not set to 64

@thnkslprpt
Copy link
Contributor

The tests fail because they are relatively naive, in the sense that they are written to mostly work with the default set-up (leaving SC_NUMBER_OF_RTS at 64).

However, the tests do work with other values of SC_NUMBER_OF_RTS, as long it is is a multiple of 16 within a certain range (48 - 96), because these will still allow the ones to fill every bit and match the 65535 and 32767 values it's comparing against.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants