From: Daniel Wagner <[email protected]>

Hi,

here is an initial attempt for unit testing. The functionality is
splittet into different files. The ones with ending in "-api.c"
implement the client side of ConnMan's API. In the test-connman.h file
are all client API function declerations and also the needed data
structure decleration. test-session.c contains the unit test code.

I tried to minimize code duplicates. The file starts with some common
code snippets. For example for each test case a new Session and System
D-Bus connection is created (test_session_init). Also a new
mainloop. The idea is to reduce any depedency between each test case.

Unfortunalty, there is some trickery needed to stop the whole test
case again. This is the quit_on_idle_and_cleanup function. When a test
case has ended it first tests again if ConnMan is still alive
(sometimes a call succeeds and then ConnMan crashes) and then it adds
the quit_loop_and_cleanup() function to the mainloop to be called when
the mainloop is idle. And only then its safe to close the D-Bus
connection again.

Currently only SessionCreate and SessionDestroy of the Manager
interface are tested, though still found two bugs.

cheers,
daniel

Daniel Wagner (2):
  unit: Add test-session
  unit: Add create session

 Makefile.am         |   10 ++-
 unit/manager-api.c  |  145 +++++++++++++++++++++++
 unit/session-api.c  |  283 +++++++++++++++++++++++++++++++++++++++++++++
 unit/test-connman.h |   86 ++++++++++++++
 unit/test-session.c |  319 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 842 insertions(+), 1 deletions(-)
 create mode 100644 unit/manager-api.c
 create mode 100644 unit/session-api.c
 create mode 100644 unit/test-connman.h
 create mode 100644 unit/test-session.c

-- 
1.7.4.4

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to