Mir

Merge lp:~vanvugt/mir/crashing-server into lp:mir

Proposed by Daniel van Vugt
Status: Work in progress
Proposed branch: lp:~vanvugt/mir/crashing-server
Merge into: lp:mir
Diff against target: 113 lines (+93/-0)
3 files modified
tests/CMakeLists.txt (+1/-0)
tests/fatal/CMakeLists.txt (+8/-0)
tests/fatal/crashing_server.cpp (+84/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/crashing-server
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Needs Fixing
Kevin DuBois (community) Needs Information
Mir development team Pending
Review via email: mp+217714@code.launchpad.net

Commit message

tests: Add a "crashing_server" binary to ease testing of debugability issues
arising from crashes in compositor threads (like LP: #1237332).

Hopefully it can some day be automated with some simple scripted analysis
of the resulting core file. But for now that's not possible while the basic
default server requires root/VT access to start at all.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~vanvugt/mir/crashing-server updated
1587. By Daniel van Vugt

Merge latest development-branch

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

This might bring up the 'acceptance test fixture is somewhat bulky' topic, but it seems like this could have an acceptance test, so we're not so reliant on using this server to check for how a crash looks, and so the "please crash nicely with debug info" requirement gets tested in CI. It might be more fiddling with the test fixtures, but in the end we have an automated test.

*needs info/discussion

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Initially I thought that was not feasible because it requires multiple processes and actually crashing the server process. But now I remember our original acceptance test architecture is indeed multi-process, it could be done. So long as you can find _where_ the resulting core file is.

But that kind of automation a harder problem than this manual testing demo. I don't think we should block waiting for a completely automated solution. They're not dependent activities.

lp:~vanvugt/mir/crashing-server updated
1588. By Daniel van Vugt

Merge latest development-branch

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

It is always worth investing the time to automate testing for desired features.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

But that kind of automation a harder problem than this manual testing demo. I don't think we should block waiting for a completely automated solution. They're not dependent activities.

lp:~vanvugt/mir/crashing-server updated
1589. By Daniel van Vugt

Merge latest development-branch

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The above comment should be in quotes (LP stripped them), referring to comments from 2014-05-02.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Come to think of it, if we replace the unrecoverable critical exceptions in the compositor/DRM/KMS with "errors" (abort etc) then this proposal wouldn't be a valid example any more. The throw would need to become abort() or some other raise().

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Work in progress (possibly indefinitely). This branch:
   lp:~vanvugt/mir/fatal-error
will introduce nicer automated testing of crash handling.

Unmerged revisions

1589. By Daniel van Vugt

Merge latest development-branch

1588. By Daniel van Vugt

Merge latest development-branch

1587. By Daniel van Vugt

Merge latest development-branch

1586. By Daniel van Vugt

tests: Add a "crashing_server" binary to ease testing of debugability issues
arising from crashes in compositor threads (like LP: #1237332).

Hopefully it can some day be automated with some simple scripted analysis
of the resulting core file. But for now that's not possible while the basic
default server requires root/VT access to start at all.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/CMakeLists.txt'
2--- tests/CMakeLists.txt 2014-03-26 05:48:59 +0000
3+++ tests/CMakeLists.txt 2014-05-05 03:28:07 +0000
4@@ -45,5 +45,6 @@
5 add_subdirectory(mir_test_doubles/)
6 add_subdirectory(client-language/)
7 add_subdirectory(mir-stress/)
8+add_subdirectory(fatal/)
9
10 mir_add_memcheck_test()
11
12=== added directory 'tests/fatal'
13=== added file 'tests/fatal/CMakeLists.txt'
14--- tests/fatal/CMakeLists.txt 1970-01-01 00:00:00 +0000
15+++ tests/fatal/CMakeLists.txt 2014-05-05 03:28:07 +0000
16@@ -0,0 +1,8 @@
17+add_executable(mir_crashing_server
18+ crashing_server.cpp
19+)
20+
21+target_link_libraries(mir_crashing_server
22+ mirserver
23+)
24+
25
26=== added file 'tests/fatal/crashing_server.cpp'
27--- tests/fatal/crashing_server.cpp 1970-01-01 00:00:00 +0000
28+++ tests/fatal/crashing_server.cpp 2014-05-05 03:28:07 +0000
29@@ -0,0 +1,84 @@
30+/*
31+ * Copyright © 2014 Canonical Ltd.
32+ *
33+ * This program is free software: you can redistribute it and/or modify
34+ * it under the terms of the GNU General Public License version 3 as
35+ * published by the Free Software Foundation.
36+ *
37+ * This program is distributed in the hope that it will be useful,
38+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
39+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40+ * GNU General Public License for more details.
41+ *
42+ * You should have received a copy of the GNU General Public License
43+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
44+ *
45+ * Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
46+ *
47+ *
48+ * This is a test server designed to crash on composition of the first frame.
49+ * It's designed to test the quality of the core files and stack traces
50+ * that result.
51+ */
52+
53+#include "mir/server_configuration.h"
54+#include "mir/default_server_configuration.h"
55+#include "mir/compositor/display_buffer_compositor_factory.h"
56+#include "mir/compositor/display_buffer_compositor.h"
57+#include "mir/report_exception.h"
58+#include "mir/run_mir.h"
59+#include <iostream>
60+
61+using namespace mir;
62+using namespace mir::compositor;
63+
64+class CrashingServerConfiguration : public DefaultServerConfiguration
65+{
66+public:
67+ CrashingServerConfiguration(int argc, char const* argv[])
68+ : DefaultServerConfiguration(argc, argv)
69+ {
70+ }
71+
72+ std::shared_ptr<DisplayBufferCompositorFactory>
73+ the_display_buffer_compositor_factory() override
74+ {
75+ class CrashingDisplayBufferCompositor : public DisplayBufferCompositor
76+ {
77+ public:
78+ bool composite() override
79+ {
80+ throw std::runtime_error("He's dead, Jim");
81+ return false;
82+ }
83+ };
84+
85+ class CrashingDisplayBufferCompositorFactory :
86+ public DisplayBufferCompositorFactory
87+ {
88+ public:
89+ std::unique_ptr<DisplayBufferCompositor>
90+ create_compositor_for(graphics::DisplayBuffer&) override
91+ {
92+ auto raw = new CrashingDisplayBufferCompositor();
93+ return std::unique_ptr<CrashingDisplayBufferCompositor>(raw);
94+ }
95+ };
96+
97+ return std::make_shared<CrashingDisplayBufferCompositorFactory>();
98+ }
99+};
100+
101+int main(int argc, char const* argv[])
102+try
103+{
104+ CrashingServerConfiguration config(argc, argv);
105+
106+ run_mir(config, [](mir::DisplayServer&){} );
107+ return 0;
108+}
109+catch (...)
110+{
111+ mir::report_exception(std::cerr);
112+ return 1;
113+}

Subscribers

People subscribed via source and target branches