[PATCH 0/3] Resubmit - Unit test framework for Wayland

Kristian Høgsberg krh at bitplanet.net
Thu Mar 1 19:34:04 PST 2012


Hi Artie,

Thanks for starting this.  Looks good and certainly when we start
adding tests for some of the more complex objects and data structures
in the library (wl_map would be a good next step), it will be a good
way to avoid regressing functionality.  I'm not convinced that we
really need an external unit testing framework though. All each TESTS
binary need to do is to test something and fail or succeed.  We can
add a little test helper to provide the fail_if() etc functions.

Can we do just one patch that adds the iniital test case with
copyright headers and automake infrastructure?

thanks,
Kristian

On Wed, Feb 29, 2012 at 3:07 PM, U. Artie Eoff
<ullysses.a.eoff at intel.com> wrote:
> From: "U. Artie Eoff" <ullysses.a.eoff at intel.com>
>
> Resubmitting since some recent tip commits cause previous patches to not apply
> properly.  The following patches should apply to today's tip.  I've included the
> contents of my original cover-letter for convenience...
>
> Unit testing is a very powerful method to find problems early on in the
> development cycle. It allows us to test individual parts for correctness and
> logic.  It also serves as a form of regression testing.
>
> Ideally, we would like to write test cases for all functions and methods so that
> whenever a changed causes a fault, it can be quickly identified and fixed.
>
> If you're more curious on unit testing in general and why it's beneficial, there
> is a well written document at <http://en.wikipedia.org/wiki/Unit_testing>.
>
> One of the goals of this unit test framework is to provide an easy method that
> allows developers and testers to write unit tests.  The 'Check' unit testing
> framework for C (<http://check.sourceforge.net>) appeared to be one of the best,
> readily available open source frameworks for C that provides a simple to use
> interface.
>
> This patch-set is the start of such a unit test framework for the Wayland
> project that exploits the 'Check' unit testing framework.  I've also
> added a few initial, simple test cases to test the util array data structures
> and functions.  Those tests can serve as a starting point/example for the rest
> of the project contributors to start writing their own tests.  Also, the 'Check'
> documentation gives a nice tutorial and examples on some more advanced ways of
> writing unit tests.  Invoking the unit test suite is simple, too: 'make check'.
>
> Currently the project has a 'unit test debt', if you will, and with a little
> persistence, dedication, and discipline I think all of us project contributors
> can eliminate this test coverage debt.  If we all commit to writing at least one
> unit test each day [or two days] which covers some previously untested code
> path, we should be able to bring the unit test coverage up to an acceptable and
> useful level and make this a success.  Eventually, we would like to apply
> these unit testing methods to weston, as well.
>
> In general, developers write unit tests since they have more intimate knowledge
> of the code they are writing and how it's supposed to function.  However, I'm
> suggesting that our QA team get involved too, initially, to help bring down some
> of the unit test coverage 'debt'.
>
> Note that this unit testing is not meant to replace feature, functionality,
> and/or integration testing.  Our QA team is quickly ramping up on defining those
> tests and associated methods for testing those areas.
>
> I really hope that the rest of you, as developers and contributors, are willing
> to adopt this framework into Wayland and understand the benefits it brings.
> It'll certainly help strengthen our confidence that we are creating and
> delivering useful, high quality professional software solutions to the
> community.
>
> Regards,
>
> U. Artie Eoff
> Software Engineer - QA and Validation Lead
> Visualization - Intel Open Source Technology Center
>
> U. Artie Eoff (3):
>  Add dependency checking for the check module.
>  Add initial unit tests and unit test framework.
>  Add copyright to test files
>
>  Makefile.am                |    2 +-
>  configure.ac               |    5 ++
>  tests/Makefile.am          |    8 +++
>  tests/check-wayland-util.c |  129 ++++++++++++++++++++++++++++++++++++++++++++
>  tests/wayland-check.h      |   61 +++++++++++++++++++++
>  5 files changed, 204 insertions(+), 1 deletions(-)
>  create mode 100644 tests/Makefile.am
>  create mode 100644 tests/check-wayland-util.c
>  create mode 100644 tests/wayland-check.h
>
> --
> 1.7.7.6
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list