D24887: WIP slave command behavior assertion system
Harald Sitter
noreply at phabricator.kde.org
Wed Oct 23 13:44:33 BST 2019
sitter created this revision.
sitter added a reviewer: dfaure.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
sitter requested review of this revision.
REVISION SUMMARY
This implements a simple expectation system covering slave commands.
At its heart sits the CommandExpectation, which contains the expectations
of a given command. Currently the sole expectation is about signal emission
notably a whitelist of signals that any given command may emit during its
emission. To assist this there's a new Signal enum which is used to
refer to the signals. Signals by default are considered exclusive and
repeatedly emitting the same signal will result in assertion failures.
Multi-emission signals such as data/written/processedsize are of course
excluded from this.
All signal implementation in SlaveBase should call VERIFY_CALL to verify
the validity of the signal call at call-time (notably: can this signal
be called during this Command and may it be called 1 or N times).
After the command finished the pre-existing verifyState function has
been refitted for the new expectation tech.
- slavebase.h now tries to document expectations WRT signals
- makes KIO to a Q_NAMESPACE which kinda exposes unintended symbols I guess e.g. staticMetaObject. this does enable us to convert the enum values to strings via QMetaMethod but has no additional purpose beyond that.
- m_state/States are no more. m_state was solely used to track whether error/finished was called and then assert expectations. this is replaced by m_receivedSignals which tracks any number of signals
- verifyErrorFinishedNotCalled and verfifyFinishedNotCalled have been merged into verifyCall which is now the one-place-stop to get in-call verification (i.e signals call verifyCall and verifyCall makes sure that signal should even have been called)
- verifyState has been reworked to be applicable to all expectations
todo:
- I am not 100% on most of the expectations
- do we really want Q_NAMESPACE on KIO? we could replace this with enumToString() functions switching over the values manually. seeing as I am lazy I'd rather use the moc generated data though
- conceivably an empty expectation should mean everything is allowed, currently it's meant to mean nothing is allowed as that is rather more handy to make sure the expectations themselves are in fact correct and complete
- warning todos
- stray debugs
TEST PLAN
casually use all the slaves
REPOSITORY
R241 KIO
BRANCH
assert-file
REVISION DETAIL
https://phabricator.kde.org/D24887
AFFECTED FILES
src/core/CMakeLists.txt
src/core/commands_p.h
src/core/slavebase.cpp
src/core/slavebase.h
To: sitter, dfaure
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20191023/d9003c48/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list