• Peifeng Yu's avatar
    Improve gdb plugin unit tests · 9cb910b9
    Peifeng Yu authored
    Summary:
    This is a side effect of my work on lldb plugin unit tests, in which I tried to fix the somewhat unreliable test results.
    
    - Move unit test debugees to common folder, make gdb uses common unit test helpers
    - Make gdb plugin unit tests more reliable. waitForState now guarantees the session state after returning is exactly the requested one (otherwise fails the test).
    
    The main problem is that DebugSession could end and get deleted when running event loop (i.e. in QTest::qWait).
    And this fix adds proper checks to it. This by itself doesn't fix any tests, but it helps when some tests
    did goes wrong. Without this fix, they could crash the whole test process due to accessing to deleted object.
    
    Test Plan: gdb plugin unit tests (and actually some lldb plugin unit tests, which is only on local yet)
    
    Reviewers: #kdevelop, apol, kfunk
    
    Reviewed By: #kdevelop, apol, kfunk
    
    Subscribers: kfunk, kdevelop-devel
    
    Differential Revision: https://phabricator.kde.org/D1985
    9cb910b9
test_gdb.cpp 69.8 KB