[Piglit] [PATCH 08/14] egl_khr_fence_sync: allow skipping display_bound_in_other_thread subtest

Vinson Lee vlee at freedesktop.org
Mon Apr 27 21:40:35 PDT 2015


On Mon, Apr 13, 2015 at 11:28 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Daniel Kurtz <djkurtz at chromium.org>
>
> This test strives to avoid false passes, but misses an important one:
> If either thread cannot create a second display it will return PIGLIT_SKIP.
>
> However, piglit_merge_result(PASS, SKIP) or piglit_merge_result(SKIP, PASS)
> throws away the SKIP and returns PASS.  For this test, we really want to
> return SKIP if either thread returns SKIP.
>
> Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
> ---
>  tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c b/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c
> index 4fb1ccd..e6447bc 100644
> --- a/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c
> +++ b/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c
> @@ -1199,7 +1199,7 @@ cleanup:
>  static enum piglit_result
>  test_eglCreateSyncKHR_with_display_bound_in_other_thread(void *test_data)
>  {
> -       enum piglit_result result = PIGLIT_PASS;
> +       enum piglit_result result;
>         enum piglit_result *t2_result = NULL;
>         bool orig_print_tid;
>         pthread_t thread2;
> @@ -1236,7 +1236,15 @@ test_eglCreateSyncKHR_with_display_bound_in_other_thread(void *test_data)
>         }
>
>         if (t2_result) {
> -               piglit_merge_result(&result, *t2_result);
> +               /*
> +                * If either thread SKIPs, then SKIP the test.
> +                * Otherwise do a merge to return possible ERROR/WARN.
> +                */
> +               if ((result == PIGLIT_PASS && *t2_result == PIGLIT_SKIP) ||
> +                   (result == PIGLIT_SKIP && *t2_result == PIGLIT_PASS))
> +                       result = PIGLIT_SKIP;
> +               else
> +                       piglit_merge_result(&result, *t2_result);
>         } else {
>                 piglit_loge("thread %"PRIuMAX" returned no piglit_result",
>                             (uintmax_t) thread2);
> --
> 2.1.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


This patch introduced this Coverity defect.


** CID 1295429:  Control flow issues  (DEADCODE)
/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c: 1197 in
test_eglCreateSyncKHR_with_display_bound_in_other_thread()

________________________________________________________________________________________________________
*** CID 1295429:  Control flow issues  (DEADCODE)
/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c: 1197 in
test_eglCreateSyncKHR_with_display_bound_in_other_thread()
1191
1192            if (t2_result) {
1193                    /*
1194                     * If either thread SKIPs, then SKIP the test.
1195                     * Otherwise do a merge to return possible ERROR/WARN.
1196                     */
>>>     CID 1295429:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach the expression "*t2_result == PIGLIT_PASS" inside this statement: "if ((result == PIGLIT_PASS ...".
1197                    if ((result == PIGLIT_PASS && *t2_result ==
PIGLIT_SKIP) ||
1198                        (result == PIGLIT_SKIP && *t2_result ==
PIGLIT_PASS))
1199                            result = PIGLIT_SKIP;
1200                    else
1201                            piglit_merge_result(&result, *t2_result);
1202            } else {


More information about the Piglit mailing list