On Tue, Dec 18, 2012 at 05:30:16PM +0200, Pekka Paalanen wrote:
> We handle FAIL_TEST tests by simply inverting the success flag. The
> problem with this is, that if a FAIL_TEST fails by a SIGSEGV, it will be
> interpreted as passed. However, no code should ever cause a SEGV, or any
> other signal than ABRT. And even ABRT only in the case of an assert()
> that is meant to fail. We would probably need more sophistication for the
> FAIL_TEST cases.
>
> For now, just interpret any other signal than ABRT as a hard failure,
> regardless whether it is a TEST or FAIL_TEST. At least segfaults do not
> cause false passes anymore.

I could imagine that we'd want to test for various expected failure
modes, but we'd probably want to do something more sophisticated for
that.  Like FAIL_TEST(name, FAIL_TEST_SIGSEGV) or something like that.

For now, I've applied this one, thanks.

Kristian

> Signed-off-by: Pekka Paalanen <[email protected]>
> ---
>  tests/weston-test-runner.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c
> index e60d4d2..27ea9e4 100644
> --- a/tests/weston-test-runner.c
> +++ b/tests/weston-test-runner.c
> @@ -28,6 +28,7 @@
>  #include <string.h>
>  #include <assert.h>
>  #include <errno.h>
> +#include <signal.h>
>  #include "weston-test-runner.h"
>  
>  extern const struct weston_test __start_test_section, __stop_test_section;
> @@ -71,6 +72,7 @@ int main(int argc, char *argv[])
>       pass = 0;
>       for (t = &__start_test_section; t < &__stop_test_section; t++) {
>               int success = 0;
> +             int hardfail = 0;
>  
>               pid = fork();
>               assert(pid >= 0);
> @@ -93,13 +95,15 @@ int main(int argc, char *argv[])
>               case CLD_KILLED:
>               case CLD_DUMPED:
>                       fprintf(stderr, "signal %d", info.si_status);
> +                     if (info.si_status != SIGABRT)
> +                             hardfail = 1;
>                       break;
>               }
>  
>               if (t->must_fail)
>                       success = !success;
>  
> -             if (success) {
> +             if (success && !hardfail) {
>                       pass++;
>                       fprintf(stderr, ", pass.\n");
>               } else
> -- 
> 1.7.8.6
> 
> _______________________________________________
> wayland-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to