Merge lp:~michihenning/unity-scopes-api/add-version-to-create-function-name into lp:unity-scopes-api/devel

Proposed by Michi Henning
Status: Superseded
Proposed branch: lp:~michihenning/unity-scopes-api/add-version-to-create-function-name
Merge into: lp:unity-scopes-api/devel
Diff against target: 797 lines (+51/-215)
42 files modified
demo/click/scope-click/scope-click.cpp (+1/-4)
demo/scopes/scope-A/CMakeLists.txt (+2/-1)
demo/scopes/scope-A/scope-A.cpp (+1/-2)
demo/scopes/scope-A/scope-A.map.in (+1/-1)
demo/scopes/scope-B/scope-B.cpp (+1/-3)
demo/scopes/scope-C/scope-C.cpp (+1/-2)
demo/scopes/scope-D/scope-D.cpp (+1/-2)
demo/scopes/scope-N/scope-N.cpp (+1/-2)
demo/scopes/scope-S/scope-S.cpp (+1/-2)
include/unity/scopes/CMakeLists.txt (+3/-0)
include/unity/scopes/ScopeBase.h.in (+6/-13)
include/unity/scopes/testing/TypedScopeFixture.h (+1/-2)
src/scopes/internal/ScopeLoader.cpp (+1/-17)
test/gtest/scopes/Activation/TestScope.h (+1/-4)
test/gtest/scopes/Filters/TestScope.h (+1/-5)
test/gtest/scopes/IdleShutdown/SlowSearchScope.cpp (+1/-2)
test/gtest/scopes/IdleShutdown/SlowSearchScope.h (+1/-1)
test/gtest/scopes/Invocation/EmptyScope.cpp (+1/-2)
test/gtest/scopes/Invocation/EmptyScope.h (+1/-1)
test/gtest/scopes/Invocation/TestScope.cpp (+1/-2)
test/gtest/scopes/Invocation/TestScope.h (+1/-1)
test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.cpp (+1/-4)
test/gtest/scopes/Registry/scopes/testscopeB/testscopeB.cpp (+1/-4)
test/gtest/scopes/Runtime/PusherScope.cpp (+1/-2)
test/gtest/scopes/Runtime/PusherScope.h (+1/-1)
test/gtest/scopes/Runtime/SlowCreateScope.cpp (+1/-2)
test/gtest/scopes/Runtime/SlowCreateScope.h (+1/-1)
test/gtest/scopes/Runtime/TestScope.cpp (+1/-2)
test/gtest/scopes/Runtime/TestScope.h (+1/-1)
test/gtest/scopes/ScopeBase/scopelib.cpp (+1/-5)
test/gtest/scopes/internal/ScopeLoader/BadVersion.cpp (+0/-81)
test/gtest/scopes/internal/ScopeLoader/CMakeLists.txt (+0/-1)
test/gtest/scopes/internal/ScopeLoader/MyScope.h (+1/-2)
test/gtest/scopes/internal/ScopeLoader/ScopeA.cpp (+1/-2)
test/gtest/scopes/internal/ScopeLoader/ScopeB.cpp (+1/-2)
test/gtest/scopes/internal/ScopeLoader/ScopeLoader_test.cpp (+4/-28)
test/gtest/scopes/internal/ScopeLoader/ThrowUnityExFromStart.cpp (+1/-1)
test/gtest/scopes/internal/ScopeLoader/ThrowUnknownExFromStart.cpp (+1/-1)
test/gtest/scopes/testing/IsolatedScope/scope.cpp (+1/-2)
test/gtest/scopes/testing/IsolatedScope/scope.h (+1/-1)
test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.cpp (+1/-2)
test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.h (+1/-1)
To merge this branch: bzr merge lp:~michihenning/unity-scopes-api/add-version-to-create-function-name
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Unity Team Pending
Review via email: mp+223327@code.launchpad.net

This proposal has been superseded by a proposal from 2014-06-17.

Commit message

Added the major version number to the name of the create function, so we have a version indication in the symbol table of a scope, instead of having to load the scope and calling its start() method.

Description of the change

Added the major version number to the name of the create function, so we have a version indication in the symbol table of a scope, instead of having to load the scope and calling its start() method.

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote :

166 +#define UNITY_SCOPE_CREATE_FUNCTION unity_scope_create_v@UNITY_SCOPES_MAJOR@

The library SOVERSION should be used here, not the MAJOR version, can you add the SOVERSION definition to Version.h, and just use a ## macro here? The fewer generated headers the better.

