[Piglit] [PATCH 09/42] dmesg_tests.py: fixed privliged test generator to actually work.

Dylan Baker baker.dylan.c at gmail.com
Wed Apr 22 15:09:58 PDT 2015


Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/dmesg_tests.py | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/framework/tests/dmesg_tests.py b/framework/tests/dmesg_tests.py
index 4773a49..61c5dcf 100644
--- a/framework/tests/dmesg_tests.py
+++ b/framework/tests/dmesg_tests.py
@@ -30,8 +30,11 @@ import os
 import sys
 import subprocess
 import re
-import json
 
+try:
+    import simplejson as json
+except ImportError:
+    import json
 import nose.tools as nt
 from nose.plugins.skip import SkipTest
 
@@ -70,6 +73,20 @@ def _write_dev_kmesg():
         raise SkipTest("Writing to the ringbuffer failed")
 
 
+def privileged_generator(func):
+    """Like utils.nose_generator, but for privileged tests.
+
+    This makes the tests yielded privlileged, which means using '-e sudo' will
+    exclude them
+    
+    """
+    def sudo_test_wrapper(*args, **kwargs):
+        for x in func(*args, **kwargs):
+            yield x
+
+    return sudo_test_wrapper
+
+
 class DummyJsonWriter(object):
     """ A very simple dummy for json writer """
     def __init__(self):
@@ -329,12 +346,12 @@ def test_json_serialize_updated_result():
     encoder.encode(result)
 
 
- at utils.privileged_test
- at utils.nose_generator
+ at privileged_generator
 def test_testclasses_dmesg():
     """ Generator that creates tests for """
-    lists = [(framework.test.PiglitTest,
-              ['attribs', '-auto', '-fbo'], 'PiglitTest'),
+    lists = [(framework.test.PiglitGLTest, ['attribs'], 'PiglitGLTest'),
+             (framework.test.PiglitCLTest,
+              ['cl-api-build-program'], 'PiglitCLTest'),
              (framework.test.GleanTest, 'basic', "GleanTest"),
              (framework.test.ShaderTest,
               'tests/shaders/loopfunc.shader_test', 'ShaderTest'),
-- 
2.3.5



More information about the Piglit mailing list