tests: make the test context persistent
authorNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Mon, 22 Jun 2015 06:35:49 +0000 (15:35 +0900)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 25 Jun 2015 08:39:10 +0000 (11:39 +0300)
commita10352e5c3418f9539cb53f4aecc537d2b412a4b
tree9411e4e2dcce54a82bed599dd8cb0eaf6d88eeb6
parent83c20bcbd5aaf579ee8d7d61cd090bcd0f9ecbc7
tests: make the test context persistent

The TESTs in ivi_layout-test.c may have several server-side parts
(RUNNER_TEST in ivi_layout-test-plugin.c) each. Sometimes we need to
carry state from one RUNNER_TEST to another within one TEST, but not
across multiple TESTs. The correct lifetime of that state would be the
lifetime (and identity) of the runner_resource, as one TEST creates and
uses at most one weston_test_runner during its lifetime.

However, tests are executed one by one. Take a shortcut, and use a static
global for storing that state. This turns the test_context into a
singleton. To ensure it is not confused between multiple TESTs, add
asserts to verify its identity.

Following patches will add tests for notification callbacks. These will
be using the carried state.

[Pekka: add serialization checks, rename the global, rewrite commit message.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
tests/ivi_layout-test-plugin.c