Commit 4d2172bf authored by Dylan Baker's avatar Dylan Baker
Browse files

framework/ Drop PIGLIT_DEBUG

Previously a stack trace would be suppressed in all instances unless
the PIGLIT_DEBUG environment variable was truthy. This was suboptimal
for a number of reasons.

This patch removes that functionality, now only a subset of piglit
specific exceptions that are meant to be suppressed are. All other
exceptions are directly raised, stopping the runner immediately. Other
piglit specific exceptions have been extended to have custom error
messages rather than relying on the handler to add them.

v2: - remove unit tests that no longer apply

Reviewed-by: Jose Fonseca <> (v1)
Signed-off-by: default avatarDylan Baker <>
parent b39955a2
......@@ -21,7 +21,6 @@
"""Exception and error classes for piglit, and exception handlers."""
from __future__ import print_function, absolute_import, division
import os
import sys
import functools
......@@ -32,8 +31,6 @@ __all__ = [
_DEBUG = bool(os.environ.get('PIGLIT_DEBUG', False))
def handler(func):
"""Decorator function for handling errors in an entry point.
......@@ -51,22 +48,6 @@ def handler(func):
except PiglitFatalError as e:
print('Fatal Error: {}'.format(str(e)), file=sys.stderr)
except (PiglitInternalError, PiglitException) as e:
print('Warning: An internal exception that should have '
'been handled was not. This is bug and should be reported.\n'
'BUG: {}'.format(str(e)),
if _DEBUG:
except Exception as e: # pylint: disable=broad-except
print('Warning: A python exception that should have '
'been handled was not. This is bug and should be reported.\n'
'BUG: {}'.format(str(e)),
if _DEBUG:
return _inner
......@@ -78,6 +59,9 @@ class PiglitException(Exception):
uncaught that is a bug in piglit.
def __str__(self):
return ('An internal exception that should have been handled was not:'
'\n{}'.format(super(PiglitException, self).__str__()))
class PiglitInternalError(Exception):
......@@ -86,6 +70,9 @@ class PiglitInternalError(Exception):
These should always be handled.
def __str__(self):
return 'An internal error occured:\n{}'.format(
super(PiglitInternalError, self).__str__())
class PiglitFatalError(Exception):
......@@ -34,27 +34,3 @@ from framework import exceptions
def test_handle_PiglitFatalError():
"""exceptions.handler: Handles PiglitFatalError"""
raise exceptions.PiglitFatalError
def test_handle_PiglitInternalError():
"""exceptions.handler: Handles PiglitInternalError"""
raise exceptions.PiglitInternalError
def test_handle_PiglitException():
"""exceptions.handler: Handles PiglitException"""
raise exceptions.PiglitException
def test_handle_Exception():
"""exceptions.handler: Handles Exception"""
raise Exception
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment