blob: c1c67c7c86e084e7a13e4e095de1b8d3ccebdadc [file] [log] [blame]
--- piglit/framework/exectest.py 2013-01-17 16:03:17.677165077 -0800
+++ piglit/framework/exectest.py 2013-01-17 17:17:40.666633122 -0800
@@ -40,6 +40,13 @@
#############################################################################
class ExecTest(Test):
+
+ # Variables for tracking hangs and hardware acceleration status.
+ software = False
+ glxinfo = ''
+ hangs = {}
+ _HANGCHECK = 'drm:i915_hangcheck_elapsed'
+
def __init__(self, command):
Test.__init__(self)
self.command = command
@@ -56,6 +63,39 @@
return out
def run(self, valgrind):
+ print "Command: "
+ print self.command
+ # Check if we are on software rendering (considered unrecoverable).
+ if not self.software:
+ cmd = 'DISPLAY=:0 glxinfo | grep "OpenGL renderer string"'
+ proc = subprocess.Popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ shell=True
+ )
+ self.glxinfo = proc.communicate()[0]
+ if 'llvmpipe' in self.glxinfo.lower() or 'soft' in self.glxinfo.lower():
+ self.software = True
+ # Don't run test if we are on software rendering.
+ if self.software:
+ results = {}
+ results['result'] = 'skip'
+ results['note'] = self.glxinfo
+ print "Results:"
+ print results
+ return results
+ # Make a dictionary of all hangs we have seen so far.
+ cmd = 'dmesg | grep "' + self._HANGCHECK + '"'
+ proc = subprocess.Popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ shell=True
+ )
+ dmesg = proc.communicate()[0]
+ for line in dmesg.split('\n'):
+ if self._HANGCHECK in line:
+ self.hangs[line] = line
+
fullenv = os.environ.copy()
for e in self.env:
fullenv[e] = str(self.env[e])
@@ -159,6 +199,21 @@
if 'result' not in results:
results['result'] = 'skip'
+ # Check for GPU hangs again and report the new ones.
+ cmd = 'dmesg | grep "' + self._HANGCHECK + '"'
+ proc = subprocess.Popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ shell=True
+ )
+ dmesg = proc.communicate()[0]
+ for line in dmesg.split('\n'):
+ if self._HANGCHECK in line:
+ if not line in self.hangs.keys():
+ results['note'] = 'Saw GPU hang during test. ' + line
+
+ print "Results:"
+ print results
return results
def check_for_skip_scenario(self, command):