[Piglit] [PATCH v1 1/2] piglit-framework-gl: add possibility to deinit test

Sergii Romantsov sergii.romantsov at gmail.com
Thu Jan 3 09:27:46 UTC 2019


Hello,
is there any chance to get review?
In the goal is idea to get a simple mechanism to control resources freeing
(any extra memory allocations, files etc.) of any piglit-test on the exit.

On Wed, Nov 21, 2018 at 12:18 PM Sergii Romantsov <
sergii.romantsov at gmail.com> wrote:

> Each test can be initialized ('init') and displayed ('dipslay').
> During initialization can be allocated resources.
> But there is no common unified mechanism to free resources on test
> finishing, except, probably, registaration of callabck with 'atexit'.
>
> To the piglit-configuration added callback-function 'deinit' that
> will be called on the test end.
>
> CC: Brian Paul <brianp at vmware.com>
> CC: Timothy Arceri <tarceri at itsqueeze.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108819
> Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
> ---
>  tests/util/piglit-framework-gl.h                     | 3 +++
>  tests/util/piglit-framework-gl/piglit_gl_framework.c | 2 ++
>  2 files changed, 5 insertions(+)
>
> diff --git a/tests/util/piglit-framework-gl.h
> b/tests/util/piglit-framework-gl.h
> index a4ecddb..2dfbad2 100644
> --- a/tests/util/piglit-framework-gl.h
> +++ b/tests/util/piglit-framework-gl.h
> @@ -192,6 +192,9 @@ struct piglit_gl_test_config {
>         enum piglit_result
>         (*display)(void);
>
> +       void
> +       (*deinit)(void);
> +
>         /**
>          * List of subtests supported by this test case
>          *
> diff --git a/tests/util/piglit-framework-gl/piglit_gl_framework.c
> b/tests/util/piglit-framework-gl/piglit_gl_framework.c
> index 37c0677..bdb9dbd 100644
> --- a/tests/util/piglit-framework-gl/piglit_gl_framework.c
> +++ b/tests/util/piglit-framework-gl/piglit_gl_framework.c
> @@ -116,5 +116,7 @@ piglit_gl_framework_init(struct piglit_gl_framework
> *gl_fw,
>  void
>  piglit_gl_framework_teardown(struct piglit_gl_framework *gl_fw)
>  {
> +       if (gl_fw->test_config->deinit)
> +               gl_fw->test_config->deinit();
>         return;
>  }
> --
> 2.7.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20190103/c76f3d0b/attachment-0001.html>


More information about the Piglit mailing list