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 <bri...@vmware.com>
CC: Timothy Arceri <tarc...@itsqueeze.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108819
Signed-off-by: Sergii Romantsov <sergii.romant...@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

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to