dbUnitTest::testdbRecordPtr() is easy to mis-use
Bug #1828900 reported by
Andrew Johnson
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
New
|
Wishlist
|
Unassigned |
Bug Description
There can be a mis-match between the record type expected and the type of the record returned, but a typical use of testdbRecordPtr() will cast the pointer to the expected type with no warnings produced if it's wrong, and any test code that accesses a record-specific field will likely be pointing at the wrong address.
It should be possible to define a new macro in dbUnitTest.h and an associated helper function that takes the expected record type as an argument and checks that the type returned matches the one expected, returning a pointer that is already cast to the expected type. It should call testAbort() if the wrong record type is found.
To post a comment you must log in.