Otherwise looking fine...

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

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'demo/click/scope-click/scope-click.cpp'
2--- demo/click/scope-click/scope-click.cpp 2014-06-12 11:24:03 +0000
3+++ demo/click/scope-click/scope-click.cpp 2014-06-17 09:28:35 +0000
4@@ -56,10 +56,7 @@
5 class MyScope : public ScopeBase
6 {
7 public:
8- virtual int start(string const&, RegistryProxy const&) override
9- {
10- return VERSION;
11- }
12+ virtual void start(string const&, RegistryProxy const&) override {}
13
14 virtual void stop() override {}
15
16
17=== modified file 'demo/scopes/scope-A/CMakeLists.txt'
18--- demo/scopes/scope-A/CMakeLists.txt 2014-03-07 14:21:49 +0000
19+++ demo/scopes/scope-A/CMakeLists.txt 2014-06-17 09:28:35 +0000
20@@ -1,4 +1,5 @@
21-set(symbol_map "${CMAKE_CURRENT_SOURCE_DIR}/scope-A.map")
22+configure_file(scope-A.map.in scope-A.map)
23+set(symbol_map "${CMAKE_CURRENT_BINARY_DIR}/scope-A.map")
24
25 add_library(scope-A MODULE scope-A.cpp)
26 # Add_dependencies should be used sparingly. In this case we need the global
27
28=== modified file 'demo/scopes/scope-A/scope-A.cpp'
29--- demo/scopes/scope-A/scope-A.cpp 2014-06-12 16:16:01 +0000
30+++ demo/scopes/scope-A/scope-A.cpp 2014-06-17 09:28:35 +0000
31@@ -160,10 +160,9 @@
32 class MyScope : public ScopeBase
33 {
34 public:
35- virtual int start(string const& scope_id, RegistryProxy const&) override
36+ virtual void start(string const& scope_id, RegistryProxy const&) override
37 {
38 scope_id_ = scope_id;
39- return VERSION;
40 }
41
42 virtual void stop() override {}
43
44=== renamed file 'demo/scopes/scope-A/scope-A.map' => 'demo/scopes/scope-A/scope-A.map.in'
45--- demo/scopes/scope-A/scope-A.map 2014-03-07 14:21:49 +0000
46+++ demo/scopes/scope-A/scope-A.map.in 2014-06-17 09:28:35 +0000
47@@ -1,6 +1,6 @@
48 {
49 global:
50- "unity_scope_create";
51+ "unity_scope_create_v@UNITY_SCOPES_MAJOR@";
52 "unity_scope_destroy";
53 local:
54 extern "C++" {
55
56=== modified file 'demo/scopes/scope-B/scope-B.cpp'
57--- demo/scopes/scope-B/scope-B.cpp 2014-06-12 11:24:03 +0000
58+++ demo/scopes/scope-B/scope-B.cpp 2014-06-17 09:28:35 +0000
59@@ -140,7 +140,7 @@
60 class MyScope : public ScopeBase
61 {
62 public:
63- virtual int start(string const& scope_id, RegistryProxy const& registry) override
64+ virtual void start(string const& scope_id, RegistryProxy const& registry) override
65 {
66 scope_id_ = scope_id;
67
68@@ -153,8 +153,6 @@
69 scope_c_ = meta_c.proxy();
70 auto meta_d = registry->get_metadata("scope-D");
71 scope_d_ = meta_d.proxy();
72-
73- return VERSION;
74 }
75
76 virtual void stop() override {}
77
78=== modified file 'demo/scopes/scope-C/scope-C.cpp'
79--- demo/scopes/scope-C/scope-C.cpp 2014-06-13 10:17:24 +0000
80+++ demo/scopes/scope-C/scope-C.cpp 2014-06-17 09:28:35 +0000
81@@ -184,10 +184,9 @@
82 class MyScope : public ScopeBase
83 {
84 public:
85- virtual int start(string const& scope_id, RegistryProxy const&) override
86+ virtual void start(string const& scope_id, RegistryProxy const&) override
87 {
88 scope_id_ = scope_id;
89- return VERSION;
90 }
91
92 virtual void stop() override
93
94=== modified file 'demo/scopes/scope-D/scope-D.cpp'
95--- demo/scopes/scope-D/scope-D.cpp 2014-06-12 11:24:03 +0000
96+++ demo/scopes/scope-D/scope-D.cpp 2014-06-17 09:28:35 +0000
97@@ -183,10 +183,9 @@
98 class MyScope : public ScopeBase
99 {
100 public:
101- virtual int start(string const& scope_id, RegistryProxy const&) override
102+ virtual void start(string const& scope_id, RegistryProxy const&) override
103 {
104 scope_id_ = scope_id;
105- return VERSION;
106 }
107
108 virtual void stop() override
109
110=== modified file 'demo/scopes/scope-N/scope-N.cpp'
111--- demo/scopes/scope-N/scope-N.cpp 2014-06-12 11:24:03 +0000
112+++ demo/scopes/scope-N/scope-N.cpp 2014-06-17 09:28:35 +0000
113@@ -68,10 +68,9 @@
114 class MyScope : public ScopeBase
115 {
116 public:
117- virtual int start(string const& scope_id, RegistryProxy const&) override
118+ virtual void start(string const& scope_id, RegistryProxy const&) override
119 {
120 scope_id_ = scope_id;
121- return VERSION;
122 }
123
124 virtual void stop() override {}
125
126=== modified file 'demo/scopes/scope-S/scope-S.cpp'
127--- demo/scopes/scope-S/scope-S.cpp 2014-06-12 11:24:03 +0000
128+++ demo/scopes/scope-S/scope-S.cpp 2014-06-17 09:28:35 +0000
129@@ -85,10 +85,9 @@
130 class MyScope : public ScopeBase
131 {
132 public:
133- virtual int start(string const& scope_id, RegistryProxy const&) override
134+ virtual void start(string const& scope_id, RegistryProxy const&) override
135 {
136 scope_id_ = scope_id;
137- return VERSION;
138 }
139
140 virtual void stop() override {}
141
142=== modified file 'include/unity/scopes/CMakeLists.txt'
143--- include/unity/scopes/CMakeLists.txt 2014-03-06 10:15:39 +0000
144+++ include/unity/scopes/CMakeLists.txt 2014-06-17 09:28:35 +0000
145@@ -9,6 +9,9 @@
146 configure_file(Version.h.in Version.h)
147 set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/Version.h)
148
149+configure_file(ScopeBase.h.in ScopeBase.h)
150+set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/ScopeBase.h)
151+
152 install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/unity/scopes)
153
154 set(UNITY_SCOPES_LIB_HDRS ${UNITY_SCOPES_LIB_HDRS} ${headers} PARENT_SCOPE)
155
156=== renamed file 'include/unity/scopes/ScopeBase.h' => 'include/unity/scopes/ScopeBase.h.in'
157--- include/unity/scopes/ScopeBase.h 2014-04-03 14:22:02 +0000
158+++ include/unity/scopes/ScopeBase.h.in 2014-06-17 09:28:35 +0000
159@@ -31,7 +31,9 @@
160 /**
161 \brief Expands to the identifier of the scope create function. @hideinitializer
162 */
163-#define UNITY_SCOPE_CREATE_FUNCTION unity_scope_create
164+// TODO: We really should consider a change in the minor version number as
165+// ABI incompatible, instead of just using the major version. See bug 1320026.
166+#define UNITY_SCOPE_CREATE_FUNCTION unity_scope_create_v@UNITY_SCOPES_MAJOR@
167
168 /**
169 \brief Expands to the identifier of the scope destroy function. @hideinitializer
170@@ -90,7 +92,7 @@
171 MyScope();
172 virtual ~MyScope();
173
174- virtual int start(); // Mandatory
175+ virtual void start(); // Mandatory
176 virtual void stop(); // Mandatory
177 virtual void run(); // Optional
178 };
179@@ -124,7 +126,7 @@
180 ~~~
181
182 After the scopes run time has obtained a pointer to the class instance from the create function, it calls start(),
183-which allows the scope to intialize itself. This is followed by call to run(). The call to run() is made by
184+which allows the scope to intialize itself. This is followed by a call to run(). The call to run() is made by
185 a separate thread; its only purpose is to pass a thread of control to the scope, for example, to run an event loop.
186 When the scope should complete its activities, the run time calls stop(). The calls to the create function, start(),
187 stop(), and the destroy function) are made by the same thread.
188@@ -142,11 +144,6 @@
189 /// @endcond
190
191 /**
192- \brief This value must be returned from the start() method.
193- */
194- static constexpr int VERSION = UNITY_SCOPES_VERSION_MAJOR;
195-
196- /**
197 \brief Called by the scopes run time after the create function completes.
198
199 If start() throws an exception, stop() will _not_ be called.
200@@ -157,12 +154,8 @@
201
202 \param registry A proxy to the scope registry. This parameter is provided for aggregating
203 scopes that need to retrieve proxies to their child scopes.
204-
205- \return Any return value other than ScopeBase::VERSION will cause the scopes run time
206- to refuse to load the scope. The return value is used to ensure that the shared library
207- containing the scope is ABI compatible with the scopes run time.
208 */
209- virtual int start(std::string const& scope_id, RegistryProxy const& registry) = 0;
210+ virtual void start(std::string const& scope_id, RegistryProxy const& registry) = 0;
211
212 /**
213 \brief Called by the scopes run time when the scope should shut down.
214
215=== modified file 'include/unity/scopes/testing/TypedScopeFixture.h'
216--- include/unity/scopes/testing/TypedScopeFixture.h 2014-03-04 01:38:13 +0000
217+++ include/unity/scopes/testing/TypedScopeFixture.h 2014-06-17 09:28:35 +0000
218@@ -64,8 +64,7 @@
219
220 void SetUp()
221 {
222- EXPECT_EQ(UNITY_SCOPES_VERSION_MAJOR,
223- scope->start(ScopeTraits<Scope>::name(), registry_proxy));
224+ EXPECT_NO_THROW(scope->start(ScopeTraits<Scope>::name(), registry_proxy));
225 EXPECT_NO_THROW(scope->run());
226 }
227
228
229=== modified file 'src/scopes/internal/ScopeLoader.cpp'
230--- src/scopes/internal/ScopeLoader.cpp 2014-04-03 16:46:00 +0000
231+++ src/scopes/internal/ScopeLoader.cpp 2014-06-17 09:28:35 +0000
232@@ -119,23 +119,7 @@
233
234 try
235 {
236- const int s_version = scope_base_->start(scope_id_, registry_);
237- const int maj_version = major_version();
238- if (s_version != maj_version)
239- {
240-
241- try
242- {
243- scope_base_->stop(); // Make sure to tell the scope to stop again before reporting version mismatch.
244- }
245- catch (...)
246- {
247- }
248- throw unity::ResourceException("Scope " + scope_id_ + " was compiled with major version " +
249- std::to_string(s_version) + " of the Unity scopes run time. This " +
250- "version is incompatible with the current major " +
251- "version (" + std::to_string(maj_version) + ").");
252- }
253+ scope_base_->start(scope_id_, registry_);
254 }
255 catch (...)
256 {
257
258=== modified file 'test/gtest/scopes/Activation/TestScope.h'
259--- test/gtest/scopes/Activation/TestScope.h 2014-06-13 10:17:24 +0000
260+++ test/gtest/scopes/Activation/TestScope.h 2014-06-17 09:28:35 +0000
261@@ -98,10 +98,7 @@
262 class TestScope : public ScopeBase
263 {
264 public:
265- virtual int start(std::string const&, RegistryProxy const &) override
266- {
267- return VERSION;
268- }
269+ virtual void start(std::string const&, RegistryProxy const &) override {}
270
271 virtual void stop() override {}
272
273
274=== modified file 'test/gtest/scopes/Filters/TestScope.h'
275--- test/gtest/scopes/Filters/TestScope.h 2014-06-12 11:24:03 +0000
276+++ test/gtest/scopes/Filters/TestScope.h 2014-06-17 09:28:35 +0000
277@@ -62,11 +62,7 @@
278 class TestScope : public ScopeBase
279 {
280 public:
281- virtual int start(std::string const&, RegistryProxy const &) override
282- {
283- return VERSION;
284- }
285-
286+ virtual void start(std::string const&, RegistryProxy const &) override {}
287 virtual void stop() override {}
288 virtual void run() override {}
289
290
291=== modified file 'test/gtest/scopes/IdleShutdown/SlowSearchScope.cpp'
292--- test/gtest/scopes/IdleShutdown/SlowSearchScope.cpp 2014-06-12 11:24:03 +0000
293+++ test/gtest/scopes/IdleShutdown/SlowSearchScope.cpp 2014-06-17 09:28:35 +0000
294@@ -50,9 +50,8 @@
295
296 } // namespace
297
298-int SlowSearchScope::start(string const&, RegistryProxy const &)
299+void SlowSearchScope::start(string const&, RegistryProxy const &)
300 {
301- return VERSION;
302 }
303
304 void SlowSearchScope::stop()
305
306=== modified file 'test/gtest/scopes/IdleShutdown/SlowSearchScope.h'
307--- test/gtest/scopes/IdleShutdown/SlowSearchScope.h 2014-05-14 04:50:14 +0000
308+++ test/gtest/scopes/IdleShutdown/SlowSearchScope.h 2014-06-17 09:28:35 +0000
309@@ -27,7 +27,7 @@
310 class SlowSearchScope : public ScopeBase
311 {
312 public:
313- virtual int start(string const&, RegistryProxy const &) override;
314+ virtual void start(string const&, RegistryProxy const &) override;
315
316 virtual void stop() override;
317
318
319=== modified file 'test/gtest/scopes/Invocation/EmptyScope.cpp'
320--- test/gtest/scopes/Invocation/EmptyScope.cpp 2014-05-13 01:40:09 +0000
321+++ test/gtest/scopes/Invocation/EmptyScope.cpp 2014-06-17 09:28:35 +0000
322@@ -49,9 +49,8 @@
323
324 } // namespace
325
326-int EmptyScope::start(string const&, RegistryProxy const &)
327+void EmptyScope::start(string const&, RegistryProxy const &)
328 {
329- return VERSION;
330 }
331
332 void EmptyScope::stop()
333
334=== modified file 'test/gtest/scopes/Invocation/EmptyScope.h'
335--- test/gtest/scopes/Invocation/EmptyScope.h 2014-05-13 01:40:09 +0000
336+++ test/gtest/scopes/Invocation/EmptyScope.h 2014-06-17 09:28:35 +0000
337@@ -27,7 +27,7 @@
338 class EmptyScope : public ScopeBase
339 {
340 public:
341- virtual int start(string const&, RegistryProxy const &) override;
342+ virtual void start(string const&, RegistryProxy const &) override;
343
344 virtual void stop() override;
345
346
347=== modified file 'test/gtest/scopes/Invocation/TestScope.cpp'
348--- test/gtest/scopes/Invocation/TestScope.cpp 2014-06-16 04:11:38 +0000
349+++ test/gtest/scopes/Invocation/TestScope.cpp 2014-06-17 09:28:35 +0000
350@@ -56,9 +56,8 @@
351
352 } // namespace
353
354-int TestScope::start(string const&, RegistryProxy const &)
355+void TestScope::start(string const&, RegistryProxy const &)
356 {
357- return VERSION;
358 }
359
360 void TestScope::stop()
361
362=== modified file 'test/gtest/scopes/Invocation/TestScope.h'
363--- test/gtest/scopes/Invocation/TestScope.h 2014-04-17 01:36:29 +0000
364+++ test/gtest/scopes/Invocation/TestScope.h 2014-06-17 09:28:35 +0000
365@@ -27,7 +27,7 @@
366 class TestScope : public ScopeBase
367 {
368 public:
369- virtual int start(string const&, RegistryProxy const &) override;
370+ virtual void start(string const&, RegistryProxy const &) override;
371
372 virtual void stop() override;
373
374
375=== modified file 'test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.cpp'
376--- test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.cpp 2014-06-12 16:16:01 +0000
377+++ test/gtest/scopes/Registry/scopes/testscopeA/testscopeA.cpp 2014-06-17 09:28:35 +0000
378@@ -64,10 +64,7 @@
379 class MyScope : public ScopeBase
380 {
381 public:
382- virtual int start(string const&, RegistryProxy const&) override
383- {
384- return VERSION;
385- }
386+ virtual void start(string const&, RegistryProxy const&) override {}
387
388 virtual void stop() override {}
389
390
391=== modified file 'test/gtest/scopes/Registry/scopes/testscopeB/testscopeB.cpp'
392--- test/gtest/scopes/Registry/scopes/testscopeB/testscopeB.cpp 2014-06-12 16:16:01 +0000
393+++ test/gtest/scopes/Registry/scopes/testscopeB/testscopeB.cpp 2014-06-17 09:28:35 +0000
394@@ -77,10 +77,7 @@
395 class MyScope : public ScopeBase
396 {
397 public:
398- virtual int start(string const&, RegistryProxy const&) override
399- {
400- return VERSION;
401- }
402+ virtual void start(string const&, RegistryProxy const&) override {}
403
404 virtual void stop() override {}
405
406
407=== modified file 'test/gtest/scopes/Runtime/PusherScope.cpp'
408--- test/gtest/scopes/Runtime/PusherScope.cpp 2014-03-31 14:29:50 +0000
409+++ test/gtest/scopes/Runtime/PusherScope.cpp 2014-06-17 09:28:35 +0000
410@@ -69,9 +69,8 @@
411
412 } // namespace
413
414-int PusherScope::start(string const&, RegistryProxy const &)
415+void PusherScope::start(string const&, RegistryProxy const &)
416 {
417- return VERSION;
418 }
419
420 void PusherScope::stop()
421
422=== modified file 'test/gtest/scopes/Runtime/PusherScope.h'
423--- test/gtest/scopes/Runtime/PusherScope.h 2014-03-31 14:29:50 +0000
424+++ test/gtest/scopes/Runtime/PusherScope.h 2014-06-17 09:28:35 +0000
425@@ -27,7 +27,7 @@
426 class PusherScope : public ScopeBase
427 {
428 public:
429- virtual int start(string const&, RegistryProxy const &) override;
430+ virtual void start(string const&, RegistryProxy const &) override;
431
432 virtual void stop() override;
433
434
435=== modified file 'test/gtest/scopes/Runtime/SlowCreateScope.cpp'
436--- test/gtest/scopes/Runtime/SlowCreateScope.cpp 2014-04-16 03:57:48 +0000
437+++ test/gtest/scopes/Runtime/SlowCreateScope.cpp 2014-06-17 09:28:35 +0000
438@@ -70,9 +70,8 @@
439
440 } // namespace
441
442-int SlowCreateScope::start(string const&, RegistryProxy const &)
443+void SlowCreateScope::start(string const&, RegistryProxy const &)
444 {
445- return VERSION;
446 }
447
448 void SlowCreateScope::stop()
449
450=== modified file 'test/gtest/scopes/Runtime/SlowCreateScope.h'
451--- test/gtest/scopes/Runtime/SlowCreateScope.h 2014-03-31 14:29:50 +0000
452+++ test/gtest/scopes/Runtime/SlowCreateScope.h 2014-06-17 09:28:35 +0000
453@@ -27,7 +27,7 @@
454 class SlowCreateScope : public ScopeBase
455 {
456 public:
457- virtual int start(string const&, RegistryProxy const &) override;
458+ virtual void start(string const&, RegistryProxy const &) override;
459
460 virtual void stop() override;
461
462
463=== modified file 'test/gtest/scopes/Runtime/TestScope.cpp'
464--- test/gtest/scopes/Runtime/TestScope.cpp 2014-06-04 10:16:52 +0000
465+++ test/gtest/scopes/Runtime/TestScope.cpp 2014-06-17 09:28:35 +0000
466@@ -107,9 +107,8 @@
467 }
468 };
469
470-int TestScope::start(string const&, RegistryProxy const &)
471+void TestScope::start(string const&, RegistryProxy const &)
472 {
473- return VERSION;
474 }
475
476 void TestScope::stop()
477
478=== modified file 'test/gtest/scopes/Runtime/TestScope.h'
479--- test/gtest/scopes/Runtime/TestScope.h 2014-03-31 14:29:50 +0000
480+++ test/gtest/scopes/Runtime/TestScope.h 2014-06-17 09:28:35 +0000
481@@ -27,7 +27,7 @@
482 class TestScope : public ScopeBase
483 {
484 public:
485- virtual int start(string const&, RegistryProxy const &) override;
486+ virtual void start(string const&, RegistryProxy const &) override;
487
488 virtual void stop() override;
489
490
491=== modified file 'test/gtest/scopes/ScopeBase/scopelib.cpp'
492--- test/gtest/scopes/ScopeBase/scopelib.cpp 2014-02-27 23:20:56 +0000
493+++ test/gtest/scopes/ScopeBase/scopelib.cpp 2014-06-17 09:28:35 +0000
494@@ -25,11 +25,7 @@
495 public:
496 MyScope() {}
497
498- virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override
499- {
500- return VERSION;
501- }
502-
503+ virtual void start(std::string const&, unity::scopes::RegistryProxy const&) override {}
504 virtual void stop() override {}
505 virtual void run() override {}
506
507
508=== removed file 'test/gtest/scopes/internal/ScopeLoader/BadVersion.cpp'
509--- test/gtest/scopes/internal/ScopeLoader/BadVersion.cpp 2014-02-27 23:20:56 +0000
510+++ test/gtest/scopes/internal/ScopeLoader/BadVersion.cpp 1970-01-01 00:00:00 +0000
511@@ -1,81 +0,0 @@
512-/*
513- * Copyright (C) 2013 Canonical Ltd
514- *
515- * This program is free software: you can redistribute it and/or modify
516- * it under the terms of the GNU Lesser General Public License version 3 as
517- * published by the Free Software Foundation.
518- *
519- * This program is distributed in the hope that it will be useful,
520- * but WITHOUT ANY WARRANTY; without even the implied warranty of
521- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
522- * GNU Lesser General Public License for more details.
523- *
524- * You should have received a copy of the GNU Lesser General Public License
525- * along with this program. If not, see <http://www.gnu.org/licenses/>.
526- *
527- * Authored by: Michi Henning <michi.henning@canonical.com>
528- */
529-
530-// Force Version.h to use the specified version, so we get coverage on the version check.
531-
532-#define UNITY_SCOPES_VERSION_MAJOR 666
533-
534-#include "Counters.h"
535-
536-#include <unity/scopes/internal/ScopeLoader.h>
537-#include <unity/scopes/CannedQuery.h>
538-
539-#include <iostream>
540-
541-class EXPORT MyScope : public unity::scopes::ScopeBase
542-{
543-public:
544- MyScope() {}
545- virtual ~MyScope() {}
546-
547- virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override
548- {
549- inc_start();
550- return VERSION;
551- }
552-
553- virtual void stop() override
554- {
555- inc_stop();
556- }
557-
558- virtual unity::scopes::SearchQueryBase::UPtr search(unity::scopes::CannedQuery const&,
559- unity::scopes::SearchMetadata const&) override
560- {
561- return nullptr;
562- }
563-
564- virtual unity::scopes::PreviewQueryBase::UPtr preview(unity::scopes::Result const&,
565- unity::scopes::ActionMetadata const&) override
566- {
567- return nullptr;
568- }
569-};
570-
571-extern "C"
572-{
573-
574- EXPORT
575- unity::scopes::ScopeBase*
576- // cppcheck-suppress unusedFunction
577- UNITY_SCOPE_CREATE_FUNCTION()
578- {
579- inc_create();
580- return new MyScope;
581- }
582-
583- EXPORT
584- void
585- // cppcheck-suppress unusedFunction
586- UNITY_SCOPE_DESTROY_FUNCTION(unity::scopes::ScopeBase* scope_base)
587- {
588- inc_destroy();
589- delete scope_base;
590- }
591-
592-}
593
594=== modified file 'test/gtest/scopes/internal/ScopeLoader/CMakeLists.txt'
595--- test/gtest/scopes/internal/ScopeLoader/CMakeLists.txt 2013-12-20 05:07:03 +0000
596+++ test/gtest/scopes/internal/ScopeLoader/CMakeLists.txt 2014-06-17 09:28:35 +0000
597@@ -5,7 +5,6 @@
598
599 add_library(SharedState SHARED Counters.cpp PerScopeVariables.cpp)
600
601-add_library(BadVersion MODULE BadVersion.cpp)
602 add_library(NoDestroy MODULE NoDestroy.cpp)
603 add_library(NullReturn MODULE NullReturn.cpp)
604 add_library(ScopeA MODULE ScopeA.cpp)
605
606=== modified file 'test/gtest/scopes/internal/ScopeLoader/MyScope.h'
607--- test/gtest/scopes/internal/ScopeLoader/MyScope.h 2014-02-27 23:20:56 +0000
608+++ test/gtest/scopes/internal/ScopeLoader/MyScope.h 2014-06-17 09:28:35 +0000
609@@ -31,10 +31,9 @@
610 MyScope() {}
611 virtual ~MyScope() {}
612
613- virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override
614+ virtual void start(std::string const&, unity::scopes::RegistryProxy const&) override
615 {
616 inc_start();
617- return VERSION;
618 }
619
620 virtual void stop() override
621
622=== modified file 'test/gtest/scopes/internal/ScopeLoader/ScopeA.cpp'
623--- test/gtest/scopes/internal/ScopeLoader/ScopeA.cpp 2014-01-09 11:59:34 +0000
624+++ test/gtest/scopes/internal/ScopeLoader/ScopeA.cpp 2014-06-17 09:28:35 +0000
625@@ -30,10 +30,9 @@
626 class ScopeA : public MyScope
627 {
628 public:
629- virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override
630+ virtual void start(std::string const&, unity::scopes::RegistryProxy const&) override
631 {
632 inc_start();
633- return VERSION;
634 }
635
636 virtual void stop() override
637
638=== modified file 'test/gtest/scopes/internal/ScopeLoader/ScopeB.cpp'
639--- test/gtest/scopes/internal/ScopeLoader/ScopeB.cpp 2014-01-09 11:59:34 +0000
640+++ test/gtest/scopes/internal/ScopeLoader/ScopeB.cpp 2014-06-17 09:28:35 +0000
641@@ -30,10 +30,9 @@
642 class ScopeA : public MyScope
643 {
644 public:
645- virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override
646+ virtual void start(std::string const&, unity::scopes::RegistryProxy const&) override
647 {
648 inc_start();
649- return VERSION;
650 }
651
652 virtual void stop() override
653
654=== modified file 'test/gtest/scopes/internal/ScopeLoader/ScopeLoader_test.cpp'
655--- test/gtest/scopes/internal/ScopeLoader/ScopeLoader_test.cpp 2014-04-03 16:46:00 +0000
656+++ test/gtest/scopes/internal/ScopeLoader/ScopeLoader_test.cpp 2014-06-17 09:28:35 +0000
657@@ -37,7 +37,6 @@
658 {
659
660 char const* scope_lib = TEST_BUILD_ROOT "/gtest/scopes/internal/ScopeLoader/libTestScope.so";
661-char const* bad_version_lib = TEST_BUILD_ROOT "/gtest/scopes/internal/ScopeLoader/libBadVersion.so";
662 char const* no_destroy_lib = TEST_BUILD_ROOT "/gtest/scopes/internal/ScopeLoader/libNoDestroy.so";
663 char const* null_return_lib = TEST_BUILD_ROOT "/gtest/scopes/internal/ScopeLoader/libNullReturn.so";
664 char const* throw_unity_ex_from_start_lib
665@@ -82,31 +81,6 @@
666 EXPECT_EQ(0, num_stop());
667 }
668
669-TEST(ScopeLoader, version_mismatch)
670-{
671- reset_counters();
672-
673- try
674- {
675- ScopeLoader::UPtr sl = ScopeLoader::load("testScope", bad_version_lib, registry);
676- sl->start();
677- sl->unload();
678- FAIL();
679- }
680- catch (unity::Exception const& e)
681- {
682- boost::regex r("unity::ResourceException: Scope testScope: terminated due to exception in start\\(\\):\n"
683- " unity::ResourceException: Scope testScope was compiled with major version 666 of the "
684- "Unity scopes run time. This version is incompatible with the current major version "
685- "\\([0-9]+\\)\\.");
686- EXPECT_TRUE(boost::regex_match(e.what(), r)) << e.what();
687- }
688- EXPECT_EQ(1, num_create());
689- EXPECT_EQ(1, num_destroy());
690- EXPECT_EQ(1, num_start());
691- EXPECT_EQ(1, num_stop());
692-}
693-
694 TEST(ScopeLoader, stop)
695 {
696 reset_counters();
697@@ -215,7 +189,8 @@
698 }
699 catch (unity::Exception const& e)
700 {
701- EXPECT_STREQ("unity::ResourceException: Scope testScope returned nullptr from unity_scope_create",
702+ EXPECT_STREQ("unity::ResourceException: Scope testScope returned nullptr from unity_scope_create_v"
703+ UNITY_SCOPES_VERSION_XSTR(UNITY_SCOPES_VERSION_MAJOR),
704 e.what());
705 EXPECT_EQ(1, num_create());
706 EXPECT_EQ(0, num_destroy());
707@@ -236,7 +211,8 @@
708 }
709 catch (unity::Exception const& e)
710 {
711- EXPECT_STREQ("unity::ResourceException: Scope testScope returned nullptr from unity_scope_create",
712+ EXPECT_STREQ("unity::ResourceException: Scope testScope returned nullptr from unity_scope_create_v"
713+ UNITY_SCOPES_VERSION_XSTR(UNITY_SCOPES_VERSION_MAJOR),
714 e.what());
715 EXPECT_EQ(1, num_create());
716 EXPECT_EQ(0, num_destroy());
717
718=== modified file 'test/gtest/scopes/internal/ScopeLoader/ThrowUnityExFromStart.cpp'
719--- test/gtest/scopes/internal/ScopeLoader/ThrowUnityExFromStart.cpp 2014-01-09 11:59:34 +0000
720+++ test/gtest/scopes/internal/ScopeLoader/ThrowUnityExFromStart.cpp 2014-06-17 09:28:35 +0000
721@@ -29,7 +29,7 @@
722 class EXPORT MyThrowingScope : public MyScope
723 {
724 public:
725- virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override
726+ virtual void start(std::string const&, unity::scopes::RegistryProxy const&) override
727 {
728 inc_start();
729 throw unity::LogicException("start failure");
730
731=== modified file 'test/gtest/scopes/internal/ScopeLoader/ThrowUnknownExFromStart.cpp'
732--- test/gtest/scopes/internal/ScopeLoader/ThrowUnknownExFromStart.cpp 2014-01-09 11:59:34 +0000
733+++ test/gtest/scopes/internal/ScopeLoader/ThrowUnknownExFromStart.cpp 2014-06-17 09:28:35 +0000
734@@ -28,7 +28,7 @@
735 class EXPORT MyThrowingScope : public MyScope
736 {
737 public:
738- virtual int start(std::string const&, unity::scopes::RegistryProxy const&) override
739+ virtual void start(std::string const&, unity::scopes::RegistryProxy const&) override
740 {
741 inc_start();
742 throw 42;
743
744=== modified file 'test/gtest/scopes/testing/IsolatedScope/scope.cpp'
745--- test/gtest/scopes/testing/IsolatedScope/scope.cpp 2014-06-13 10:17:24 +0000
746+++ test/gtest/scopes/testing/IsolatedScope/scope.cpp 2014-06-17 09:28:35 +0000
747@@ -125,9 +125,8 @@
748
749 } // namespace testing
750
751-int testing::Scope::start(std::string const&, unity::scopes::RegistryProxy const &)
752+void testing::Scope::start(std::string const&, unity::scopes::RegistryProxy const &)
753 {
754- return VERSION;
755 }
756
757 void testing::Scope::stop()
758
759=== modified file 'test/gtest/scopes/testing/IsolatedScope/scope.h'
760--- test/gtest/scopes/testing/IsolatedScope/scope.h 2014-02-27 23:29:10 +0000
761+++ test/gtest/scopes/testing/IsolatedScope/scope.h 2014-06-17 09:28:35 +0000
762@@ -25,7 +25,7 @@
763 class Scope : public unity::scopes::ScopeBase
764 {
765 public:
766- int start(std::string const&, unity::scopes::RegistryProxy const &) override;
767+ void start(std::string const&, unity::scopes::RegistryProxy const &) override;
768
769 void stop() override;
770
771
772=== modified file 'test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.cpp'
773--- test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.cpp 2014-06-13 10:17:24 +0000
774+++ test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.cpp 2014-06-17 09:28:35 +0000
775@@ -155,9 +155,8 @@
776 {
777 }
778
779-int testing::Scope::start(std::string const&, unity::scopes::RegistryProxy const &)
780+void testing::Scope::start(std::string const&, unity::scopes::RegistryProxy const &)
781 {
782- return VERSION;
783 }
784
785 void testing::Scope::stop()
786
787=== modified file 'test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.h'
788--- test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.h 2014-03-06 10:15:39 +0000
789+++ test/gtest/scopes/testing/IsolatedScopeBenchmark/scope.h 2014-06-17 09:28:35 +0000
790@@ -30,7 +30,7 @@
791 public:
792 Scope(const std::chrono::milliseconds& mean, const std::chrono::milliseconds& variance);
793
794- int start(std::string const&, unity::scopes::RegistryProxy const &) override;
795+ void start(std::string const&, unity::scopes::RegistryProxy const &) override;
796
797 void stop() override;
798

Subscribers

People subscribed via source and target branches

to all changes: