cFS
cFS copied to clipboard
79 - coverage-es-ALL (SEGFAULT)
Checklist (Please check before submitting)
- [x] I reviewed the Contributing Guide.
- [x] I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bug Test fixture 79 segfaults, and I can't figure out if it's intended behavior. (I hope not!)
To Reproduce Steps to reproduce the behavior:
git clone https://github.com/nasa/cFS.git --recurse-submodules
cd cFS
cp cfe/cmake/Makefile.sample Makefile
cp -avr cfe/cmake/sample_defs .
SIMULATION=native ENABLE_UNIT_TESTS=1 make prep
make -j$(nproc)
cd build/native/default_cpu1
ctest -j$(nproc) # this is just to speed up the process
ctest --rerun-failed --output-on-failure
Expected behavior It looks like the specific test, found here mentions that it's forcing a vsnprintf failure, so I expect a failure that would lead to the test passing.
Actual behavior A segfault occurs, causing the test fixture to fail.
System observed on:
- OS/Hardware: Linux gpenguin 6.6.13-gentoo-dist #1 SMP PREEMPT_DYNAMIC Fri Jan 26 12:11:22 CST 2024 x86_64 AMD Ryzen 9 5950X 16-Core Processor AuthenticAMD GNU/Linux
- Versions: N/A (directly from main)
Additional context This might not be a bug. Is this test expected to segfault? If it is, any advice on how I should handle this in CI?
Attached is a log containing the output of the failed unit test.
Also, here's the call stack leading up to the segfault:
[2] from 0x00007ffff7e36d40 in vsnprintf
[3] from 0x000055555558e144 in CFE_ES_SysLog_vsnprintf+237 at /home/user/Projects/project/project-cfs/cfe/modules/es/fsw/src/cfe_es_syslog.c:390
[4] from 0x000055555555c8d3 in ES_UT_SysLog_snprintf+188 at /home/user/Projects/project/project-cfs/cfe/modules/es/ut-coverage/es_UT.c:216
[5] from 0x0000555555572941 in TestAPI+12096 at /home/user/Projects/project/project-cfs/cfe/modules/es/ut-coverage/es_UT.c:4498
[6] from 0x000055555559d98b in UtTest_Run+284 at /home/user/Projects/project/project-cfs/osal/ut_assert/src/uttest.c:172
[7] from 0x000055555559dec5 in OS_Application_Run+9 at /home/user/Projects/project/project-cfs/osal/ut_assert/src/utbsp.c:230
[8] from 0x00005555555a7aca in main+141 at /home/user/Projects/project/project-cfs/osal/src/bsp/generic-linux/src/bsp_start.c:244
https://github.com/nasa/cFE/blob/8cdad66e4eafd11c2ea93d0360867045b77fa981/modules/es/ut-coverage/es_UT.c#L4559
UtAssert_VOIDCALL(ES_UT_SysLog_snprintf(SysLogBuf, sizeof(SysLogBuf), NULL));
After debugging this further, I'm not sure what this test is supposed to be doing. It says it's supposed to force a failure by supplying NULL as the fmt option, but why? Shouldn't this always segfault? Is the test trying to make sure that it segfaults?
I now understand what the test is doing, but I can't seem to catch the segfault.