[Piglit] [PATCH v2 07/16] tests/oglconform.py: Use new error handling code

Dylan Baker baker.dylan.c at gmail.com
Mon May 18 10:57:41 PDT 2015


This uses the new exceptions and new PiglitConfig methods.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/integration_tests.py | 7 ++++++-
 tests/oglconform.py                  | 9 ++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/framework/tests/integration_tests.py b/framework/tests/integration_tests.py
index ac0e31c..664fad1 100644
--- a/framework/tests/integration_tests.py
+++ b/framework/tests/integration_tests.py
@@ -32,7 +32,7 @@ import ConfigParser
 
 from nose.plugins.skip import SkipTest
 
-from framework import core
+from framework import core, exceptions
 
 
 def setup_module():
@@ -50,9 +50,14 @@ def _import(name):
     """
     try:
         return importlib.import_module(name)
+    except exceptions.PiglitFatalError:
+        raise SkipTest('The module experienced a fatal error. '
+                       'This may be expected.')
     except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
+        # FIXME: This is a legacy path
         raise SkipTest('No config section for {}'.format(name))
     except SystemExit as e:
+        # FIXME: This is a legacy path
         if e.code == 0:
             # This means that it's a normal operation, but not that it's a pass
             raise SkipTest('Profile exited normally.')
diff --git a/tests/oglconform.py b/tests/oglconform.py
index f2e161e..4ec127e 100644
--- a/tests/oglconform.py
+++ b/tests/oglconform.py
@@ -23,19 +23,18 @@
 
 import os
 import re
-import sys
 import subprocess
 
-import framework.grouptools as grouptools
-import framework.core
+from framework import grouptools, exceptions, core
 from framework.profile import TestProfile, Test
 
 __all__ = ['profile']
 
-bin_oglconform = framework.core.PIGLIT_CONFIG.get('oglconform', 'path')
+bin_oglconform = core.PIGLIT_CONFIG.required_get('oglconform', 'path')
 
 if not os.path.exists(bin_oglconform):
-    sys.exit(0)
+    raise exceptions.PiglitFatalError(
+        'Cannot find binary {}'.format(bin_oglconform))
 
 profile = TestProfile()
 
-- 
2.4.0



More information about the Piglit mailing list