Re: [PATCH weston v2 6/6] tests: Properly report skipped tests

2014-02-18 Thread Kristian Høgsberg
On Fri, Feb 07, 2014 at 09:34:48AM +0100, Emilio Pozuelo Monfort wrote:
 From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk
 
 We were calling exit(0) when tests were skipped, which counted
 them as passed instead of skipped. Fix this by properly exiting
 with 77 (which is what automake expects for skipped tests) from
 the tests themselves, then returning 77 again from weston-test-runner
 if all the tests were skipped. Finally the weston-test.so module
 catches weston-test-runner's exit code and uses it as an exit code,
 which is what automake will see and use.

All 6 patches applied, thanks.

Kristian

 
 Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk
 ---
  tests/weston-test-client-helper.c |  8 +---
  tests/weston-test-runner.c| 41 
 ---
  tests/weston-test.c   |  6 ++
  3 files changed, 41 insertions(+), 14 deletions(-)
 
 diff --git a/tests/weston-test-client-helper.c 
 b/tests/weston-test-client-helper.c
 index 399aa44..186b395 100644
 --- a/tests/weston-test-client-helper.c
 +++ b/tests/weston-test-client-helper.c
 @@ -505,9 +505,11 @@ skip(const char *fmt, ...)
   vfprintf(stderr, fmt, argp);
   va_end(argp);
  
 - /* automake tests uses exit code 77, but we don't have a good
 -  * way to make weston exit with that from here. */
 - exit(0);
 + /* automake tests uses exit code 77. weston-test-runner will see
 +  * this and use it, and then weston-test's sigchld handler (in the
 +  * weston process) will use that as an exit status, which is what
 +  * automake will see in the end. */
 + exit(77);
  }
  
  static void
 diff --git a/tests/weston-test-runner.c b/tests/weston-test-runner.c
 index 4274b39..ef45bae 100644
 --- a/tests/weston-test-runner.c
 +++ b/tests/weston-test-runner.c
 @@ -32,6 +32,8 @@
  #include signal.h
  #include weston-test-runner.h
  
 +#define SKIP 77
 +
  extern const struct weston_test __start_test_section, __stop_test_section;
  
  static const struct weston_test *
 @@ -67,6 +69,7 @@ static int
  exec_and_report_test(const struct weston_test *t, void *test_data, int 
 iteration)
  {
   int success = 0;
 + int skip = 0;
   int hardfail = 0;
   siginfo_t info;
  
 @@ -91,6 +94,8 @@ exec_and_report_test(const struct weston_test *t, void 
 *test_data, int iteration
   fprintf(stderr, exit status %d, info.si_status);
   if (info.si_status == EXIT_SUCCESS)
   success = 1;
 + else if (info.si_status == SKIP)
 + skip = 1;
   break;
   case CLD_KILLED:
   case CLD_DUMPED:
 @@ -106,7 +111,10 @@ exec_and_report_test(const struct weston_test *t, void 
 *test_data, int iteration
   if (success  !hardfail) {
   fprintf(stderr, , pass.\n);
   return 1;
 - } else { 
 + } else if (skip) {
 + fprintf(stderr, , skip.\n);
 + return SKIP;
 + } else {
   fprintf(stderr, , fail.\n);
   return 0;
   }
 @@ -114,13 +122,16 @@ exec_and_report_test(const struct weston_test *t, void 
 *test_data, int iteration
  
  /* Returns number of tests and number of pass / fail in param args */
  static int
 -iterate_test(const struct weston_test *t, int *passed)
 +iterate_test(const struct weston_test *t, int *passed, int *skipped)
  {
 - int i;
 + int ret, i;
   void *current_test_data = (void *) t-table_data;
   for (i = 0; i  t-n_elements; ++i, current_test_data += 
 t-element_size)
   {
 - if (exec_and_report_test(t, current_test_data, i))
 + ret = exec_and_report_test(t, current_test_data, i);
 + if (ret == SKIP)
 + ++(*skipped);
 + else if (ret)
   ++(*passed);
   }
  
 @@ -132,6 +143,7 @@ int main(int argc, char *argv[])
   const struct weston_test *t;
   int total = 0;
   int pass = 0;
 + int skip = 0;
  
   if (argc == 2) {
   const char *testname = argv[1];
 @@ -149,19 +161,26 @@ int main(int argc, char *argv[])
   exit(EXIT_FAILURE);
   }
  
 - int number_passed_in_test = 0;
 - total += iterate_test(t, number_passed_in_test);
 + int number_passed_in_test = 0, number_skipped_in_test = 0;
 + total += iterate_test(t, number_passed_in_test, 
 number_skipped_in_test);
   pass += number_passed_in_test;
 + skip += number_skipped_in_test;
   } else {
   for (t = __start_test_section; t  __stop_test_section; t++) {
 - int number_passed_in_test = 0;
 - total += iterate_test(t, number_passed_in_test);
 + int number_passed_in_test = 0, number_skipped_in_test = 
 0;
 + total += iterate_test(t, number_passed_in_test, 
 number_skipped_in_test);
   

Re: [PATCH weston v2 6/6] tests: Properly report skipped tests

2014-02-07 Thread Pekka Paalanen
On Fri,  7 Feb 2014 09:34:48 +0100
Emilio Pozuelo Monfort poch...@gmail.com wrote:

 From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk
 
 We were calling exit(0) when tests were skipped, which counted
 them as passed instead of skipped. Fix this by properly exiting
 with 77 (which is what automake expects for skipped tests) from
 the tests themselves, then returning 77 again from weston-test-runner
 if all the tests were skipped. Finally the weston-test.so module
 catches weston-test-runner's exit code and uses it as an exit code,
 which is what automake will see and use.
 
 Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk

Hi,

I tested this v2 series and it looks good. Tried both the default
(headless) and the x11 backends.

The xwayland test hangs, but it hangs also before these changes. I
doubt it is caused by my xwayland setup, because I can run xterm via
xwayland on compositor-x11 just fine.

'make check' works fine with xwayland test disabled, but I cannot have
'make distcheck' pass, because it hangs on xwayland.

The buffer-count test is skipped correctly, if egl_gallium is not
available.

If egl_gallium is built in Mesa, then buffer-count test fails with
buffers used = 0. This happens because the headless backend does not
initialize the server side EGL, wl_drm global is never created, and the
client side EGL then falls back to software rendering, which is only
possible with egl_gallium. Obviously no wl_drm buffers will be used.

On x11 backend, buffer-count test succeeds, because wl_drm is
advertised, intel driver cannot load on egl_gallium so it falls back to
egl_dri2, and it ends up working. But presumably only on the intel
driver, since nouveau and radeon can load on egl_gallium, and I suspect
egl_gallium might not have the latest buffer management algorithm.

All in all, this series is reviewed and tested by me; ok to merge.

Neil, do you have suggestions on improving the buffer-count test?


Thanks,
pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel