Mir

Merge lp:~alan-griffiths/mir/fix-1271604 into lp:mir

Proposed by Alan Griffiths on 2014-01-22
Status: Merged
Approved by: Daniel van Vugt on 2014-01-23
Approved revision: 1346
Merged at revision: 1349
Proposed branch: lp:~alan-griffiths/mir/fix-1271604
Merge into: lp:mir
Prerequisite: lp:~alan-griffiths/mir/fix-1271655
Diff against target: 50 lines (+15/-0)
2 files modified
include/test/mir_test_framework/in_process_server.h (+2/-0)
tests/mir_test_framework/in_process_server.cpp (+13/-0)
To merge this branch: bzr merge lp:~alan-griffiths/mir/fix-1271604
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve on 2014-01-23
Kevin DuBois (community) Approve on 2014-01-23
Andreas Pokorny (community) 2014-01-22 Approve on 2014-01-22
PS Jenkins bot (community) continuous-integration Approve on 2014-01-22
Review via email: mp+202722@code.launchpad.net

Commit message

tests: Override configuration to avoid creating an (unused) filesystem endpoint for connections when using InProcessServer

Description of the change

tests: Override configuration to avoid creating an (unused) filesystem endpoint for connections when using InProcessServer

To post a comment you must log in.
Andreas Pokorny (andreas-pokorny) wrote :

lgtm

review: Approve
Kevin DuBois (kdub) :
review: Approve
Daniel van Vugt (vanvugt) wrote :

Looks good.

BTW, a simpler way to write:
   char const* const env_no_file =
is:
   char const env_no_file[] =

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/test/mir_test_framework/in_process_server.h'
2--- include/test/mir_test_framework/in_process_server.h 2013-12-13 15:11:19 +0000
3+++ include/test/mir_test_framework/in_process_server.h 2014-01-22 18:03:28 +0000
4@@ -36,6 +36,7 @@
5 /// Fixture for running Mir server in test process
6 struct InProcessServer : testing::Test
7 {
8+ InProcessServer();
9 ~InProcessServer();
10
11 /// Starts the server
12@@ -53,6 +54,7 @@
13 mir::DisplayServer* start_mir_server();
14 virtual mir::DefaultServerConfiguration& server_config() = 0;
15
16+ char const* const old_env;
17 std::thread server_thread;
18 mir::DisplayServer* display_server = 0;
19 };
20
21=== modified file 'tests/mir_test_framework/in_process_server.cpp'
22--- tests/mir_test_framework/in_process_server.cpp 2013-12-17 10:05:06 +0000
23+++ tests/mir_test_framework/in_process_server.cpp 2014-01-22 18:03:28 +0000
24@@ -30,6 +30,17 @@
25
26 namespace mtf = mir_test_framework;
27
28+namespace
29+{
30+char const* const env_no_file = "MIR_SERVER_NO_FILE";
31+}
32+
33+mtf::InProcessServer::InProcessServer() :
34+ old_env(getenv(env_no_file))
35+{
36+ if (!old_env) setenv(env_no_file, "", true);
37+}
38+
39 void mtf::InProcessServer::SetUp()
40 {
41 display_server = start_mir_server();
42@@ -53,6 +64,8 @@
43 mtf::InProcessServer::~InProcessServer()
44 {
45 if (server_thread.joinable()) server_thread.join();
46+
47+ if (!old_env) unsetenv(env_no_file);
48 }
49
50 mir::DisplayServer* mtf::InProcessServer::start_mir_server()

Subscribers

People subscribed via source and target branches