summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2015-05-25 19:40:42 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2015-06-29 00:59:26 -0400
commite59e81fde566b114e48910e63a9d43501c00cee2 (patch)
tree855219408658e1a1a1dc98d32855d1f389da1f3e
parentc1e8dd0146bd5fb84ec66677304b83c830fc9c49 (diff)
gl-framework: always destroy gl context on exit
Currently a piglit_report_result in init (or earlier) would cause the framework to not get torn down. This ensures that the teardown happens on exit, which also enables usage of valgrind to detect memory leaks. This is a refinment of commit 121fb6b7d84 for winsys and commit 50402d6c7 which introduced the fbo framework. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r--tests/util/piglit-framework-gl.c8
-rw-r--r--tests/util/piglit-framework-gl/piglit_fbo_framework.c1
-rw-r--r--tests/util/piglit-framework-gl/piglit_winsys_framework.c1
3 files changed, 8 insertions, 2 deletions
diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 3539a5b73..1973dbcef 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -174,6 +174,13 @@ piglit_gl_process_args(int *argc, char *argv[],
}
+static void
+destroy(void)
+{
+ if (gl_fw->destroy)
+ gl_fw->destroy(gl_fw);
+}
+
void
piglit_gl_test_run(int argc, char *argv[],
const struct piglit_gl_test_config *config)
@@ -188,6 +195,7 @@ piglit_gl_test_run(int argc, char *argv[],
piglit_report_result(PIGLIT_FAIL);
}
+ atexit(destroy);
gl_fw->run_test(gl_fw, argc, argv);
assert(false);
}
diff --git a/tests/util/piglit-framework-gl/piglit_fbo_framework.c b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
index 8f4a19df2..456cf7eb1 100644
--- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
@@ -50,7 +50,6 @@ run_test(struct piglit_gl_framework *gl_fw,
gl_fw->test_config->init(argc, argv);
if (gl_fw->test_config->display)
result = gl_fw->test_config->display();
- gl_fw->destroy(gl_fw);
piglit_report_result(result);
}
diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
index d9a40eba6..c80e97287 100644
--- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
@@ -78,7 +78,6 @@ run_test(struct piglit_gl_framework *gl_fw,
if (gl_fw->test_config->display)
result = gl_fw->test_config->display();
- gl_fw->destroy(gl_fw);
piglit_report_result(result);
}