[Piglit] [PATCH 1/5] util: move SUBTEST and SUBTESTCONDITION to piglit-util

Anuj Phogat anuj.phogat at gmail.com
Fri Feb 3 02:29:37 UTC 2017


On Wed, Jan 11, 2017 at 1:46 PM, Alejandro PiƱeiro <apinheiro at igalia.com> wrote:
> Defined on dsa-utils.h. Plan to use on other tests.
> ---
>  tests/spec/arb_direct_state_access/dsa-utils.h | 16 ----------------
>  tests/util/piglit-util.h                       | 23 +++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 16 deletions(-)
>
> diff --git a/tests/spec/arb_direct_state_access/dsa-utils.h b/tests/spec/arb_direct_state_access/dsa-utils.h
> index 1f84f95..cd6c56b 100644
> --- a/tests/spec/arb_direct_state_access/dsa-utils.h
> +++ b/tests/spec/arb_direct_state_access/dsa-utils.h
> @@ -39,22 +39,6 @@ extern "C" {
>
>  #include "piglit-util-gl.h"
>
> -#define SUBTEST(error, global, ...) \
> -do { \
> -       bool local = piglit_check_gl_error((error)); \
> -       global = global && local; \
> -       piglit_report_subtest_result(local ? PIGLIT_PASS : PIGLIT_FAIL, \
> -                                    __VA_ARGS__); \
> -} while (0)
> -
> -#define SUBTESTCONDITION(condition, global, ...) \
> -do { \
> -       bool cond = (condition); \
> -       global = global && cond; \
> -       piglit_report_subtest_result(cond ? PIGLIT_PASS : PIGLIT_FAIL, \
> -                                    __VA_ARGS__); \
> -} while (0)
> -
>  GLuint dsa_create_program(GLenum target);
>
>  void dsa_texture_with_unit(GLuint prog, GLuint unit);
> diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
> index ec580df..550b14c 100644
> --- a/tests/util/piglit-util.h
> +++ b/tests/util/piglit-util.h
> @@ -185,6 +185,29 @@ piglit_run_selected_subtests(const struct piglit_subtest *all_subtests,
>  #define MAX2(a, b) ((a) > (b) ? (a) : (b))
>  #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
>
> +/**
> + * Utility macro that checks for a given opengl error, and report a
> + * subtest result.
> + */
> +#define SUBTEST(error, global, ...) \
> +do { \
> +       bool local = piglit_check_gl_error((error)); \
> +       global = global && local; \
> +       piglit_report_subtest_result(local ? PIGLIT_PASS : PIGLIT_FAIL, \
> +                                    __VA_ARGS__);                      \
> +} while (0)
> +
> +/**
> + * Utility macro that checks for a given condition, and report a
> + * subtest result.
> + */
> +#define SUBTESTCONDITION(condition, global, ...) \
> +do { \
> +       bool cond = (condition); \
> +       global = global && cond; \
> +       piglit_report_subtest_result(cond ? PIGLIT_PASS : PIGLIT_FAIL, \
> +                                    __VA_ARGS__);                     \
> +} while (0)
>
>  static inline unsigned
>  log2u(unsigned v)
> --
> 2.9.3
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit

How about changing the names of macros to:
PIGLIT_SUBTEST_ERROR and PIGLIT_SUBTEST_CONDITION ?
They go well with piglit's global naming conventions.

I'm fine with the patch otherwise. With the suggested change, patch is:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the Piglit mailing list