From: Ben Widawsky <ben-Egm8mFWDmf3k1uMJSBkQmQ@public.gmane.org>
To: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
Cc: piglit discussion list
<piglit-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
Intel Graphics Development
<intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] tests/igt: Add runtime environment checks
Date: Tue, 26 Nov 2013 11:49:43 -0800 [thread overview]
Message-ID: <20131126194942.GD27358@bwidawsk.net> (raw)
In-Reply-To: <20131126194619.GS27344-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
On Tue, Nov 26, 2013 at 08:46:19PM +0100, Daniel Vetter wrote:
> On Tue, Nov 26, 2013 at 11:05:57AM -0800, Ben Widawsky wrote:
> > On Tue, Nov 26, 2013 at 09:09:04AM +0100, Daniel Vetter wrote:
> > > This is one of the nice pieces that I've never ported from the old
> > > make based test runner. Note that we only use the result of the check
> > > when actually running the testcases so that enumerating tests still
> > > works as non-root on arbitrary machines.
> > >
> >
> > So does this bail on the first test, or does this run for all tests?
>
> It bails each test individually. Since otherwise enumerating them wouldn't
> work any more. I've hoped the commit message was clear about it.
It wasn't clear to me, though it seemed to be the case from the diff.
I'd prefer an early bail, and just check once, and ideally, not
generating a JSON file at all.
>
> > BTW, Damien said he had also implemented this.
>
> Only in the make target he created, not in piglit itself. Imo we should
> have all the testrunner logic in one place, i.e. in the piglit sources.
> -Daniel
Damien, can you comment? I could have sworn you said something different
on IRC. It sounded like exactly what I wanted.
>
> >
> > > Cc: Ben Widawsky <ben-Egm8mFWDmf3k1uMJSBkQmQ@public.gmane.org>
> > > Requested-by: Ben Widawsky <ben-Egm8mFWDmf3k1uMJSBkQmQ@public.gmane.org>
> > > Signed-off-by: Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>
> > > ---
> > > tests/igt.tests | 32 +++++++++++++++++++++++++++++++-
> > > 1 file changed, 31 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/tests/igt.tests b/tests/igt.tests
> > > index f3884925deaa..8d02c1a60255 100644
> > > --- a/tests/igt.tests
> > > +++ b/tests/igt.tests
> > > @@ -28,7 +28,7 @@ import sys
> > > import subprocess
> > >
> > > from os import path
> > > -from framework.core import testBinDir, TestProfile
> > > +from framework.core import testBinDir, TestProfile, TestResult
> > > from framework.exectest import ExecTest
> > >
> > > #############################################################################
> > > @@ -39,6 +39,24 @@ from framework.exectest import ExecTest
> > > ##### automatically add all tests into the 'igt' category.
> > > #############################################################################
> > >
> > > +def checkEnvironment():
> > > + debugfs_path = "/sys/kernel/debug/dri"
> > > + if os.getuid() != 0:
> > > + print "Test Environment check: not root!"
> > > + return False
> > > + if not os.path.isdir(debugfs_path):
> > > + print "Test Environment check: debugfs not mounted properly!"
> > > + return False
> > > + for subdir in os.listdir(debugfs_path):
> > > + clients = open(os.path.join(debugfs_path, subdir, "clients"), 'r')
> > > + lines = clients.readlines()
> > > + if len(lines) > 2:
> > > + print "Test Environment check: other drm clients running!"
> > > + return False
> > > +
> > > + print "Test Environment check: Succeeded."
> > > + return True
> > > +
> > > if not os.path.exists(os.path.join(testBinDir, 'igt')):
> > > print "igt symlink not found!"
> > > sys.exit(0)
> > > @@ -46,6 +64,8 @@ if not os.path.exists(os.path.join(testBinDir, 'igt')):
> > > # Chase the piglit/bin/igt symlink to find where the tests really live.
> > > igtTestRoot = path.join(path.realpath(path.join(testBinDir, 'igt')), 'tests')
> > >
> > > +igtEnvironmentOk = checkEnvironment()
> > > +
> > > profile = TestProfile()
> > >
> > > class IGTTest(ExecTest):
> > > @@ -54,6 +74,9 @@ class IGTTest(ExecTest):
> > > self.timeout = 60*20 # 20 minutes deadline by default
> > >
> > > def interpretResult(self, out, returncode, results, dmesg):
> > > + if not igtEnvironmentOk:
> > > + return out
> > > +
> > > if returncode == 0:
> > > results['result'] = 'dmesg-warn' if dmesg != '' else 'pass'
> > > elif returncode == 77:
> > > @@ -63,6 +86,13 @@ class IGTTest(ExecTest):
> > > return out
> > > def run(self, env):
> > > env.dmesg = True
> > > + if not igtEnvironmentOk:
> > > + results = TestResult()
> > > + results['result'] = 'skip'
> > > + results['info'] = unicode("Test Environment isn't OK")
> > > +
> > > + return results
> > > +
> > > return ExecTest.run(self, env)
> > >
> > > def listTests(listname):
> > > --
> > > 1.8.1.4
> > >
> >
> > --
> > Ben Widawsky, Intel Open Source Technology Center
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
Ben Widawsky, Intel Open Source Technology Center
next prev parent reply other threads:[~2013-11-26 19:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 8:09 [PATCH] tests/igt: Add runtime environment checks Daniel Vetter
2013-11-26 19:05 ` Ben Widawsky
[not found] ` <20131126190556.GB27358-Egm8mFWDmf3k1uMJSBkQmQ@public.gmane.org>
2013-11-26 19:46 ` Daniel Vetter
[not found] ` <20131126194619.GS27344-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2013-11-26 19:49 ` Ben Widawsky [this message]
2013-11-26 19:53 ` Damien Lespiau
[not found] ` <20131126195332.GC32421-q+Y1yDQJ1rKUyhp/hE4EWxL4W9x8LtSr@public.gmane.org>
2013-11-26 19:55 ` Daniel Vetter
[not found] ` <CAKMK7uEeyNShA8fAF82+prCgYTVd2G60GLVMCCVy56p2uRGeJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-11-26 20:02 ` Ben Widawsky
[not found] ` <20131126200238.GE27358-Egm8mFWDmf3k1uMJSBkQmQ@public.gmane.org>
2013-11-26 21:51 ` Daniel Vetter
[not found] ` <1385453344-25217-1-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2013-11-26 21:15 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131126194942.GD27358@bwidawsk.net \
--to=ben-egm8mfwdmf3k1umjsbkqmq@public.gmane.org \
--cc=daniel-/w4YWyX8dFk@public.gmane.org \
--cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=piglit-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox