[Intel-gfx] [PATCH i-g-t] lib: don't abort if forcing the connector state fails

Chris Wilson chris at chris-wilson.co.uk
Tue Jul 29 13:22:21 CEST 2014


On Mon, Jul 28, 2014 at 05:34:55PM +0200, Daniel Vetter wrote:
> On Mon, Jul 28, 2014 at 04:24:49PM +0100, Thomas Wood wrote:
> > Ensure tests using igt_enable_connectors can still run even if the
> > relevant debugfs files are not available.
> > 
> > Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> > ---
> >  lib/igt_kms.c | 19 ++++++++++++++-----
> >  lib/igt_kms.h |  2 +-
> >  2 files changed, 15 insertions(+), 6 deletions(-)
> > 
> > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > index 20370a9..740b5dd 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -429,9 +429,11 @@ static char* get_debugfs_connector_path(int drm_fd, drmModeConnector *connector,
> >   * @state: state to force on @connector
> >   *
> >   * Force the specified state on the specified connector.
> > + *
> > + * Returns: true on success
> >   */
> > -void kmstest_force_connector(int drm_fd, drmModeConnector *connector, enum
> > -			     kmstest_force_connector_state state)
> > +bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
> > +			     enum kmstest_force_connector_state state)
> >  {
> >  	char *path;
> >  	const char *value;
> > @@ -458,12 +460,15 @@ void kmstest_force_connector(int drm_fd, drmModeConnector *connector, enum
> >  	debugfs_fd = open(path, O_WRONLY | O_TRUNC);
> >  	free(path);
> >  
> > -	igt_assert(debugfs_fd != -1);
> > +	if (debugfs_fd == -1) {
> > +		return false;
> > +	}
> 
> Aside: We have some neat debugfs helpers in igt_debugfs.c. Might convert
> over to them while at it.

Aside: they are not that neat... :p I felt restricted that I couldn't open
the right debugfs for an fd I had - the assumption of the singleton is
too prescriptive. 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list