Mir

Merge lp:~kuchtam/mir/bug_1195540_after_review into lp:mir

Proposed by Michał Kuchta
Status: Merged
Approved by: Cemil Azizoglu
Approved revision: no longer in the source branch.
Merged at revision: 4018
Proposed branch: lp:~kuchtam/mir/bug_1195540_after_review
Merge into: lp:mir
Diff against target: 60 lines (+22/-0)
4 files modified
include/client/mir_toolkit/mir_connection.h (+9/-0)
src/client/mir_connection_api.cpp (+5/-0)
src/client/symbols.map (+1/-0)
tests/acceptance-tests/test_client_library.cpp (+7/-0)
To merge this branch: bzr merge lp:~kuchtam/mir/bug_1195540_after_review
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve
Cemil Azizoglu (community) Approve
Daniel van Vugt Approve
Review via email: mp+316287@code.launchpad.net

Commit message

Bug #1195540: [enhancement] Make able to get version information from client / server APIs - corrections after review

Description of the change

Bug #1195540: [enhancement] Make able to get version information from client / server APIs - corrections after review

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Cool, thanks.

Approved, but could be improved with:
  * Better documentation mentioning you need to compare the result to MIR_VERSION_NUMBER(x,y,z)
  * Remove extra blank link from the cpp file.
  * Acceptance tests to verify the function returns MIR_CLIENT_API_VERSION (when called within the same source tree).

Although I now realize the use of dlsym() mentioned in the bug may negate the need for all this at all, it doesn't hurt...

review: Approve
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

+1 on the acceptance test. But it's trivial in this case so feel free to top approve if you decide not to indulge.

review: Approve
Revision history for this message
Michał Kuchta (kuchtam) wrote :

Fixed in revision: 4009

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

Thanks, but this should be "==" or "EXPECT_EQ"

+ MIR_CLIENT_API_VERSION_PATCH) >= mir_get_client_api_version());

review: Needs Fixing
Revision history for this message
Michał Kuchta (kuchtam) wrote :

Fixed in rev: 4010

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

As mentioned above, I now realize we may never need this function. Simply using dlsym() by itself should suffice. But the bug was open, and it's a great practice exercise.

Just waiting to see if any of ~mir-team objects to this.

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

Michał,

If nobody has already mentioned it to you, please also complete this:
  https://www.ubuntu.com/legal/contributors/submit

And for the Canonical Project Manager field, enter:
  Kevin Gunn (<email address hidden>)

More information:
  https://www.ubuntu.com/legal/contributors

Revision history for this message
Michał Kuchta (kuchtam) wrote :

Hi Daniel,

I have signed document.

I think that this function can be useful because it gives you simple and
quick information about which lib version is use now.

Of course you can do this by dlsym - but each time you must check if
returned address is correct

and when API has big number of functions it can be uncomfortable.

Best Regards,

Michał

2017-02-08 4:09 GMT+01:00 Daniel van Vugt <email address hidden>:

> Michał,
>
> If nobody has already mentioned it to you, please also complete this:
> https://www.ubuntu.com/legal/contributors/submit
>
> And for the Canonical Project Manager field, enter:
> Kevin Gunn (<email address hidden>)
>
> More information:
> https://www.ubuntu.com/legal/contributors
> --
> https://code.launchpad.net/~kuchtam/mir/bug_1195540_after_
> review/+merge/316287
> You are the owner of lp:~kuchtam/mir/bug_1195540_after_review.
>

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Huh I wonder why jenkins hasn't run on this? Oh well.

review: Approve
Revision history for this message
Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/client/mir_toolkit/mir_connection.h'
2--- include/client/mir_toolkit/mir_connection.h 2017-01-31 19:33:32 +0000
3+++ include/client/mir_toolkit/mir_connection.h 2017-02-06 07:16:22 +0000
4@@ -473,6 +473,15 @@
5 MirErrorCallback callback,
6 void* context);
7
8+/**
9+ * Returns client API version
10+ *
11+ * Result of the function should be compared to result of MIR_VERSION_NUMBER
12+ *
13+ * \return The client API version
14+ */
15+unsigned mir_get_client_api_version();
16+
17 #ifdef __cplusplus
18 }
19 /**@}*/
20
21=== modified file 'src/client/mir_connection_api.cpp'
22--- src/client/mir_connection_api.cpp 2017-01-24 19:42:48 +0000
23+++ src/client/mir_connection_api.cpp 2017-02-06 07:16:22 +0000
24@@ -414,6 +414,11 @@
25 }
26 }
27
28+unsigned mir_get_client_api_version()
29+{
30+ return MIR_CLIENT_API_VERSION;
31+}
32+
33 void mir_connection_apply_session_display_config(MirConnection* connection, MirDisplayConfig const* display_config)
34 try
35 {
36
37=== modified file 'src/client/symbols.map'
38--- src/client/symbols.map 2017-02-02 19:17:46 +0000
39+++ src/client/symbols.map 2017-02-06 07:16:22 +0000
40@@ -601,4 +601,5 @@
41 global:
42 mir_connection_apply_session_input_config;
43 mir_connection_set_base_input_config;
44+ mir_get_client_api_version;
45 } MIR_CLIENT_0.26.1;
46
47=== modified file 'tests/acceptance-tests/test_client_library.cpp'
48--- tests/acceptance-tests/test_client_library.cpp 2017-02-03 22:37:56 +0000
49+++ tests/acceptance-tests/test_client_library.cpp 2017-02-06 07:16:22 +0000
50@@ -1225,3 +1225,10 @@
51 mir_buffer_stream_release_sync(stream);
52 mir_connection_release(connection);
53 }
54+
55+TEST_F(ClientLibrary, client_api_version)
56+{
57+ ASSERT_TRUE( MIR_VERSION_NUMBER(MIR_CLIENT_API_VERSION_MAJOR,
58+ MIR_CLIENT_API_VERSION_MINOR,
59+ MIR_CLIENT_API_VERSION_PATCH) == mir_get_client_api_version());
60+}

Subscribers

People subscribed via source and target branches