[Piglit] [PATCH 20/20] framework: Kill tests running for more than an hour [Python 3.3+ only]

Jon Severinsson jon at severinsson.net
Fri Apr 12 16:40:02 PDT 2013


These are most likely either hung or stuck in an infinite loop.
---
 framework/exectest.py |   14 ++++++++++++--
 1 fil ändrad, 12 tillägg(+), 2 borttagningar(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index 02e1c73..a410817 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -110,7 +110,8 @@ class ExecTest(Test):
 				results['note'] = 'Returncode was {0}'.format(results['returncode'])
 			elif results['returncode'] < 0:
 				results['note'] = 'Terminated by signal {0}'.format(-results['returncode'])
-				results['result'] = 'crash'
+				if results['result'] != 'timeout':
+					results['result'] = 'crash'
 
 			if valgrind:
 				# If the underlying test failed, simply report
@@ -156,7 +157,16 @@ class ExecTest(Test):
 				env=fullenv,
 				universal_newlines=True
 				)
-			out, err = proc.communicate()
+			if sys.hexversion < 0x030300F0:
+				# Old python version, timeout not supported
+				out, err = proc.communicate()
+			else:
+				try:
+					out, err = proc.communicate(timeout=3600)
+				except subprocess.TimeoutExpired:
+					proc.kill()
+					out, err = proc.communicate()
+					results['result'] = 'timeout'
 			results['returncode'] = proc.returncode
 
 			# In Python 2.x proc.communicate() returns 8-bit strings,
-- 
1.7.10.4



More information about the Piglit mailing list