[Piglit] [PATCH 1/2] egl/utils: Prepare egl_util_run to be called from piglit subtests.

Sarah Sharp sarah.a.sharp at linux.intel.com
Tue Apr 22 18:29:46 PDT 2014


On Sat, Apr 19, 2014 at 12:20:26PM -0700, Chad Versace wrote:
> On Fri, Apr 18, 2014 at 03:37:38PM -0700, Sarah Sharp wrote:
> > +	eglMakeCurrent(state.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, state.ctx);
> > +	XDestroyWindow(state.dpy, state.win);
> > +destroy_ctx:
> > +	eglMakeCurrent(state.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
> > +	eglDestroyContext(state.egl_dpy, state.ctx);
> >  	eglTerminate(state.egl_dpy);
> > -
> > -	piglit_report_result(result);
> > -
> > -	return EXIT_SUCCESS;
> > +fail:
> > +	if (test->stop_on_failure)
> > +		piglit_report_result(test->result);
> > +	if (test->result == PIGLIT_PASS)
> > +		return EXIT_SUCCESS;
> > +	return EXIT_FAILURE;
> 
> I tried to convince myself that the above cleanup was correct, but I got
> dizzy. By consolidating the destroy_window and destroy_ctx into the fail
> label, I think you can achieve more concise code that's more easily
> verifiable.
> 
> fail:
>     if (state.egl_dpy) {
>         eglMakeCurrent(state.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
>         eglTerminate(state.egl_dpy);
>     }
>     if (state.win)
>         XDestroyWindow(state.win);
>     if (test->stop_on_failure)
>     	piglit_report_result(test->result);
>     if (test->result == PIGLIT_PASS)
>     	return EXIT_SUCCESS;
>     return EXIT_FAILURE;

Hmm, I tried changing the error cleanup to this code, and the tests do
pass.  However, I see the odd behavior I was seeing before Rob helped me
debug the code where the windows from the first and second subtest
persist, until after the third subtest completes and
piglit_report_result is called.

However, moving the eglTerminate call after the XDestroyWindow call
makes the windows close as expected.  Any idea as to what's going on?

Sarah Sharp


More information about the Piglit mailing list