Mir

Merge lp:~kdub/mir/turn-android-ci-on into lp:~mir-team/mir/trunk

Proposed by Kevin DuBois
Status: Work in progress
Proposed branch: lp:~kdub/mir/turn-android-ci-on
Merge into: lp:~mir-team/mir/trunk
Diff against target: 1372 lines (+577/-162)
23 files modified
3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp (+157/-5)
debian/rules (+0/-2)
include/test/mir_test_framework/display_server_test_fixture.h (+2/-0)
include/test/mir_test_framework/stub_client_connection_configuration.h (+35/-0)
include/test/mir_test_framework/testing_client_configuration.h (+43/-0)
include/test/mir_test_framework/testing_process_manager.h (+7/-8)
src/client/mir_client_library.cpp (+39/-17)
src/server/graphics/android/hwc_common_device.cpp (+15/-13)
tests/acceptance-tests/test_client_authorization.cpp (+7/-0)
tests/acceptance-tests/test_client_focus_notification.cpp (+2/-9)
tests/acceptance-tests/test_client_input.cpp (+8/-15)
tests/acceptance-tests/test_client_library.cpp (+30/-17)
tests/acceptance-tests/test_focus_selection.cpp (+2/-9)
tests/acceptance-tests/test_server_shutdown.cpp (+2/-9)
tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp (+2/-9)
tests/acceptance-tests/test_surfaceloop.cpp (+3/-10)
tests/acceptance-tests/test_surfaces_with_output_id.cpp (+2/-9)
tests/mir_test_framework/CMakeLists.txt (+1/-0)
tests/mir_test_framework/display_server_test_fixture.cpp (+9/-6)
tests/mir_test_framework/testing_client_options.cpp (+126/-0)
tests/mir_test_framework/testing_process_manager.cpp (+41/-1)
tests/unit-tests/graphics/android/test_hwc_device.cpp (+25/-1)
tests/unit-tests/logging/test_legacy_input_report.cpp (+19/-22)
To merge this branch: bzr merge lp:~kdub/mir/turn-android-ci-on
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Mir development team Pending
Review via email: mp+188091@code.launchpad.net

Description of the change

just bouncing this off jenkins at the moment, don't review yet

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:1094
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~kdub/mir/turn-android-ci-on/+merge/188091/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mir-ci/1571/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-android-saucy-i386-build/2168
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-clang-saucy-amd64-build/2053
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-saucy-amd64-ci/815
        deb: http://jenkins.qa.ubuntu.com/job/mir-saucy-amd64-ci/815/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-saucy-armhf-ci/71/console

Click here to trigger a rebuild:
http://s-jenkins:8080/job/mir-ci/1571/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

1094. By Kevin DuBois

turn on acceptance and unit tests in debian/rules for android

1093. By Kevin DuBois

merge in acceptance fixes

1092. By Kevin DuBois

graphics: android: change fb blank request to only by made when there's a change of state. Also correct a failing unit test in trunk

fix: lp-1231594.

Approved by PS Jenkins bot, Robert Carr.

1091. By Daniel d'Andrada

Bring back android-input logging functionality

- prefix log message with the tag name from where the log function was called.
- filter log messages by tag name and priority with the ANDROID_LOG_TAGS
  environment var.

Approved by PS Jenkins bot, Alexandros Frantzis, Alan Griffiths.

1090. By Alexandros Frantzis

tests: Fix compiler warning about maybe-uninitialized struct member

1089. By Robert Ancell

Merge in debian/changelog changes

1088. By Robert Ancell

Bump ABI.

Approved by PS Jenkins bot, Kevin DuBois.

1087. By Alan Griffiths

frontend, config: Mechanism for connecting via a socket pair.

Approved by PS Jenkins bot, Kevin DuBois, Alexandros Frantzis.

1086. By Kevin DuBois

graphics: android: stop nex4 from tearing

fix hwc1.1 to be compliant to the the proper rendering pass by calling the prepare hook, and by waiting on the fence that set() returns, instead of relying on the 'vsync heartbeat signal' to sync to vsync.

fix: lp1195265.

Approved by Alan Griffiths, PS Jenkins bot, Ricardo Salveti.

1085. By Alexandros Frantzis

gbm: Blank unused connected outputs.

