Improve unit-test coverage of Cellular
Issue by ChiefGokhlayehBosch
Monday Sep 23, 2019 at 07:40 GMT
Originally opened as https://github.com/Bosch-AE-SW/cddk-oss/issues/265
Cellular test coverage is subpar and does not meet the quality expectations set by DoD. Sensible unit-tests are to be implemented to strengthen Cellulars regression resistance and explore any previously unhandled corner cases.
- [ ] Cellular UT Coverage - At3Gpp27007 #350 Expand coverage for At3Gpp27007
- [ ] task b
- [ ] task c
Comment by ChiefGokhlayehBosch
Monday Sep 23, 2019 at 08:44 GMT
Looking at the current Cellular coverage we see the following issues:
- Many modules are completely untested (i.e. 0% coverage). Due to a limitation of
lcovthese offenders don't even show up in the report. Note: we should look into other modules if that's the case too. One way to do this would be via a "baseline" unit-test, which only compiles the CuT and runs a dummy test-fixture (the important bit is that it includes the source file and is executed duringctest)- [x] Make untested modules show up in coverage report.
- [ ] Apply the same baseline'ing for other modules from other packages.
- The existing "emulator" tests cover basic AT response parsing and interpreting. Adding more AT varied AT responses would improve corner-case coverage.
- [ ] Extend existing emulator tests by more AT responses, focusing on corner-cases (i.e. an invalid parameter in an otherwise valid response)
- Formerly known as
BCDS_Queue, theQueueis now part of Cellular and has 0% coverage. Special care must be taken due to the "flexible array member" C language feature, which is not supported in C++. This results in "off-by-one-byte" memory corruptions, due to padding being introduced into the structure by the unknowing C++ compiler. Perhaps add__attribute__((packed)), to prohibit padding being added by the C++ compiler.- [ ] Find a way of compiling and testing
Queue(formerlyBCDS_Queue) in C++ environment. - [ ] Add unit-tests to
Queue
- [ ] Find a way of compiling and testing
- Many of the currently untested modules handle the glue-code between AT command IO and the public API of Cellular. Their behaviour usually just consists of converting data from the ublox-specific AT representation to the unified Cellular data-structures.
- [ ] Add tests to glue-code modules
ublox/Network,ublox/Power,ublox/HttpService,ublox/SocketService,ublox/DnsService.
- [ ] Add tests to glue-code modules
Comment by bierkandt-bosch
Tuesday Oct 15, 2019 at 08:14 GMT
Milestone closing:
- Boyko and Mohammed working on two different branches
- Current coverage (line/branch)
- HW: Done
- Power: Work in progess
- HttpService: 92%/ >78,8
- Network: 94% / 70%
- URC: Just started
- SocketService: Open (0%)
- Older unit test: Branch coverage to be increased
- Issue with lcov: test/fake functions are considered as branches as well
Comment by bierkandt-bosch
Wednesday Nov 06, 2019 at 12:19 GMT
Backlog grooming:
- 70% coverage is reached and was approved by project review board
- is not yet on master and visible on jenkins
- Mohammed will open PR accordingly
- once merged this ticket shall be closed
- Still there are open issues (e.g. for reaching more coverage the unit test approach must be changed) => separate ticket #350