add some tests for corrupt configs
ClosedPublic

Authored by sebas on May 4 2016, 2:36 AM.

Details

Summary

This allows us to make sure that when a config file is borked, we're not
suddenly creating invalid configs.

Test Plan

tests pass

Diff Detail

Repository
R104 KScreen
Branch
sebas/corruptautotests
Lint
No Linters Available
Unit
No Unit Test Coverage
sebas updated this revision to Diff 3634.May 4 2016, 2:36 AM
sebas retitled this revision from to add some tests for corrupt configs.
sebas updated this object.
sebas edited the test plan for this revision. (Show Details)
sebas added a reviewer: Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptMay 4 2016, 2:36 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sebas updated this revision to Diff 3635.May 4 2016, 2:43 AM

more realistic corrupt config file

This simulates the config half-written, which it seems could happen
if we end up reading mid-write.

graesslin accepted this revision.May 4 2016, 5:54 AM
graesslin added a reviewer: graesslin.
This revision is now accepted and ready to land.May 4 2016, 5:54 AM
broulik added inline comments.
tests/kded/serializertest.cpp
230

Shouldn't that config be empty? Or does does it continue using the config from the previous test?

sebas added a comment.May 4 2016, 1:02 PM

I found the logic puzzling at first as well, but what the Serializer does it it takes a config object and tries to change it. (Not my idea, but it seems to work quite OK overall). Serializer::config() is a bit special then because it can do two things: return an invalid pointer or not change the config. This logic is not something I want to change, we have enough bugs in the code as-is, and the last thing I want to do is destabilize it, so I'd rather have it do some additional checking.

This revision was automatically updated to reflect the committed changes.