Approved by Alan Griffiths, PS Jenkins bot.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp'
2--- 3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp 2013-05-04 00:50:30 +0000
3+++ 3rd_party/android-input/android/frameworks/base/services/input/MirLog.cpp 2013-09-27 16:15:22 +0000
4@@ -14,13 +14,143 @@
5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
6 *
7 * Authored by: Alan Griffiths <alan@octopull.co.uk>
8- */
9-
10-#include <std/Log.h>
11+ * Daniel d'Andrada <daniel.dandrada@canonical.com>
12+ */
13+
14+// License of the original configureInitialState() function:
15+/*
16+ * Copyright (C) 2008 The Android Open Source Project
17+ *
18+ * Licensed under the Apache License, Version 2.0 (the "License");
19+ * you may not use this file except in compliance with the License.
20+ * You may obtain a copy of the License at
21+ *
22+ * http://www.apache.org/licenses/LICENSE-2.0
23+ *
24+ * Unless required by applicable law or agreed to in writing, software
25+ * distributed under the License is distributed on an "AS IS" BASIS,
26+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27+ * See the License for the specific language governing permissions and
28+ * limitations under the License.
29+ */
30+
31+#include <android/log.h>
32 #include <std/MirLog.h>
33+#include <cctype>
34 #include <cstdarg>
35 #include <cstdio>
36-
37+#include <cstdlib>
38+#include <cstring>
39+
40+#define kMaxTagLen 16 /* from the long-dead utils/Log.cpp */
41+#define kTagSetSize 16 /* arbitrary */
42+
43+namespace
44+{
45+ struct LogState {
46+ /* global minimum priority */
47+ int globalMinPriority;
48+
49+ /* tags and priorities */
50+ struct {
51+ char tag[kMaxTagLen];
52+ int minPriority;
53+ } tagSet[kTagSetSize];
54+ } gLogState = { .globalMinPriority = ANDROID_LOG_UNKNOWN };
55+}
56+
57+/*
58+ * Configure logging based on ANDROID_LOG_TAGS environment variable. We
59+ * need to parse a string that looks like
60+ *
61+ * *:v jdwp:d dalvikvm:d dalvikvm-gc:i dalvikvmi:i
62+ *
63+ * The tag (or '*' for the global level) comes first, followed by a colon
64+ * and a letter indicating the minimum priority level we're expected to log.
65+ * This can be used to reveal or conceal logs with specific tags.
66+ *
67+ * We also want to check ANDROID_PRINTF_LOG to determine how the output
68+ * will look.
69+ */
70+static void configureInitialState(struct LogState* logState)
71+{
72+ /* global min priority defaults to "info" level */
73+ logState->globalMinPriority = ANDROID_LOG_INFO;
74+
75+ int entry = 0;
76+
77+ /*
78+ * This is based on the the long-dead utils/Log.cpp code.
79+ */
80+ const char* tags = getenv("ANDROID_LOG_TAGS");
81+ if (tags != NULL) {
82+ while (*tags != '\0') {
83+ char tagName[kMaxTagLen];
84+ int i, minPrio;
85+
86+ while (isspace(*tags))
87+ tags++;
88+
89+ i = 0;
90+ while (*tags != '\0' && !isspace(*tags) && *tags != ':' &&
91+ i < kMaxTagLen)
92+ {
93+ tagName[i++] = *tags++;
94+ }
95+ if (i == kMaxTagLen) {
96+ break;
97+ }
98+ tagName[i] = '\0';
99+
100+ /* default priority, if there's no ":" part; also zero out '*' */
101+ minPrio = ANDROID_LOG_VERBOSE;
102+ if (tagName[0] == '*' && tagName[1] == '\0') {
103+ minPrio = ANDROID_LOG_DEBUG;
104+ tagName[0] = '\0';
105+ }
106+
107+ if (*tags == ':') {
108+ tags++;
109+ if (*tags >= '0' && *tags <= '9') {
110+ if (*tags >= ('0' + ANDROID_LOG_SILENT))
111+ minPrio = ANDROID_LOG_VERBOSE;
112+ else
113+ minPrio = *tags - '\0';
114+ } else {
115+ switch (*tags) {
116+ case 'v': minPrio = ANDROID_LOG_VERBOSE; break;
117+ case 'd': minPrio = ANDROID_LOG_DEBUG; break;
118+ case 'i': minPrio = ANDROID_LOG_INFO; break;
119+ case 'w': minPrio = ANDROID_LOG_WARN; break;
120+ case 'e': minPrio = ANDROID_LOG_ERROR; break;
121+ case 'f': minPrio = ANDROID_LOG_FATAL; break;
122+ case 's': minPrio = ANDROID_LOG_SILENT; break;
123+ default: minPrio = ANDROID_LOG_DEFAULT; break;
124+ }
125+ }
126+
127+ tags++;
128+ if (*tags != '\0' && !isspace(*tags)) {
129+ break;
130+ }
131+ }
132+
133+ if (tagName[0] == 0) {
134+ logState->globalMinPriority = minPrio;
135+ } else {
136+ logState->tagSet[entry].minPriority = minPrio;
137+ strcpy(logState->tagSet[entry].tag, tagName);
138+ entry++;
139+ }
140+ }
141+ }
142+
143+ if (entry < kTagSetSize) {
144+ // Mark the end of this array
145+ logState->tagSet[entry].minPriority = ANDROID_LOG_UNKNOWN;
146+ logState->tagSet[entry].tag[0] = '\0';
147+ }
148+}
149
150 extern "C" int __android_log_print(int prio, const char *tag, const char *fmt, ...)
151 {
152@@ -30,7 +160,29 @@
153 int result = vsnprintf(buffer, sizeof buffer - 1, fmt, ap);
154 va_end(ap);
155
156- mir::write_to_log(prio, buffer);
157+ if (gLogState.globalMinPriority == ANDROID_LOG_UNKNOWN) {
158+ configureInitialState(&gLogState);
159+ }
160+
161+ /* see if this log tag is configured */
162+ int minPrio = gLogState.globalMinPriority;
163+ for (int i = 0; i < kTagSetSize; i++) {
164+ if (gLogState.tagSet[i].minPriority == ANDROID_LOG_UNKNOWN)
165+ break; /* reached end of configured values */
166+
167+ if (strcmp(gLogState.tagSet[i].tag, tag) == 0) {
168+ minPrio = gLogState.tagSet[i].minPriority;
169+ break;
170+ }
171+ }
172+
173+ if (prio >= minPrio) {
174+ char taggedBuffer[1024];
175+ sprintf(taggedBuffer, "[%s]%s", tag, buffer);
176+ mir::write_to_log(prio, taggedBuffer);
177+ } else {
178+ // filter out log message
179+ }
180
181 return result;
182 }
183
184=== modified file 'debian/rules'
185--- debian/rules 2013-09-23 13:52:58 +0000
186+++ debian/rules 2013-09-27 16:15:22 +0000
187@@ -22,8 +22,6 @@
188 dh_auto_configure -- \
189 $(COMMON_CONFIGURE_OPTIONS) \
190 -DMIR_PLATFORM=android \
191- -DMIR_ENABLE_UNIT_TESTS=NO \
192- -DMIR_ENABLE_ACCEPTANCE_TESTS=NO \
193 -DMIR_ENABLE_INTEGRATION_TESTS=NO
194 else
195 ifeq ($(DEB_HOST_ARCH),powerpc)
196
197=== modified file 'include/test/mir_test_framework/display_server_test_fixture.h'
198--- include/test/mir_test_framework/display_server_test_fixture.h 2013-08-28 03:41:48 +0000
199+++ include/test/mir_test_framework/display_server_test_fixture.h 2013-09-27 16:15:22 +0000
200@@ -46,6 +46,7 @@
201
202 private:
203 static TestingProcessManager process_manager;
204+ static TestingServerConfiguration default_parameters;
205
206 virtual void TearDown();
207 };
208@@ -74,6 +75,7 @@
209
210 private:
211 TestingProcessManager process_manager;
212+ std::shared_ptr<mir::options::Option> test_options;
213 };
214
215 }
216
217=== added file 'include/test/mir_test_framework/stub_client_connection_configuration.h'
218--- include/test/mir_test_framework/stub_client_connection_configuration.h 1970-01-01 00:00:00 +0000
219+++ include/test/mir_test_framework/stub_client_connection_configuration.h 2013-09-27 16:15:22 +0000
220@@ -0,0 +1,35 @@
221+/*
222+ * Copyright © 2013 Canonical Ltd.
223+ *
224+ * This program is free software: you can redistribute it and/or modify it
225+ * under the terms of the GNU General Public License version 3,
226+ * as published by the Free Software Foundation.
227+ *
228+ * This program is distributed in the hope that it will be useful,
229+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
230+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
231+ * GNU General Public License for more details.
232+ *
233+ * You should have received a copy of the GNU General Public License
234+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
235+ *
236+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
237+ */
238+
239+#ifndef MIR_TESTING_STUB_CLIENT_CONNECTION_CONFIGURATION
240+#define MIR_TESTING_STUB_CLIENT_CONNECTION_CONFIGURATION
241+
242+#include "src/client/default_connection_configuration.h"
243+#include <memory>
244+
245+namespace mir_test_framework
246+{
247+
248+struct StubConnectionConfiguration : public mir::client::DefaultConnectionConfiguration
249+{
250+ StubConnectionConfiguration(std::string const& socket_file);
251+ std::shared_ptr<mir::client::ClientPlatformFactory> the_client_platform_factory() override;
252+};
253+
254+}
255+#endif /* MIR_TESTING_STUB_CLIENT_CONNECTION_CONFIGURATION */
256
257=== added file 'include/test/mir_test_framework/testing_client_configuration.h'
258--- include/test/mir_test_framework/testing_client_configuration.h 1970-01-01 00:00:00 +0000
259+++ include/test/mir_test_framework/testing_client_configuration.h 2013-09-27 16:15:22 +0000
260@@ -0,0 +1,43 @@
261+/*
262+ * Copyright © 2013 Canonical Ltd.
263+ *
264+ * This program is free software: you can redistribute it and/or modify it
265+ * under the terms of the GNU General Public License version 3,
266+ * as published by the Free Software Foundation.
267+ *
268+ * This program is distributed in the hope that it will be useful,
269+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
270+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
271+ * GNU General Public License for more details.
272+ *
273+ * You should have received a copy of the GNU General Public License
274+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
275+ *
276+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
277+ */
278+
279+#ifndef MIR_TESTING_CLIENT_CONFIGURATION
280+#define MIR_TESTING_CLIENT_CONFIGURATION
281+
282+#include "mir/options/option.h"
283+
284+namespace mir_test_framework
285+{
286+
287+struct TestingClientConfiguration
288+{
289+ virtual ~TestingClientConfiguration() = default;
290+
291+ // Code to run in client process
292+ virtual void exec() = 0;
293+
294+ //clients respect the tests-use-real-graphics option by default. use
295+ //this function to force the use of the default client configuraiton
296+ virtual bool use_real_graphics(mir::options::Option const& options)
297+ {
298+ return options.get("tests-use-real-graphics", false);
299+ }
300+};
301+
302+}
303+#endif /* MIR_TESTING_CLIENT_CONFIGURATION */
304
305=== modified file 'include/test/mir_test_framework/testing_process_manager.h'
306--- include/test/mir_test_framework/testing_process_manager.h 2013-08-28 03:41:48 +0000
307+++ include/test/mir_test_framework/testing_process_manager.h 2013-09-27 16:15:22 +0000
308@@ -24,6 +24,7 @@
309 #include "mir_test_framework/process.h"
310
311 #include "mir_test_framework/testing_server_configuration.h"
312+#include "mir_test_framework/testing_client_configuration.h"
313
314 #include <memory>
315 #include <list>
316@@ -32,19 +33,16 @@
317 namespace mir
318 {
319 class DisplayServer;
320+namespace options
321+{
322+class Option;
323+}
324 }
325
326 namespace mir_test_framework
327 {
328 using namespace mir;
329
330-struct TestingClientConfiguration
331-{
332- virtual ~TestingClientConfiguration() = default;
333- // Code to run in client process
334- virtual void exec() = 0;
335-};
336-
337
338 class TestingProcessManager
339 {
340@@ -53,7 +51,8 @@
341 ~TestingProcessManager();
342
343 void launch_server_process(TestingServerConfiguration& config);
344- void launch_client_process(TestingClientConfiguration& config);
345+ void launch_client_process(TestingClientConfiguration& config,
346+ mir::options::Option const& test_options);
347
348 void tear_down_clients();
349 void tear_down_server();
350
351=== modified file 'src/client/mir_client_library.cpp'
352--- src/client/mir_client_library.cpp 2013-08-28 03:41:48 +0000
353+++ src/client/mir_client_library.cpp 2013-09-27 16:15:22 +0000
354@@ -77,7 +77,8 @@
355
356 }
357
358-MirWaitHandle* mir_connect(char const* socket_file, char const* name, mir_connected_callback callback, void * context)
359+MirWaitHandle* mir_default_connect(
360+ char const* socket_file, char const* name, mir_connected_callback callback, void * context)
361 {
362
363 try
364@@ -93,7 +94,7 @@
365 else
366 sock = mir::default_server_socket;
367 }
368-
369+
370 mcl::DefaultConnectionConfiguration conf{sock};
371
372 MirConnection* connection = new MirConnection(conf);
373@@ -110,6 +111,42 @@
374 }
375 }
376
377+
378+void mir_default_connection_release(MirConnection * connection)
379+{
380+ if (!error_connections.contains(connection))
381+ {
382+ auto wait_handle = connection->disconnect();
383+ wait_handle->wait_for_all();
384+ }
385+ else
386+ {
387+ error_connections.remove(connection);
388+ }
389+
390+ delete connection;
391+}
392+
393+//mir_connect and mir_connection_release can be overridden by test code that sets these function
394+//pointers to do things like stub out the graphics drivers or change the connection configuration.
395+
396+//TODO: we could have a more comprehensive solution that allows us to substitute any of the functions
397+//for test purposes, not just the connect functions
398+MirWaitHandle* (*mir_connect_impl)(
399+ char const *server, char const *app_name,
400+ mir_connected_callback callback, void *context) = mir_default_connect;
401+void (*mir_connection_release_impl) (MirConnection *connection) = mir_default_connection_release;
402+
403+MirWaitHandle* mir_connect(char const* socket_file, char const* name, mir_connected_callback callback, void * context)
404+{
405+ return mir_connect_impl(socket_file, name, callback, context);
406+}
407+
408+void mir_connection_release(MirConnection *connection)
409+{
410+ return mir_connection_release_impl(connection);
411+}
412+
413 MirConnection *mir_connect_sync(char const *server,
414 char const *app_name)
415 {
416@@ -131,21 +168,6 @@
417 return connection->get_error_message();
418 }
419
420-void mir_connection_release(MirConnection * connection)
421-{
422- if (!error_connections.contains(connection))
423- {
424- auto wait_handle = connection->disconnect();
425- wait_handle->wait_for_all();
426- }
427- else
428- {
429- error_connections.remove(connection);
430- }
431-
432- delete connection;
433-}
434-
435 MirEGLNativeDisplayType mir_connection_get_egl_native_display(MirConnection *connection)
436 {
437 return connection->egl_native_display();
438
439=== modified file 'src/server/graphics/android/hwc_common_device.cpp'
440--- src/server/graphics/android/hwc_common_device.cpp 2013-09-18 16:08:14 +0000
441+++ src/server/graphics/android/hwc_common_device.cpp 2013-09-27 16:15:22 +0000
442@@ -97,22 +97,24 @@
443 coordinator->notify_vsync();
444 }
445
446-void mga::HWCCommonDevice::blank_or_unblank_screen(bool blank)
447+void mga::HWCCommonDevice::blank_or_unblank_screen(bool blank_request)
448 {
449 std::unique_lock<std::mutex> lg(blanked_mutex);
450-
451- int err = hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, blank);
452- if (err)
453+
454+ if (blank_request != blanked)
455 {
456- std::string blanking_status_msg = "Could not " +
457- (blank ? std::string("blank") : std::string("unblank")) + " display";
458- BOOST_THROW_EXCEPTION(
459- boost::enable_error_info(
460- std::runtime_error(blanking_status_msg)) <<
461- boost::errinfo_errno(-err));
462- }
463- blanked = blank;
464- blanked_cond.notify_all();
465+ if(auto err = hwc_device->blank(hwc_device.get(), HWC_DISPLAY_PRIMARY, blank_request))
466+ {
467+ std::string blanking_status_msg = "Could not " +
468+ (blank_request ? std::string("blank") : std::string("unblank")) + " display";
469+ BOOST_THROW_EXCEPTION(
470+ boost::enable_error_info(
471+ std::runtime_error(blanking_status_msg)) <<
472+ boost::errinfo_errno(-err));
473+ }
474+ blanked = blank_request;
475+ blanked_cond.notify_all();
476+ }
477 }
478
479 std::unique_lock<std::mutex> mga::HWCCommonDevice::lock_unblanked()
480
481=== modified file 'tests/acceptance-tests/test_client_authorization.cpp'
482--- tests/acceptance-tests/test_client_authorization.cpp 2013-08-28 03:41:48 +0000
483+++ tests/acceptance-tests/test_client_authorization.cpp 2013-09-27 16:15:22 +0000
484@@ -253,6 +253,13 @@
485 mir_connection_release(connection);
486 }
487
488+ //we are testing the connect function itself, without getting to the
489+ // point where drivers are used, so force using production config
490+ bool use_real_graphics(mir::options::Option const&) override
491+ {
492+ return true;
493+ }
494+
495 ClientPidTestFixture::SharedRegion* shared_region;
496 } client_config(shared_region);
497 launch_client_process(client_config);
498
499=== modified file 'tests/acceptance-tests/test_client_focus_notification.cpp'
500--- tests/acceptance-tests/test_client_focus_notification.cpp 2013-09-17 14:31:42 +0000
501+++ tests/acceptance-tests/test_client_focus_notification.cpp 2013-09-27 16:15:22 +0000
502@@ -30,13 +30,6 @@
503 namespace mt = mir::test;
504 namespace mtf = mir_test_framework;
505
506-// TODO resolve problems running tests on android
507-#ifdef ANDROID
508-#define DISABLED_ON_ANDROID(name) DISABLED_##name
509-#else
510-#define DISABLED_ON_ANDROID(name) name
511-#endif
512-
513 namespace
514 {
515 char const* const mir_test_socket = mtf::test_socket_file().c_str();
516@@ -147,7 +140,7 @@
517
518 }
519
520-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(a_surface_is_notified_of_receiving_focus))
521+TEST_F(BespokeDisplayServerTestFixture, a_surface_is_notified_of_receiving_focus)
522 {
523 using namespace ::testing;
524
525@@ -176,7 +169,7 @@
526
527 }
528
529-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(two_surfaces_are_notified_of_gaining_and_losing_focus))
530+TEST_F(BespokeDisplayServerTestFixture, two_surfaces_are_notified_of_gaining_and_losing_focus)
531 {
532 using namespace ::testing;
533
534
535=== modified file 'tests/acceptance-tests/test_client_input.cpp'
536--- tests/acceptance-tests/test_client_input.cpp 2013-09-20 15:48:40 +0000
537+++ tests/acceptance-tests/test_client_input.cpp 2013-09-27 16:15:22 +0000
538@@ -63,13 +63,6 @@
539 namespace mtd = mt::doubles;
540 namespace mtf = mir_test_framework;
541
542-// TODO resolve problems running tests on android
543-#ifdef ANDROID
544-#define DISABLED_ON_ANDROID(name) DISABLED_##name
545-#else
546-#define DISABLED_ON_ANDROID(name) name
547-#endif
548-
549 namespace
550 {
551 char const* const mir_test_socket = mtf::test_socket_file().c_str();
552@@ -312,7 +305,7 @@
553
554 using TestClientInput = BespokeDisplayServerTestFixture;
555
556-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_key_input))
557+TEST_F(TestClientInput, clients_receive_key_input)
558 {
559 using namespace ::testing;
560
561@@ -358,7 +351,7 @@
562 launch_client_process(client_config);
563 }
564
565-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_us_english_mapped_keys))
566+TEST_F(TestClientInput, clients_receive_us_english_mapped_keys)
567 {
568 using namespace ::testing;
569 static std::string const test_client_name = "1";
570@@ -404,7 +397,7 @@
571 launch_client_process(client_config);
572 }
573
574-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_motion_inside_window))
575+TEST_F(TestClientInput, clients_receive_motion_inside_window)
576 {
577 using namespace ::testing;
578 static std::string const test_client_name = "1";
579@@ -453,7 +446,7 @@
580 launch_client_process(client_config);
581 }
582
583-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_receive_button_events_inside_window))
584+TEST_F(TestClientInput, clients_receive_button_events_inside_window)
585 {
586 using namespace ::testing;
587
588@@ -534,7 +527,7 @@
589
590 }
591
592-TEST_F(TestClientInput, DISABLED_ON_ANDROID(multiple_clients_receive_motion_inside_windows))
593+TEST_F(TestClientInput, multiple_clients_receive_motion_inside_windows)
594 {
595 using namespace ::testing;
596
597@@ -646,7 +639,7 @@
598 std::vector<geom::Rectangle> const input_rectangles;
599 };
600 }
601-TEST_F(TestClientInput, DISABLED_ON_ANDROID(clients_do_not_receive_motion_outside_input_region))
602+TEST_F(TestClientInput, clients_do_not_receive_motion_outside_input_region)
603 {
604 using namespace ::testing;
605 static std::string const test_client_name = "1";
606@@ -735,7 +728,7 @@
607 launch_client_process(client_config);
608 }
609
610-TEST_F(TestClientInput, DISABLED_ON_ANDROID(surfaces_obscure_motion_events_by_stacking))
611+TEST_F(TestClientInput, surfaces_obscure_motion_events_by_stacking)
612 {
613 using namespace ::testing;
614
615@@ -853,7 +846,7 @@
616
617 }
618
619-TEST_F(TestClientInput, DISABLED_ON_ANDROID(hidden_clients_do_not_receive_pointer_events))
620+TEST_F(TestClientInput, hidden_clients_do_not_receive_pointer_events)
621 {
622 using namespace ::testing;
623
624
625=== modified file 'tests/acceptance-tests/test_client_library.cpp'
626--- tests/acceptance-tests/test_client_library.cpp 2013-09-24 11:07:53 +0000
627+++ tests/acceptance-tests/test_client_library.cpp 2013-09-27 16:15:22 +0000
628@@ -42,13 +42,6 @@
629 namespace mcl = mir::client;
630 namespace mtf = mir_test_framework;
631
632-// TODO resolve problems running tests on android
633-#ifdef ANDROID
634-#define DISABLED_ON_ANDROID(name) DISABLED_##name
635-#else
636-#define DISABLED_ON_ANDROID(name) name
637-#endif
638-
639 namespace
640 {
641 char const* const mir_test_socket = mtf::test_socket_file().c_str();
642@@ -157,7 +150,7 @@
643 launch_client_process(client_config);
644 }
645
646-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_library_creates_surface))
647+TEST_F(DefaultDisplayServerTestFixture, client_library_creates_surface)
648 {
649 struct ClientConfig : ClientConfigCommon
650 {
651@@ -220,7 +213,7 @@
652 launch_client_process(client_config);
653 }
654
655-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(surface_types))
656+TEST_F(DefaultDisplayServerTestFixture, surface_types)
657 {
658 struct ClientConfig : ClientConfigCommon
659 {
660@@ -295,7 +288,7 @@
661 launch_client_process(client_config);
662 }
663
664-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_can_set_surface_state))
665+TEST_F(DefaultDisplayServerTestFixture, client_can_set_surface_state)
666 {
667 struct ClientConfig : ClientConfigCommon
668 {
669@@ -363,7 +356,7 @@
670 launch_client_process(client_config);
671 }
672
673-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_receives_surface_state_events))
674+TEST_F(DefaultDisplayServerTestFixture, client_receives_surface_state_events)
675 {
676 struct ClientConfig : ClientConfigCommon
677 {
678@@ -528,13 +521,19 @@
679
680 mir_connection_release(connection);
681 }
682+
683+ // this test relies on gbm drivers, use real graphics always
684+ bool use_real_graphics(mir::options::Option const&) override
685+ {
686+ return true;
687+ }
688 } client_config;
689
690 launch_client_process(client_config);
691 }
692 #endif
693
694-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_library_creates_multiple_surfaces))
695+TEST_F(DefaultDisplayServerTestFixture, client_library_creates_multiple_surfaces)
696 {
697 int const n_surfaces = 13;
698
699@@ -612,7 +611,7 @@
700 launch_client_process(client_config);
701 }
702
703-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(client_library_accesses_and_advances_buffers))
704+TEST_F(DefaultDisplayServerTestFixture, client_library_accesses_and_advances_buffers)
705 {
706 struct ClientConfig : ClientConfigCommon
707 {
708@@ -652,7 +651,7 @@
709 launch_client_process(client_config);
710 }
711
712-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(fully_synchronous_client))
713+TEST_F(DefaultDisplayServerTestFixture, fully_synchronous_client)
714 {
715 struct ClientConfig : ClientConfigCommon
716 {
717@@ -694,7 +693,7 @@
718 launch_client_process(client_config);
719 }
720
721-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(highly_threaded_client))
722+TEST_F(DefaultDisplayServerTestFixture, highly_threaded_client)
723 {
724 struct ClientConfig : ClientConfigCommon
725 {
726@@ -838,6 +837,13 @@
727 FAIL() << error;
728 }
729 }
730+
731+ //we are testing the connect function itself, without getting to the
732+ // point where drivers are used, so force using production config
733+ bool use_real_graphics(mir::options::Option const&) override
734+ {
735+ return true;
736+ }
737 } client_config;
738
739 launch_client_process(client_config);
740@@ -867,6 +873,13 @@
741
742 mir_connection_release(connection);
743 }
744+
745+ //we are testing the connect function itself, without getting to the
746+ // point where drivers are used, so force using production config
747+ bool use_real_graphics(mir::options::Option const&) override
748+ {
749+ return true;
750+ }
751 } client_config;
752
753 launch_client_process(client_config);
754@@ -878,7 +891,7 @@
755 signalled = true;
756 }
757
758-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(ClientLibraryThreadsHandleNoSignals))
759+TEST_F(DefaultDisplayServerTestFixture, ClientLibraryThreadsHandleNoSignals)
760 {
761 struct ClientConfig : ClientConfigCommon
762 {
763@@ -961,7 +974,7 @@
764 launch_client_process(client_config);
765 }
766
767-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(MultiSurfaceClientTracksBufferFdsCorrectly))
768+TEST_F(DefaultDisplayServerTestFixture, MultiSurfaceClientTracksBufferFdsCorrectly)
769 {
770 struct ClientConfig : ClientConfigCommon
771 {
772
773=== modified file 'tests/acceptance-tests/test_focus_selection.cpp'
774--- tests/acceptance-tests/test_focus_selection.cpp 2013-09-17 14:31:42 +0000
775+++ tests/acceptance-tests/test_focus_selection.cpp 2013-09-27 16:15:22 +0000
776@@ -41,13 +41,6 @@
777 namespace mt = mir::test;
778 namespace mtf = mir_test_framework;
779
780-// TODO resolve problems running tests on android
781-#ifdef ANDROID
782-#define DISABLED_ON_ANDROID(name) DISABLED_##name
783-#else
784-#define DISABLED_ON_ANDROID(name) name
785-#endif
786-
787 namespace
788 {
789 char const* const mir_test_socket = mtf::test_socket_file().c_str();
790@@ -134,7 +127,7 @@
791 }
792 }
793
794-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(sessions_creating_surface_receive_focus))
795+TEST_F(BespokeDisplayServerTestFixture, sessions_creating_surface_receive_focus)
796 {
797 struct ServerConfig : TestingServerConfiguration
798 {
799@@ -168,7 +161,7 @@
800 launch_client_process(client);
801 }
802
803-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(surfaces_receive_input_focus_when_created))
804+TEST_F(BespokeDisplayServerTestFixture, surfaces_receive_input_focus_when_created)
805 {
806 struct ServerConfig : TestingServerConfiguration
807 {
808
809=== modified file 'tests/acceptance-tests/test_server_shutdown.cpp'
810--- tests/acceptance-tests/test_server_shutdown.cpp 2013-09-24 11:43:27 +0000
811+++ tests/acceptance-tests/test_server_shutdown.cpp 2013-09-27 16:15:22 +0000
812@@ -39,13 +39,6 @@
813 namespace ms = mir::surfaces;
814 namespace geom = mir::geometry;
815
816-// TODO resolve problems running tests on android
817-#ifdef ANDROID
818-#define DISABLED_ON_ANDROID(name) DISABLED_##name
819-#else
820-#define DISABLED_ON_ANDROID(name) name
821-#endif
822-
823 namespace
824 {
825
826@@ -119,7 +112,7 @@
827
828 }
829
830-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(server_can_shut_down_when_clients_are_blocked))
831+TEST_F(BespokeDisplayServerTestFixture, server_can_shut_down_when_clients_are_blocked)
832 {
833 Flag next_buffer_done1{"next_buffer_done1_c5d49978.tmp"};
834 Flag next_buffer_done2{"next_buffer_done2_c5d49978.tmp"};
835@@ -206,7 +199,7 @@
836 });
837 }
838
839-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(server_releases_resources_on_shutdown_with_connected_clients))
840+TEST_F(BespokeDisplayServerTestFixture, server_releases_resources_on_shutdown_with_connected_clients)
841 {
842 Flag surface_created1{"surface_created1_7e9c69fc.tmp"};
843 Flag surface_created2{"surface_created2_7e9c69fc.tmp"};
844
845=== modified file 'tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp'
846--- tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2013-09-17 14:31:42 +0000
847+++ tests/acceptance-tests/test_shell_control_of_surface_configuration.cpp 2013-09-27 16:15:22 +0000
848@@ -34,13 +34,6 @@
849 namespace mtd = mt::doubles;
850 namespace mtf = mir_test_framework;
851
852-// TODO resolve problems running tests on android
853-#ifdef ANDROID
854-#define DISABLED_ON_ANDROID(name) DISABLED_##name
855-#else
856-#define DISABLED_ON_ANDROID(name) name
857-#endif
858-
859 namespace
860 {
861 char const* const mir_test_socket = mtf::test_socket_file().c_str();
862@@ -77,7 +70,7 @@
863
864 }
865
866-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(the_shell_surface_configurator_is_notified_of_attribute_changes))
867+TEST_F(BespokeDisplayServerTestFixture, the_shell_surface_configurator_is_notified_of_attribute_changes)
868 {
869 struct ServerConfiguration : TestingServerConfiguration
870 {
871@@ -116,7 +109,7 @@
872 launch_client_process(client_config);
873 }
874
875-TEST_F(BespokeDisplayServerTestFixture, DISABLED_ON_ANDROID(the_shell_surface_configurator_may_interfere_with_attribute_changes))
876+TEST_F(BespokeDisplayServerTestFixture, the_shell_surface_configurator_may_interfere_with_attribute_changes)
877 {
878 struct ServerConfiguration : TestingServerConfiguration
879 {
880
881=== modified file 'tests/acceptance-tests/test_surfaceloop.cpp'
882--- tests/acceptance-tests/test_surfaceloop.cpp 2013-09-17 14:31:42 +0000
883+++ tests/acceptance-tests/test_surfaceloop.cpp 2013-09-27 16:15:22 +0000
884@@ -36,13 +36,6 @@
885 namespace mcl = mir::client;
886 namespace mtf = mir_test_framework;
887
888-// TODO resolve problems running tests on android
889-#ifdef ANDROID
890-#define DISABLED_ON_ANDROID(name) DISABLED_##name
891-#else
892-#define DISABLED_ON_ANDROID(name) name
893-#endif
894-
895 namespace
896 {
897 char const* const mir_test_socket = mtf::test_socket_file().c_str();
898@@ -161,7 +154,7 @@
899 }
900 }
901
902-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(creates_surface_of_correct_size))
903+TEST_F(DefaultDisplayServerTestFixture, creates_surface_of_correct_size)
904 {
905 struct Client : ClientConfigCommon
906 {
907@@ -215,7 +208,7 @@
908 launch_client_process(client_creates_surfaces);
909 }
910
911-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(surfaces_have_distinct_ids))
912+TEST_F(DefaultDisplayServerTestFixture, surfaces_have_distinct_ids)
913 {
914 struct Client : ClientConfigCommon
915 {
916@@ -260,7 +253,7 @@
917 launch_client_process(client_creates_surfaces);
918 }
919
920-TEST_F(DefaultDisplayServerTestFixture, DISABLED_ON_ANDROID(creates_multiple_surfaces_async))
921+TEST_F(DefaultDisplayServerTestFixture, creates_multiple_surfaces_async)
922 {
923 struct Client : ClientConfigCommon
924 {
925
926=== modified file 'tests/acceptance-tests/test_surfaces_with_output_id.cpp'
927--- tests/acceptance-tests/test_surfaces_with_output_id.cpp 2013-09-17 14:31:42 +0000
928+++ tests/acceptance-tests/test_surfaces_with_output_id.cpp 2013-09-27 16:15:22 +0000
929@@ -43,13 +43,6 @@
930 namespace mg = mir::graphics;
931 namespace mtd = mir::test::doubles;
932
933-// TODO resolve problems running tests on android
934-#ifdef ANDROID
935-#define DISABLED_ON_ANDROID(name) DISABLED_##name
936-#else
937-#define DISABLED_ON_ANDROID(name) name
938-#endif
939-
940 namespace
941 {
942 char const* const mir_test_socket = mtf::test_socket_file().c_str();
943@@ -128,7 +121,7 @@
944
945 using SurfacesWithOutputId = BespokeDisplayServerTestFixture;
946
947-TEST_F(SurfacesWithOutputId, DISABLED_ON_ANDROID(fullscreen_surfaces_are_placed_at_top_left_of_correct_output))
948+TEST_F(SurfacesWithOutputId, fullscreen_surfaces_are_placed_at_top_left_of_correct_output)
949 {
950 mt::CrossProcessAction client_connect_and_create_surface;
951 mt::CrossProcessAction client_release_surface_and_disconnect;
952@@ -266,7 +259,7 @@
953 });
954 }
955
956-TEST_F(SurfacesWithOutputId, DISABLED_ON_ANDROID(non_fullscreen_surfaces_are_not_accepted))
957+TEST_F(SurfacesWithOutputId, non_fullscreen_surfaces_are_not_accepted)
958 {
959 mt::CrossProcessAction client_connect_and_create_surfaces;
960 mt::CrossProcessAction client_disconnect;
961
962=== modified file 'tests/mir_test_framework/CMakeLists.txt'
963--- tests/mir_test_framework/CMakeLists.txt 2013-08-28 03:41:48 +0000
964+++ tests/mir_test_framework/CMakeLists.txt 2013-09-27 16:15:22 +0000
965@@ -13,6 +13,7 @@
966 testing_server_options.cpp
967 input_testing_server_options.cpp
968 testing_process_manager.cpp
969+ testing_client_options.cpp
970 display_server_test_fixture.cpp
971 process.cpp
972 )
973
974=== modified file 'tests/mir_test_framework/display_server_test_fixture.cpp'
975--- tests/mir_test_framework/display_server_test_fixture.cpp 2013-08-28 03:41:48 +0000
976+++ tests/mir_test_framework/display_server_test_fixture.cpp 2013-09-27 16:15:22 +0000
977@@ -17,20 +17,22 @@
978 */
979
980 #include "mir_test_framework/display_server_test_fixture.h"
981+#include "mir_test_framework/testing_client_configuration.h"
982+#include "src/client/mir_connection.h"
983
984 namespace mc = mir::compositor;
985-
986-mir_test_framework::TestingProcessManager mir_test_framework::DefaultDisplayServerTestFixture::process_manager;
987-
988+namespace mtf = mir_test_framework;
989+
990+mtf::TestingProcessManager mir_test_framework::DefaultDisplayServerTestFixture::process_manager;
991+mtf::TestingServerConfiguration mir_test_framework::DefaultDisplayServerTestFixture::default_parameters;
992
993 void DefaultDisplayServerTestFixture::launch_client_process(TestingClientConfiguration& config)
994 {
995- process_manager.launch_client_process(config);
996+ process_manager.launch_client_process(config, *default_parameters.the_options());
997 }
998
999 void DefaultDisplayServerTestFixture::SetUpTestCase()
1000 {
1001- TestingServerConfiguration default_parameters;
1002 process_manager.launch_server_process(default_parameters);
1003 }
1004
1005@@ -54,12 +56,13 @@
1006
1007 void BespokeDisplayServerTestFixture::launch_server_process(TestingServerConfiguration& functor)
1008 {
1009+ test_options = functor.the_options();
1010 process_manager.launch_server_process(functor);
1011 }
1012
1013 void BespokeDisplayServerTestFixture::launch_client_process(TestingClientConfiguration& config)
1014 {
1015- process_manager.launch_client_process(config);
1016+ process_manager.launch_client_process(config, *test_options);
1017 }
1018
1019 bool BespokeDisplayServerTestFixture::shutdown_server_process()
1020
1021=== added file 'tests/mir_test_framework/testing_client_options.cpp'
1022--- tests/mir_test_framework/testing_client_options.cpp 1970-01-01 00:00:00 +0000
1023+++ tests/mir_test_framework/testing_client_options.cpp 2013-09-27 16:15:22 +0000
1024@@ -0,0 +1,126 @@
1025+/*
1026+ * Copyright © 2013 Canonical Ltd.
1027+ *
1028+ * This program is free software: you can redistribute it and/or modify it
1029+ * under the terms of the GNU General Public License version 3,
1030+ * as published by the Free Software Foundation.
1031+ *
1032+ * This program is distributed in the hope that it will be useful,
1033+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1034+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1035+ * GNU General Public License for more details.
1036+ *
1037+ * You should have received a copy of the GNU General Public License
1038+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1039+ *
1040+ * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
1041+ */
1042+
1043+#include "mir_test_framework/testing_client_configuration.h"
1044+#include "mir_test_framework/stub_client_connection_configuration.h"
1045+#include "mir/options/program_option.h"
1046+#include "src/client/default_connection_configuration.h"
1047+#include "src/client/client_platform_factory.h"
1048+#include "src/client/client_buffer_factory.h"
1049+#include "src/client/client_buffer.h"
1050+#include "src/client/client_platform.h"
1051+#include "src/client/mir_connection.h"
1052+
1053+namespace mcl = mir::client;
1054+namespace mtf=mir_test_framework;
1055+namespace geom = mir::geometry;
1056+
1057+
1058+namespace
1059+{
1060+class StubClientBuffer : public mcl::ClientBuffer
1061+{
1062+ std::shared_ptr<mcl::MemoryRegion> secure_for_cpu_write()
1063+ {
1064+ return nullptr;
1065+ }
1066+
1067+ geom::Size size() const
1068+ {
1069+ return geom::Size{};
1070+ }
1071+
1072+ geom::Stride stride() const
1073+ {
1074+ return geom::Stride{};
1075+ }
1076+
1077+ geom::PixelFormat pixel_format() const
1078+ {
1079+ return geom::PixelFormat::abgr_8888;
1080+ }
1081+
1082+ uint32_t age() const
1083+ {
1084+ return 0;
1085+ }
1086+ void increment_age()
1087+ {
1088+ }
1089+ void mark_as_submitted()
1090+ {
1091+ }
1092+ std::shared_ptr<MirNativeBuffer> native_buffer_handle() const
1093+ {
1094+ return nullptr;
1095+ }
1096+};
1097+
1098+struct StubClientBufferFactory : public mcl::ClientBufferFactory
1099+{
1100+ std::shared_ptr<mcl::ClientBuffer> create_buffer(std::shared_ptr<MirBufferPackage> const&,
1101+ geom::Size, geom::PixelFormat)
1102+ {
1103+ return std::make_shared<StubClientBuffer>();
1104+ }
1105+};
1106+
1107+struct StubClientPlatform : public mcl::ClientPlatform
1108+{
1109+ MirPlatformType platform_type() const
1110+ {
1111+ return mir_platform_type_gbm;
1112+ }
1113+
1114+ std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
1115+ {
1116+ return std::make_shared<StubClientBufferFactory>();
1117+ }
1118+
1119+ std::shared_ptr<EGLNativeWindowType> create_egl_native_window(mcl::ClientSurface*)
1120+ {
1121+ auto fake_window = reinterpret_cast<EGLNativeWindowType>(0x12345678);
1122+ return std::make_shared<EGLNativeWindowType>(fake_window);
1123+ }
1124+
1125+ std::shared_ptr<EGLNativeDisplayType> create_egl_native_display()
1126+ {
1127+ auto fake_display = reinterpret_cast<EGLNativeDisplayType>(0x12345678);
1128+ return std::make_shared<EGLNativeDisplayType>(fake_display);
1129+ }
1130+};
1131+
1132+struct StubClientPlatformFactory : public mcl::ClientPlatformFactory
1133+{
1134+ std::shared_ptr<mcl::ClientPlatform> create_client_platform(mcl::ClientContext*)
1135+ {
1136+ return std::make_shared<StubClientPlatform>();
1137+ }
1138+};
1139+
1140+}
1141+
1142+mtf::StubConnectionConfiguration::StubConnectionConfiguration(std::string const& socket_file)
1143+ : DefaultConnectionConfiguration(socket_file)
1144+{
1145+}
1146+
1147+std::shared_ptr<mcl::ClientPlatformFactory> mtf::StubConnectionConfiguration::the_client_platform_factory()
1148+{
1149+ return std::make_shared<StubClientPlatformFactory>();
1150+}
1151
1152=== modified file 'tests/mir_test_framework/testing_process_manager.cpp'
1153--- tests/mir_test_framework/testing_process_manager.cpp 2013-09-19 18:18:35 +0000
1154+++ tests/mir_test_framework/testing_process_manager.cpp 2013-09-27 16:15:22 +0000
1155@@ -16,8 +16,11 @@
1156 * Authored by: Alan Griffiths <alan@octopull.co.uk>
1157 */
1158
1159+#include "mir_toolkit/client_types.h"
1160 #include "mir_test_framework/testing_process_manager.h"
1161 #include "mir_test_framework/detect_server.h"
1162+#include "mir_test_framework/stub_client_connection_configuration.h"
1163+#include "src/client/mir_connection.h"
1164 #include "mir/run_mir.h"
1165
1166 #include <gmock/gmock.h>
1167@@ -25,6 +28,7 @@
1168 #include <thread>
1169 #include <stdexcept>
1170
1171+namespace mo = mir::options;
1172 namespace mc = mir::compositor;
1173 namespace mtf = mir_test_framework;
1174
1175@@ -76,7 +80,38 @@
1176 }
1177 }
1178
1179-void mtf::TestingProcessManager::launch_client_process(TestingClientConfiguration& config)
1180+/* if set before any calls to the api functions, assigning to this pointer will allow user to
1181+ * override calls to mir_connect() and mir_connection_release(). This is mostly useful in test scenarios
1182+ */
1183+extern MirWaitHandle* (*mir_connect_impl)(
1184+ char const *server,
1185+ char const *app_name,
1186+ mir_connected_callback callback,
1187+ void *context);
1188+extern void (*mir_connection_release_impl) (MirConnection *connection);
1189+
1190+namespace
1191+{
1192+MirWaitHandle* mir_connect_test_override(
1193+ char const *socket_file,
1194+ char const *app_name,
1195+ mir_connected_callback callback,
1196+ void *context)
1197+{
1198+ mtf::StubConnectionConfiguration conf(socket_file);
1199+ auto connection = new MirConnection(conf);
1200+ return connection->connect(app_name, callback, context);
1201+}
1202+
1203+void mir_connection_release_override(MirConnection *connection)
1204+{
1205+ auto wait_handle = connection->disconnect();
1206+ wait_handle->wait_for_all();
1207+ delete connection;
1208+}
1209+}
1210+
1211+void mtf::TestingProcessManager::launch_client_process(TestingClientConfiguration& config, mo::Option const& test_options)
1212 {
1213 if (!is_test_process)
1214 {
1215@@ -108,6 +143,11 @@
1216 server_process.reset();
1217
1218 SCOPED_TRACE("Client");
1219+ if (!config.use_real_graphics(test_options))
1220+ {
1221+ mir_connect_impl = mir_connect_test_override;
1222+ mir_connection_release_impl = mir_connection_release_override;
1223+ }
1224 config.exec();
1225 exit(::testing::Test::HasFailure() ? EXIT_FAILURE : EXIT_SUCCESS);
1226 }
1227
1228=== modified file 'tests/unit-tests/graphics/android/test_hwc_device.cpp'
1229--- tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-09-25 15:46:05 +0000
1230+++ tests/unit-tests/graphics/android/test_hwc_device.cpp 2013-09-27 16:15:22 +0000
1231@@ -184,9 +184,12 @@
1232 EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
1233 .Times(1)
1234 .WillOnce(Return(0));
1235- EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
1236+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
1237 .Times(1)
1238 .WillOnce(Return(-1));
1239+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
1240+ .Times(1)
1241+ .WillOnce(Return(0));
1242
1243 auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_layer_list,
1244 this->mock_fbdev, this->mock_vsync);
1245@@ -195,6 +198,27 @@
1246 }, std::runtime_error);
1247 }
1248
1249+TYPED_TEST(HWCCommon, test_blank_is_ignored_if_already_in_correct_state)
1250+{
1251+ using namespace testing;
1252+
1253+ //we start off unblanked
1254+
1255+ InSequence seq;
1256+ //from constructor
1257+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
1258+ .Times(Exactly(1))
1259+ .WillOnce(Return(0));
1260+ //from destructor
1261+ EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
1262+ .Times(1)
1263+ .WillOnce(Return(0));
1264+
1265+ auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_layer_list,
1266+ this->mock_fbdev, this->mock_vsync);
1267+ device->blank_or_unblank_screen(false);
1268+}
1269+
1270 TYPED_TEST(HWCCommon, test_hwc_display_is_deactivated_on_destroy)
1271 {
1272 auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_layer_list,
1273
1274=== modified file 'tests/unit-tests/logging/test_legacy_input_report.cpp'
1275--- tests/unit-tests/logging/test_legacy_input_report.cpp 2013-05-28 17:55:26 +0000
1276+++ tests/unit-tests/logging/test_legacy_input_report.cpp 2013-09-27 16:15:22 +0000
1277@@ -29,6 +29,8 @@
1278 namespace ml = mir::logging;
1279 namespace mli = mir::logging::legacy_input_report;
1280
1281+using testing::_;
1282+
1283 namespace
1284 {
1285 class MockLogger : public ml::Logger
1286@@ -49,69 +51,64 @@
1287 };
1288
1289 char const* const component = "android-input";
1290-char const* const LOG_TAG = 0;
1291+char const* const LOG_TAG = "Foo";
1292 }
1293
1294 TEST_F(InputReport, debug_message)
1295 {
1296- EXPECT_CALL(logger, log(
1297- ml::Logger::debug,
1298- testing::HasSubstr(__PRETTY_FUNCTION__),
1299- component));
1300+ // default minimum log priority is "informational". "debug" is lower than that.
1301+ EXPECT_CALL(logger, log(_, _, _)).Times(0);
1302
1303- ALOG(LOG_DEBUG, NULL, "Test function is %s", __PRETTY_FUNCTION__);
1304+ ALOG(LOG_DEBUG, NULL, "Test function is %s", __PRETTY_FUNCTION__);
1305 }
1306
1307 TEST_F(InputReport, unknown_message)
1308 {
1309 char const* const unknown = "Unknown message";
1310
1311- EXPECT_CALL(logger, log(
1312- ml::Logger::debug,
1313- unknown,
1314- component));
1315+ // default minimum log priority is "informational". "unknown" is lower than that.
1316+ // Actually, I don't think this is even a valid priority.
1317+ EXPECT_CALL(logger, log(_, _, _)).Times(0);
1318
1319- ALOG(LOG_UNKNOWN, NULL, unknown);
1320+ ALOG(LOG_UNKNOWN, NULL, unknown);
1321 }
1322
1323 TEST_F(InputReport, verbose_message)
1324 {
1325 char const* const verbose = "A very long story. (OK, I lied.)";
1326
1327- EXPECT_CALL(logger, log(
1328- ml::Logger::debug,
1329- verbose,
1330- component));
1331+ // default minimum log priority is "informational". "verbose" is lower than that.
1332+ EXPECT_CALL(logger, log(_, _, _)).Times(0);
1333
1334- ALOG(LOG_VERBOSE, NULL, verbose);
1335+ ALOG(LOG_VERBOSE, NULL, verbose);
1336 }
1337
1338 TEST_F(InputReport, info_message)
1339 {
1340 EXPECT_CALL(logger, log(
1341 ml::Logger::informational,
1342- __PRETTY_FUNCTION__,
1343+ "[Foo]Some informational message",
1344 component));
1345
1346- ALOGI(__PRETTY_FUNCTION__);
1347+ ALOGI("Some informational message");
1348 }
1349
1350 TEST_F(InputReport, warning_message)
1351 {
1352 EXPECT_CALL(logger, log(
1353 ml::Logger::warning,
1354- __PRETTY_FUNCTION__,
1355+ "[Foo]Warning!!!",
1356 component));
1357
1358- ALOGW(__PRETTY_FUNCTION__);
1359+ ALOGW("Warning!!!");
1360 }
1361
1362 TEST_F(InputReport, error_message)
1363 {
1364 EXPECT_CALL(logger, log(
1365 ml::Logger::error,
1366- __PRETTY_FUNCTION__,
1367+ "[Foo]An error occurred!",
1368 component));
1369
1370- ALOGE(__PRETTY_FUNCTION__);
1371+ ALOGE("An error occurred!");
1372 }

Subscribers

People subscribed via source and target branches