Merge lp:~vanvugt/mir/system-performance into lp:mir
- system-performance
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Daniel van Vugt |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3708 |
Proposed branch: | lp:~vanvugt/mir/system-performance |
Merge into: | lp:mir |
Diff against target: |
478 lines (+253/-164) 4 files modified
tests/performance-tests/CMakeLists.txt (+5/-0) tests/performance-tests/system_performance_test.cpp (+191/-0) tests/performance-tests/system_performance_test.h (+46/-0) tests/performance-tests/test_compositor.cpp (+11/-164) |
To merge this branch: | bzr merge lp:~vanvugt/mir/system-performance |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mir CI Bot | continuous-integration | Approve | |
Cemil Azizoglu (community) | Approve | ||
Review via email:
|
Commit message
Generalise CompositorTest into "SystemPerforma
it for non-compositor system performance testing.
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel van Vugt (vanvugt) wrote : | # |
^^^
Bug 1523621, unrelated.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel van Vugt (vanvugt) wrote : | # |
^^^
Bug 1616312 now
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Mir CI Bot (mir-ci-bot) : | # |
Preview Diff
1 | === modified file 'tests/performance-tests/CMakeLists.txt' | |||
2 | --- tests/performance-tests/CMakeLists.txt 2016-08-24 02:09:08 +0000 | |||
3 | +++ tests/performance-tests/CMakeLists.txt 2016-09-16 10:11:25 +0000 | |||
4 | @@ -27,11 +27,16 @@ | |||
5 | 27 | ${GTEST_BOTH_LIBRARIES} | 27 | ${GTEST_BOTH_LIBRARIES} |
6 | 28 | ) | 28 | ) |
7 | 29 | 29 | ||
8 | 30 | add_library(mir_system_performance_test STATIC | ||
9 | 31 | system_performance_test.cpp | ||
10 | 32 | ) | ||
11 | 33 | |||
12 | 30 | mir_add_wrapped_executable(mir_compositor_performance_test | 34 | mir_add_wrapped_executable(mir_compositor_performance_test |
13 | 31 | test_compositor.cpp | 35 | test_compositor.cpp |
14 | 32 | ) | 36 | ) |
15 | 33 | target_link_libraries(mir_compositor_performance_test | 37 | target_link_libraries(mir_compositor_performance_test |
16 | 34 | ${GTEST_BOTH_LIBRARIES} | 38 | ${GTEST_BOTH_LIBRARIES} |
17 | 39 | mir_system_performance_test | ||
18 | 35 | ) | 40 | ) |
19 | 36 | 41 | ||
20 | 37 | mir_add_wrapped_executable(mir_client_startup_performance_test | 42 | mir_add_wrapped_executable(mir_client_startup_performance_test |
21 | 38 | 43 | ||
22 | === added file 'tests/performance-tests/system_performance_test.cpp' | |||
23 | --- tests/performance-tests/system_performance_test.cpp 1970-01-01 00:00:00 +0000 | |||
24 | +++ tests/performance-tests/system_performance_test.cpp 2016-09-16 10:11:25 +0000 | |||
25 | @@ -0,0 +1,191 @@ | |||
26 | 1 | /* | ||
27 | 2 | * Copyright © 2016 Canonical Ltd. | ||
28 | 3 | * | ||
29 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
30 | 5 | * under the terms of the GNU General Public License version 3, | ||
31 | 6 | * as published by the Free Software Foundation. | ||
32 | 7 | * | ||
33 | 8 | * This program is distributed in the hope that it will be useful, | ||
34 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
35 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
36 | 11 | * GNU General Public License for more details. | ||
37 | 12 | * | ||
38 | 13 | * You should have received a copy of the GNU General Public License | ||
39 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
40 | 15 | * | ||
41 | 16 | * Author: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
42 | 17 | */ | ||
43 | 18 | |||
44 | 19 | #include "system_performance_test.h" | ||
45 | 20 | #include <cstdio> | ||
46 | 21 | #include <cstdlib> | ||
47 | 22 | #include <cstring> | ||
48 | 23 | #include <unistd.h> | ||
49 | 24 | #include <string> | ||
50 | 25 | #include <thread> | ||
51 | 26 | |||
52 | 27 | using namespace std::literals::chrono_literals; | ||
53 | 28 | |||
54 | 29 | namespace | ||
55 | 30 | { | ||
56 | 31 | |||
57 | 32 | std::string mir_bin_dir() | ||
58 | 33 | { | ||
59 | 34 | char path[256]; | ||
60 | 35 | auto len = readlink("/proc/self/exe", path, sizeof(path)-1); | ||
61 | 36 | if (len < 0) | ||
62 | 37 | len = 0; | ||
63 | 38 | path[len] = '\0'; | ||
64 | 39 | if (auto slash = strrchr(path, '/')) | ||
65 | 40 | *slash = '\0'; | ||
66 | 41 | return path; | ||
67 | 42 | } | ||
68 | 43 | |||
69 | 44 | void kill_nicely(pid_t pid) | ||
70 | 45 | { | ||
71 | 46 | if (kill(pid, SIGTERM) < 0) | ||
72 | 47 | return; | ||
73 | 48 | int const timeout = 5; | ||
74 | 49 | int status, count = 0; | ||
75 | 50 | while (0 == waitpid(pid, &status, WNOHANG) && count < timeout) | ||
76 | 51 | { | ||
77 | 52 | sleep(1); | ||
78 | 53 | ++count; | ||
79 | 54 | } | ||
80 | 55 | kill(pid, SIGKILL); | ||
81 | 56 | } | ||
82 | 57 | |||
83 | 58 | int exec_cmd(char const* cmd) | ||
84 | 59 | { | ||
85 | 60 | auto buf = strdup(cmd); | ||
86 | 61 | size_t argc = 1; | ||
87 | 62 | char* argv[256] = {buf}; | ||
88 | 63 | char *c = buf; | ||
89 | 64 | while (*c) | ||
90 | 65 | { | ||
91 | 66 | if (*c == ' ') | ||
92 | 67 | { | ||
93 | 68 | *c = '\0'; | ||
94 | 69 | if (argc < (sizeof(argv)/sizeof(argv[0]) - 1)) | ||
95 | 70 | { | ||
96 | 71 | argv[argc] = c + 1; | ||
97 | 72 | ++argc; | ||
98 | 73 | } | ||
99 | 74 | } | ||
100 | 75 | ++c; | ||
101 | 76 | } | ||
102 | 77 | argv[argc] = NULL; | ||
103 | 78 | return execv(argv[0], argv); | ||
104 | 79 | } | ||
105 | 80 | |||
106 | 81 | FILE* popen_with_pid(char const* cmd, pid_t& pid) | ||
107 | 82 | { | ||
108 | 83 | int pipefd[2]; | ||
109 | 84 | if (pipe(pipefd)) | ||
110 | 85 | return NULL; | ||
111 | 86 | |||
112 | 87 | int const& pipe_out = pipefd[0]; | ||
113 | 88 | int const& pipe_in = pipefd[1]; | ||
114 | 89 | |||
115 | 90 | pid = fork(); | ||
116 | 91 | if (pid < 0) | ||
117 | 92 | { | ||
118 | 93 | close(pipe_in); | ||
119 | 94 | close(pipe_out); | ||
120 | 95 | return NULL; | ||
121 | 96 | } | ||
122 | 97 | else if (pid == 0) | ||
123 | 98 | { | ||
124 | 99 | close(pipe_out); | ||
125 | 100 | dup2(pipe_in, 1); // Child stdout goes into pipe_in | ||
126 | 101 | close(pipe_in); | ||
127 | 102 | exec_cmd(cmd); | ||
128 | 103 | exit(errno); | ||
129 | 104 | } | ||
130 | 105 | else | ||
131 | 106 | { | ||
132 | 107 | close(pipe_in); | ||
133 | 108 | } | ||
134 | 109 | |||
135 | 110 | return fdopen(pipe_out, "r"); | ||
136 | 111 | } | ||
137 | 112 | |||
138 | 113 | bool spawn_and_forget(char const* cmd) | ||
139 | 114 | { | ||
140 | 115 | int pid = fork(); | ||
141 | 116 | if (pid == 0) | ||
142 | 117 | { | ||
143 | 118 | // Silence stdout/stderr | ||
144 | 119 | close(1); | ||
145 | 120 | close(2); | ||
146 | 121 | exec_cmd(cmd); | ||
147 | 122 | exit(errno); | ||
148 | 123 | } | ||
149 | 124 | return (pid > 0); | ||
150 | 125 | } | ||
151 | 126 | |||
152 | 127 | bool spawn_and_forget(std::string const& cmd) | ||
153 | 128 | { | ||
154 | 129 | return spawn_and_forget(cmd.c_str()); | ||
155 | 130 | } | ||
156 | 131 | |||
157 | 132 | bool wait_for_file(char const* path, std::chrono::seconds timeout) | ||
158 | 133 | { | ||
159 | 134 | struct stat s; | ||
160 | 135 | int count = 0, max = timeout.count(); | ||
161 | 136 | int ret; | ||
162 | 137 | while ((ret = stat(path, &s)) < 0 && errno == ENOENT && count < max) | ||
163 | 138 | { | ||
164 | 139 | ++count; | ||
165 | 140 | std::this_thread::sleep_for(1s); | ||
166 | 141 | } | ||
167 | 142 | return ret == 0; | ||
168 | 143 | } | ||
169 | 144 | |||
170 | 145 | } // anonymous namespace | ||
171 | 146 | |||
172 | 147 | namespace mir { namespace test { | ||
173 | 148 | |||
174 | 149 | SystemPerformanceTest::SystemPerformanceTest() : bin_dir{mir_bin_dir()} | ||
175 | 150 | { | ||
176 | 151 | } | ||
177 | 152 | |||
178 | 153 | void SystemPerformanceTest::SetUp(std::string const server_args) | ||
179 | 154 | { | ||
180 | 155 | auto const mir_sock = "/tmp/mir_test_socket_"+std::to_string(getpid()); | ||
181 | 156 | auto const server_cmd = | ||
182 | 157 | bin_dir+"/mir_demo_server -f "+mir_sock+" "+server_args; | ||
183 | 158 | |||
184 | 159 | server_output = popen_with_pid(server_cmd.c_str(), server_pid); | ||
185 | 160 | ASSERT_TRUE(server_output) << server_cmd; | ||
186 | 161 | ASSERT_TRUE(wait_for_file(mir_sock.c_str(), 5s)) << server_cmd; | ||
187 | 162 | setenv("MIR_SOCKET", mir_sock.c_str(), 1); | ||
188 | 163 | } | ||
189 | 164 | |||
190 | 165 | void SystemPerformanceTest::TearDown() | ||
191 | 166 | { | ||
192 | 167 | kill_nicely(server_pid); | ||
193 | 168 | fclose(server_output); | ||
194 | 169 | } | ||
195 | 170 | |||
196 | 171 | void SystemPerformanceTest::spawn_clients(std::initializer_list<std::string> clients) | ||
197 | 172 | { | ||
198 | 173 | for (auto& client : clients) | ||
199 | 174 | { | ||
200 | 175 | spawn_and_forget(bin_dir+"/"+client); | ||
201 | 176 | std::this_thread::sleep_for(100ms); | ||
202 | 177 | } | ||
203 | 178 | } | ||
204 | 179 | |||
205 | 180 | void SystemPerformanceTest::run_server_for(std::chrono::seconds timeout) | ||
206 | 181 | { | ||
207 | 182 | pid_t pid = server_pid; | ||
208 | 183 | std::thread killer([timeout,pid]() | ||
209 | 184 | { | ||
210 | 185 | std::this_thread::sleep_for(timeout); | ||
211 | 186 | kill_nicely(pid); | ||
212 | 187 | }); | ||
213 | 188 | killer.detach(); | ||
214 | 189 | } | ||
215 | 190 | |||
216 | 191 | } } // namespace mir::test | ||
217 | 0 | 192 | ||
218 | === added file 'tests/performance-tests/system_performance_test.h' | |||
219 | --- tests/performance-tests/system_performance_test.h 1970-01-01 00:00:00 +0000 | |||
220 | +++ tests/performance-tests/system_performance_test.h 2016-09-16 10:11:25 +0000 | |||
221 | @@ -0,0 +1,46 @@ | |||
222 | 1 | /* | ||
223 | 2 | * Copyright © 2016 Canonical Ltd. | ||
224 | 3 | * | ||
225 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
226 | 5 | * under the terms of the GNU General Public License version 3, | ||
227 | 6 | * as published by the Free Software Foundation. | ||
228 | 7 | * | ||
229 | 8 | * This program is distributed in the hope that it will be useful, | ||
230 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
231 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
232 | 11 | * GNU General Public License for more details. | ||
233 | 12 | * | ||
234 | 13 | * You should have received a copy of the GNU General Public License | ||
235 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
236 | 15 | * | ||
237 | 16 | * Author: Daniel van Vugt <daniel.van.vugt@canonical.com> | ||
238 | 17 | */ | ||
239 | 18 | |||
240 | 19 | #ifndef MIR_TEST_SYSTEM_PERFORMANCE_TEST_H_ | ||
241 | 20 | #define MIR_TEST_SYSTEM_PERFORMANCE_TEST_H_ | ||
242 | 21 | |||
243 | 22 | #include <gtest/gtest.h> | ||
244 | 23 | #include <string> | ||
245 | 24 | #include <chrono> | ||
246 | 25 | #include <initializer_list> | ||
247 | 26 | |||
248 | 27 | namespace mir { namespace test { | ||
249 | 28 | |||
250 | 29 | class SystemPerformanceTest : public testing::Test | ||
251 | 30 | { | ||
252 | 31 | protected: | ||
253 | 32 | SystemPerformanceTest(); | ||
254 | 33 | void SetUp(std::string const server_args); | ||
255 | 34 | void TearDown() override; | ||
256 | 35 | void spawn_clients(std::initializer_list<std::string> clients); | ||
257 | 36 | void run_server_for(std::chrono::seconds timeout); | ||
258 | 37 | |||
259 | 38 | FILE* server_output; | ||
260 | 39 | private: | ||
261 | 40 | std::string const bin_dir; | ||
262 | 41 | pid_t server_pid = 0; | ||
263 | 42 | }; | ||
264 | 43 | |||
265 | 44 | } } // namespace mir::test | ||
266 | 45 | |||
267 | 46 | #endif // MIR_TEST_SYSTEM_PERFORMANCE_TEST_H_ | ||
268 | 0 | 47 | ||
269 | === modified file 'tests/performance-tests/test_compositor.cpp' | |||
270 | --- tests/performance-tests/test_compositor.cpp 2016-05-09 02:49:10 +0000 | |||
271 | +++ tests/performance-tests/test_compositor.cpp 2016-09-16 10:11:25 +0000 | |||
272 | @@ -16,174 +16,23 @@ | |||
273 | 16 | * Author: Daniel van Vugt <daniel.van.vugt@canonical.com> | 16 | * Author: Daniel van Vugt <daniel.van.vugt@canonical.com> |
274 | 17 | */ | 17 | */ |
275 | 18 | 18 | ||
284 | 19 | #include <gtest/gtest.h> | 19 | #include "system_performance_test.h" |
277 | 20 | #include <cstdio> | ||
278 | 21 | #include <cstdlib> | ||
279 | 22 | #include <cstring> | ||
280 | 23 | #include <unistd.h> | ||
281 | 24 | #include <string> | ||
282 | 25 | #include <thread> | ||
283 | 26 | #include <initializer_list> | ||
285 | 27 | 20 | ||
286 | 28 | using namespace std::literals::chrono_literals; | 21 | using namespace std::literals::chrono_literals; |
287 | 22 | using namespace mir::test; | ||
288 | 29 | 23 | ||
289 | 30 | namespace | 24 | namespace |
290 | 31 | { | 25 | { |
406 | 32 | 26 | struct CompositorPerformance : SystemPerformanceTest | |
292 | 33 | std::string mir_bin_dir() | ||
293 | 34 | { | ||
294 | 35 | char path[256]; | ||
295 | 36 | auto len = readlink("/proc/self/exe", path, sizeof(path)-1); | ||
296 | 37 | if (len < 0) | ||
297 | 38 | len = 0; | ||
298 | 39 | path[len] = '\0'; | ||
299 | 40 | if (auto slash = strrchr(path, '/')) | ||
300 | 41 | *slash = '\0'; | ||
301 | 42 | return path; | ||
302 | 43 | } | ||
303 | 44 | |||
304 | 45 | void kill_nicely(pid_t pid) | ||
305 | 46 | { | ||
306 | 47 | if (kill(pid, SIGTERM) < 0) | ||
307 | 48 | return; | ||
308 | 49 | int const timeout = 5; | ||
309 | 50 | int status, count = 0; | ||
310 | 51 | while (0 == waitpid(pid, &status, WNOHANG) && count < timeout) | ||
311 | 52 | { | ||
312 | 53 | sleep(1); | ||
313 | 54 | ++count; | ||
314 | 55 | } | ||
315 | 56 | kill(pid, SIGKILL); | ||
316 | 57 | } | ||
317 | 58 | |||
318 | 59 | int exec_cmd(char const* cmd) | ||
319 | 60 | { | ||
320 | 61 | auto buf = strdup(cmd); | ||
321 | 62 | size_t argc = 1; | ||
322 | 63 | char* argv[256] = {buf}; | ||
323 | 64 | char *c = buf; | ||
324 | 65 | while (*c) | ||
325 | 66 | { | ||
326 | 67 | if (*c == ' ') | ||
327 | 68 | { | ||
328 | 69 | *c = '\0'; | ||
329 | 70 | if (argc < (sizeof(argv)/sizeof(argv[0]) - 1)) | ||
330 | 71 | { | ||
331 | 72 | argv[argc] = c + 1; | ||
332 | 73 | ++argc; | ||
333 | 74 | } | ||
334 | 75 | } | ||
335 | 76 | ++c; | ||
336 | 77 | } | ||
337 | 78 | argv[argc] = NULL; | ||
338 | 79 | return execv(argv[0], argv); | ||
339 | 80 | } | ||
340 | 81 | |||
341 | 82 | FILE* popen_with_pid(char const* cmd, pid_t& pid) | ||
342 | 83 | { | ||
343 | 84 | int pipefd[2]; | ||
344 | 85 | if (pipe(pipefd)) | ||
345 | 86 | return NULL; | ||
346 | 87 | |||
347 | 88 | int const& pipe_out = pipefd[0]; | ||
348 | 89 | int const& pipe_in = pipefd[1]; | ||
349 | 90 | |||
350 | 91 | pid = fork(); | ||
351 | 92 | if (pid < 0) | ||
352 | 93 | { | ||
353 | 94 | close(pipe_in); | ||
354 | 95 | close(pipe_out); | ||
355 | 96 | return NULL; | ||
356 | 97 | } | ||
357 | 98 | else if (pid == 0) | ||
358 | 99 | { | ||
359 | 100 | close(pipe_out); | ||
360 | 101 | dup2(pipe_in, 1); // Child stdout goes into pipe_in | ||
361 | 102 | close(pipe_in); | ||
362 | 103 | exec_cmd(cmd); | ||
363 | 104 | exit(errno); | ||
364 | 105 | } | ||
365 | 106 | else | ||
366 | 107 | { | ||
367 | 108 | close(pipe_in); | ||
368 | 109 | } | ||
369 | 110 | |||
370 | 111 | return fdopen(pipe_out, "r"); | ||
371 | 112 | } | ||
372 | 113 | |||
373 | 114 | bool spawn_and_forget(char const* cmd) | ||
374 | 115 | { | ||
375 | 116 | int pid = fork(); | ||
376 | 117 | if (pid == 0) | ||
377 | 118 | { | ||
378 | 119 | // Silence stdout/stderr | ||
379 | 120 | close(1); | ||
380 | 121 | close(2); | ||
381 | 122 | exec_cmd(cmd); | ||
382 | 123 | exit(errno); | ||
383 | 124 | } | ||
384 | 125 | return (pid > 0); | ||
385 | 126 | } | ||
386 | 127 | |||
387 | 128 | bool spawn_and_forget(std::string const& cmd) | ||
388 | 129 | { | ||
389 | 130 | return spawn_and_forget(cmd.c_str()); | ||
390 | 131 | } | ||
391 | 132 | |||
392 | 133 | bool wait_for_file(char const* path, std::chrono::seconds timeout) | ||
393 | 134 | { | ||
394 | 135 | struct stat s; | ||
395 | 136 | int count = 0, max = timeout.count(); | ||
396 | 137 | int ret; | ||
397 | 138 | while ((ret = stat(path, &s)) < 0 && errno == ENOENT && count < max) | ||
398 | 139 | { | ||
399 | 140 | ++count; | ||
400 | 141 | std::this_thread::sleep_for(1s); | ||
401 | 142 | } | ||
402 | 143 | return ret == 0; | ||
403 | 144 | } | ||
404 | 145 | |||
405 | 146 | struct CompositorPerformance : testing::Test | ||
407 | 147 | { | 27 | { |
408 | 148 | void SetUp() override | 28 | void SetUp() override |
409 | 149 | { | 29 | { |
410 | 150 | compositor_fps = compositor_render_time = -1.0f; | 30 | compositor_fps = compositor_render_time = -1.0f; |
447 | 151 | 31 | SystemPerformanceTest::SetUp("--compositor-report=log"); | |
448 | 152 | auto const mir_sock = "/tmp/mir_test_socket_"+std::to_string(getpid()); | 32 | } |
449 | 153 | auto const server_cmd = | 33 | |
450 | 154 | bin_dir+"/mir_demo_server --compositor-report=log -f "+mir_sock; | 34 | void read_compositor_report() |
451 | 155 | 35 | { | |
416 | 156 | server_output = popen_with_pid(server_cmd.c_str(), server_pid); | ||
417 | 157 | ASSERT_TRUE(server_output) << server_cmd; | ||
418 | 158 | ASSERT_TRUE(wait_for_file(mir_sock.c_str(), 5s)) << server_cmd; | ||
419 | 159 | setenv("MIR_SOCKET", mir_sock.c_str(), 1); | ||
420 | 160 | } | ||
421 | 161 | |||
422 | 162 | void TearDown() override | ||
423 | 163 | { | ||
424 | 164 | kill_nicely(server_pid); | ||
425 | 165 | fclose(server_output); | ||
426 | 166 | } | ||
427 | 167 | |||
428 | 168 | void spawn_clients(std::initializer_list<std::string> clients) | ||
429 | 169 | { | ||
430 | 170 | for (auto& client : clients) | ||
431 | 171 | { | ||
432 | 172 | spawn_and_forget(bin_dir+"/"+client); | ||
433 | 173 | std::this_thread::sleep_for(100ms); | ||
434 | 174 | } | ||
435 | 175 | } | ||
436 | 176 | |||
437 | 177 | void wait_for_server(std::chrono::seconds timeout) | ||
438 | 178 | { | ||
439 | 179 | pid_t pid = server_pid; | ||
440 | 180 | std::thread killer([timeout,pid]() | ||
441 | 181 | { | ||
442 | 182 | std::this_thread::sleep_for(timeout); | ||
443 | 183 | kill_nicely(pid); | ||
444 | 184 | }); | ||
445 | 185 | killer.detach(); | ||
446 | 186 | |||
452 | 187 | char line[256]; | 36 | char line[256]; |
453 | 188 | while (fgets(line, sizeof(line), server_output)) | 37 | while (fgets(line, sizeof(line), server_output)) |
454 | 189 | { | 38 | { |
455 | @@ -200,12 +49,8 @@ | |||
456 | 200 | } | 49 | } |
457 | 201 | } | 50 | } |
458 | 202 | 51 | ||
459 | 203 | std::string const bin_dir{mir_bin_dir()}; | ||
460 | 204 | pid_t server_pid = 0; | ||
461 | 205 | FILE* server_output; | ||
462 | 206 | float compositor_fps, compositor_render_time; | 52 | float compositor_fps, compositor_render_time; |
463 | 207 | }; | 53 | }; |
464 | 208 | |||
465 | 209 | } // anonymous namespace | 54 | } // anonymous namespace |
466 | 210 | 55 | ||
467 | 211 | TEST_F(CompositorPerformance, regression_test_1563287) | 56 | TEST_F(CompositorPerformance, regression_test_1563287) |
468 | @@ -216,7 +61,9 @@ | |||
469 | 216 | "mir_demo_client_scroll", | 61 | "mir_demo_client_scroll", |
470 | 217 | "mir_demo_client_egltriangle -b0.5", | 62 | "mir_demo_client_egltriangle -b0.5", |
471 | 218 | "mir_demo_client_multiwin"}); | 63 | "mir_demo_client_multiwin"}); |
473 | 219 | wait_for_server(10s); | 64 | run_server_for(10s); |
474 | 65 | |||
475 | 66 | read_compositor_report(); | ||
476 | 220 | EXPECT_GE(compositor_fps, 58.0f); | 67 | EXPECT_GE(compositor_fps, 58.0f); |
477 | 221 | EXPECT_LT(compositor_render_time, 17.0f); | 68 | EXPECT_LT(compositor_render_time, 17.0f); |
478 | 222 | } | 69 | } |
PASSED: Continuous integration, rev:3707 /mir-jenkins. ubuntu. com/job/ mir-ci/ 1744/ /mir-jenkins. ubuntu. com/job/ build-mir/ 2184 /mir-jenkins. ubuntu. com/job/ build-0- fetch/2247 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= vivid+overlay/ 2238 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= xenial+ overlay/ 2238 /mir-jenkins. ubuntu. com/job/ build-1- sourcepkg/ release= yakkety/ 2238 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 2212 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= clang,platform= mesa,release= yakkety/ 2212/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2212 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2212/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 2212 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= amd64,compiler= gcc,platform= mesa,release= yakkety/ 2212/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 2212 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= android, release= vivid+overlay/ 2212/artifact/ output/ *zip*/output. zip /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2212 /mir-jenkins. ubuntu. com/job/ build-2- binpkg- mir/arch= i386,compiler= gcc,platform= mesa,release= xenial+ overlay/ 2212/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /mir-jenkins. ubuntu. com/job/ mir-ci/ 1744/rebuild
https:/