[PATCH 9/9] tests: Add test to verify tests' ini files get loaded

Marek Chalupa mchqwerty at gmail.com
Fri Apr 3 06:21:45 PDT 2015


On Fri, Apr 3, 2015 at 4:16 AM, Bryce Harrington <bryce at osg.samsung.com>
wrote:

> config-malformed uses an invalid configuration file to verify that the
> test harness is indeed attempting to load the test's requested config
> file.
>
> Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
> ---
>  Makefile.am                   | 12 +++++++-----
>  tests/config-malformed-test.c | 33 +++++++++++++++++++++++++++++++++
>  tests/config-malformed.ini    | 15 +++++++++++++++
>  3 files changed, 55 insertions(+), 5 deletions(-)
>  create mode 100644 tests/config-malformed-test.c
>  create mode 100644 tests/config-malformed.ini
>
> diff --git a/Makefile.am b/Makefile.am
> index 9ed87b1..2079076 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -924,6 +924,7 @@ TESTS = $(shared_tests) $(module_tests) $(weston_tests)
>
>  shared_tests =                                 \
>         config-parser.test                      \
> +       config-malformed.weston         \
>         vertex-clip.test
>
>  module_tests =                                 \
> @@ -931,7 +932,6 @@ module_tests =                                      \
>         surface-global-test.la
>
>  weston_tests =                                 \
> -       config-malformed.weston         \
>         bad_buffer.weston                       \
>         keyboard.weston                         \
>         event.weston                            \
> @@ -942,6 +942,8 @@ weston_tests =                                      \
>         subsurface.weston                       \
>         devices.weston
>
> +XFAIL_TESTS =                                  \
> +       config-malformed.weston
>
>  AM_TESTS_ENVIRONMENT = \
>         abs_builddir='$(abs_builddir)'; export abs_builddir; \
> @@ -1001,6 +1003,10 @@ libtest_runner_la_CFLAGS = $(GCC_CFLAGS)
> $(COMPOSITOR_CFLAGS)
>  config_parser_test_SOURCES = tests/config-parser-test.c
>  config_parser_test_LDADD = libshared.la libtest-runner.la
> $(COMPOSITOR_LIBS)
>
> +config_malformed_weston_SOURCES = tests/config-malformed-test.c
> +config_malformed_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
> +config_malformed_weston_LDADD = libtest-client.la
> +
>  vertex_clip_test_SOURCES =                     \
>         tests/vertex-clip-test.c                \
>         src/vertex-clipping.c                   \
> @@ -1016,10 +1022,6 @@ nodist_libtest_client_la_SOURCES =               \
>  libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
>  libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) libshared.la
> libtest-runner.la
>
> -config_malformed_weston_SOURCES = tests/config-malformed-test.c
> -config_malformed_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
> -config_malformed_weston_LDADD = libtest-client.la
> -
>  bad_buffer_weston_SOURCES = tests/bad-buffer-test.c
>  bad_buffer_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
>  bad_buffer_weston_LDADD = libtest-client.la
> diff --git a/tests/config-malformed-test.c b/tests/config-malformed-test.c
> new file mode 100644
> index 0000000..71ff6c9
> --- /dev/null
> +++ b/tests/config-malformed-test.c
> @@ -0,0 +1,33 @@
> +/*
> + * Copyright © 2015 Samsung Research
> + *
> + * Permission to use, copy, modify, distribute, and sell this software and
> + * its documentation for any purpose is hereby granted without fee,
> provided
> + * that the above copyright notice appear in all copies and that both that
> + * copyright notice and this permission notice appear in supporting
> + * documentation, and that the name of the copyright holders not be used
> in
> + * advertising or publicity pertaining to distribution of the software
> + * without specific, written prior permission.  The copyright holders make
> + * no representations about the suitability of this software for any
> + * purpose.  It is provided "as is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
> + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
> + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
> + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
> + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
> + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
> + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> + */
> +
> +#include "config.h"
> +
> +#include "weston-test-client-helper.h"
> +
> +TEST(config_malformed_test)
> +{
> +       /* We should never reach here, because the invalid config file
> +        * should cause the server to exit with failure before invoking
> tests.
> +        */
> +       assert(1 == 1);
>

Maybe I don't understand what this test does, but assert(1 == 1) is always
true so this is kind of useless statement, isn't it?
Maybe you meant to use 1 != 1? And going further - couldn't be this fail
test converted to normal test, so that we are sure that the failure is
really
the one we test for?


> +}
> diff --git a/tests/config-malformed.ini b/tests/config-malformed.ini
> new file mode 100644
> index 0000000..4af4dec
> --- /dev/null
> +++ b/tests/config-malformed.ini
> @@ -0,0 +1,15 @@
> +]core[
> +123=bar=baz
> +/invalid
> +
> +[shell]
> +$#^%&&$%#
> +background-color=0xff002244
> +background-type=tile
> +panel-color=0x90ff0000
> +locking=true
> +animation=zoom
> +
> +[launcher]
> +path=/usr/bin/gnome-terminal
> +
> --
> 1.9.1
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>

Cheers,
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20150403/6e04352c/attachment.html>


More information about the wayland-devel mailing list