Test double buffer accessor ns - #551
Conversation
killenb
left a comment
There was a problem hiding this comment.
You put a lot of effort in identifying the test cases that need to be covered. However, basically all tests have issues:
- They are not testing along the public API and will break when refactoring
- They are often testing implementation details instead of wanted behaviour. Some do not have any logical test coverage at all.
- Many tests are fully covered by the UnifiedBackendTest, and most can be implemented to be checked there. There are only two test cases which do not work out of the box
- The test with two accessors locking each other in different threads
- The test that the double buffering is turned off while reading (is missing a callback in the dummy. We should extend the dummy here. I was just missing this in a test this week, but could work around it because my accessors are writeable. There is a write callback). But it's also not cleanly testable here without the callback.
We should move all tests that can be covered by the UnifiedBackendTest to a testDoubleBufferAccessorUnified, and only have the ones that cannot be handles there in this dedicated test.
- One test case is missing: Two different registers which are using the same double buffering handshare (e.g. FD and the according macro pulse number). This will also be a dedicated test at the moment, because the unified backend test cannot handle multiple registers.
killenb
left a comment
There was a problem hiding this comment.
Please squash all commits into one. It just adds one file. The history how this was done can be squashed.
|
Point 1-3: Move tests covered by UnifiedBackendTest to testDoubleBufferAccessorUnified The UnifiedBackendTest framework has no double buffer support whatsoever. It tests generic TransferElement behavior (read, write, version numbers, async, error handling) through simple register descriptors that provide path(), generateValue(), nChannels(), etc. DoubleBufferAccessor is fundamentally different:
At least what is visible to me atm:
So in summary: What I did instead for now: The remaining 4 tests in testDoubleBufferAccessor.cc are:
Point 4: The test with two accessors locking each other Point 5: The test that double buffering is turned off while reading Point 6: Move all tests that can be covered by UnifiedBackendTest Point 7: One test case is missing: two different registers sharing the same double buffering handshake N.B: I'll squash the changes once done. |
- Remove 8 generic TransferElement tests (covered by UnifiedBackendTest) - Fix element index: use index 1 matching DAQ.FD's double buffer config - Fix path separators: /DAQ/FD.BUF0 → /DAQ/FD/BUF0 - Add missing doReadTransferSynchronously() in thread-locking test - Add test for two registers sharing the same handshake - Add test covering _currentBuffer==1 buffer selection path
a5acb9e to
cdf8cc3
Compare
Just a comment without consequence right now: Adding the backdoor would be possible in the UnifiedBackendTest as it currently is, maybe in worst case a special DummyBackend with hooks on the relevant registers would be needed. I am not saying you should do this now, this is a complex task and maybe we should improve the UnifiedBackendTest first to make these things easier...
True, the UnifiedBackendTest currently cannot do tests with concurrent accessor use. |
Replace internal lifecycle calls (doPreRead/doPostRead/doReadTransferSynchronously) and TestableDoubleBufferAccessor helper with read() via device.getOneDRegisterAccessor. Tests now verify observable behavior through the standard device interface.
- Move BitRangeAccessorDecorator from LNM backend into it's own header file
- Use proper merging in TransferGroups via SharedAccessors
-- Sharing before decorating breaks if bit range accessors with the same
target are used in different transfer groups
- Comparison operator for LNMBackendRegisterInfo
- Fix mayReplaceOther in LNMBackendVariableAccessor to allow proper merging in
TransferGroups
- Introduce isBitRange to NumericAddressedRegisterCatalogue
- Remove singleton pattern from SharedAccessors mechanism
-- Introduce SharedAccessors to device backend base class
- Extend json parsing
No description provided.