Merge lp://staging/~ted/dbus-test-runner/dbus-mock into lp://staging/dbus-test-runner/14.04

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 167
Merged at revision: 69
Proposed branch: lp://staging/~ted/dbus-test-runner/dbus-mock
Merge into: lp://staging/dbus-test-runner/14.04
Diff against target: 2338 lines (+2094/-12)
12 files modified
configure.ac (+4/-3)
debian/changelog (+6/-0)
debian/control (+2/-0)
libdbustest/Makefile.am (+28/-0)
libdbustest/dbus-mock-iface.xml (+151/-0)
libdbustest/dbus-mock.c (+1084/-0)
libdbustest/dbus-mock.h (+118/-0)
libdbustest/dbus-test.h (+1/-0)
libdbustest/process.c (+120/-9)
libdbustest/process.h (+1/-0)
tests/Makefile.am (+34/-0)
tests/test-libdbustest-mock.c (+545/-0)
To merge this branch: bzr merge lp://staging/~ted/dbus-test-runner/dbus-mock
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+192249@code.staging.launchpad.net

Commit message

Add a DBus Mock task

Description of the change

Add a DBus Mock task

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
150. By Ted Gould

Dbus mock depends

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

Make it so we can 'untuple' the parameters for dbusmock

152. By Ted Gould

Make our test a little bit trickier

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
153. By Ted Gould

Make sure we grab a ref to the values passed into emit

154. By Ted Gould

Handle the av that DBusMock wants

155. By Ted Gould

Adding a signal with parameters

156. By Ted Gould

Make it so that we have a pretty name

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
157. By Ted Gould

Bumping version and adding DBusMock support

158. By Ted Gould

Forgot a version number

159. By Ted Gould

Merge trunk

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

Questions:

 * Why is DbusTestProcess.parameters a GArray instead of a GPtrArray?

 * Why are DbusTestDbusMock.properties and .methods GArrays instead of GPtrArrays?

 * in dbus-mock.c's install_object(), do the local "properties" and "methods"
   GVariants need to be unreffed, or does ..._add_object_sync() always consume them,
   even on failure?

 * in dbus-mock.c's dbus_test_dbus_mock_object_update_property(), maybe use
   g_propagate_error() instead of direct assignmnt "*error = local_error"?

 * in test-libdbustest-mock.c's main(), should G_LOG_LEVEL_CRITICAL be fatal
   in the tests?

Must Fix:

 * in process.c's dbus_test_process_get_pid(), need to use g_return_val_if_fail()
   instead of g_return_if_fail()

 * in dbus-mock.c's dbus_test_mock_dispose(), need to test self->priv->cancel for
   NULL before passing it to g_cancellable_cancel()

 * in dbus-mock.c's method_params_to_variant(), please add a comment above the
   "if (params == NULL)" explaining what DBusMock is expecting when this happens?
   I don't understand this block.

 * in dbus-mock.c's method_params_to_variant(), need to test len>0 before using
   peek[0]. Should probably also test peek!=NULL before using strlen().

 * in dbus-mock.c's install_object(), dead assign of NULL to the local "properties"
   and "method" GVariants when declaring them. Better to leave them uninitialized so
   gcc can yell at tell us if they get used without being initialized later in
   the code.

 * in process.c's dbus_test_process_append_param(), ignore the return value of
   g_array_append_val(). This is a leftover from switching from GList -> GArray

Should Fix:

 * There are still these super-strange "return;" lines everywhere...

 * in dbus-mock.c's constructed(), multiple commands on single lines.
   Might be more readable to remove the paramval variable altogether and use
   g_array_append_val (params, "-m");
   g_array_append_val (params, "dbusmock");

 * in test-lidbustest-mock.c, inconsistent use of "static" prefix for functions:
   signal_emitted() is private, but timeout_quit_func(), process_mainloop(), etc
   are public

 * in test-libdbustest-mock.c, lots of leaked "testvar"s in multiple functions

review: Needs Fixing
Revision history for this message
Ted Gould (ted) wrote :

On Mon, 2013-11-18 at 17:22 +0000, Charles Kerr wrote:

> * Why is DbusTestProcess.parameters a GArray instead of a GPtrArray?

Because I wanted it to be NULL terminated, which GPtrArray doesn't do.
That makes data usable as a GStrv.

> * Why are DbusTestDbusMock.properties and .methods GArrays instead of GPtrArrays?

To avoid allocating the structures separately. Basically all memory
management moves with the array then.

> * in dbus-mock.c's install_object(), do the local "properties" and "methods"
> GVariants need to be unreffed, or does ..._add_object_sync() always consume them,
> even on failure?

Yeah, it creates another, larger variant with g_variant_new().

> * in dbus-mock.c's dbus_test_dbus_mock_object_update_property(), maybe use
> g_propagate_error() instead of direct assignmnt "*error = local_error"?

Ah, always forget about that function. Fixed r160.

> * in test-libdbustest-mock.c's main(), should G_LOG_LEVEL_CRITICAL be fatal
> in the tests?

No, because one of the tests purposefully make a critical error to make
sure it's handled:

libdbustest-CRITICAL **: Property 'prop1' is not of same value in
dbus_test_dbus_mock_object_update_property()

> * in process.c's dbus_test_process_get_pid(), need to use g_return_val_if_fail()
> instead of g_return_if_fail()

Fixed r161.

> * in dbus-mock.c's dbus_test_mock_dispose(), need to test self->priv->cancel for
> NULL before passing it to g_cancellable_cancel()

Fixed r162.

> * in dbus-mock.c's method_params_to_variant(), please add a comment above the
> "if (params == NULL)" explaining what DBusMock is expecting when this happens?
> I don't understand this block.

Explained r163.

> * in dbus-mock.c's method_params_to_variant(), need to test len>0 before using
> peek[0]. Should probably also test peek!=NULL before using strlen().

Fixed r164.

> * in dbus-mock.c's install_object(), dead assign of NULL to the local "properties"
> and "method" GVariants when declaring them. Better to leave them uninitialized so
> gcc can yell at tell us if they get used without being initialized later in
> the code.

Hmm, I think this is done already. Do you see it in another place in
the code?

> * in process.c's dbus_test_process_append_param(), ignore the return value of
> g_array_append_val(). This is a leftover from switching from GList -> GArray

Wow. Fixed r165.

> * in dbus-mock.c's constructed(), multiple commands on single lines.
> Might be more readable to remove the paramval variable altogether and use
> g_array_append_val (params, "-m");
> g_array_append_val (params, "dbusmock");

Sadly, you can't. The macro requires it to be a local variable. I did
that to make it seem a little less insane, not sure if I accomplished
that or not.

> * in test-lidbustest-mock.c, inconsistent use of "static" prefix for functions:
> signal_emitted() is private, but timeout_quit_func(), process_mainloop(), etc
> are public

Fixed r166.

> * in test-libdbustest-mock.c, lots of leaked "testvar"s in multiple functions

Actually it was the tuple getting leaked :-) Fixed r167.

160. By Ted Gould

Use g_propagate_error()

161. By Ted Gould

Return a value. No seriously.

162. By Ted Gould

Don't cancel a NULL cancelable

163. By Ted Gould

Better comment on method_params_to_variant()

164. By Ted Gould

Make sure GVariantType isn't screwing with us.

165. By Ted Gould

Ignore return value

166. By Ted Gould

Make all helper functions static

167. By Ted Gould

Don't loose a tuple

Revision history for this message
Charles Kerr (charlesk) wrote :

Nice!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches