summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2015-01-17 22:07:42 -0800
committerDylan Baker <baker.dylan.c@gmail.com>2015-03-09 10:23:39 -0700
commit9526a4f3c757b8d5b7a2734b312a7c44e6508409 (patch)
tree3bec2c6a64edee65ab0eb00cc90c811b877cdc50
parentf982947b4b9df06aa7504333803be60113cf9534 (diff)
igt.py: add docstrings.
In some cases this is really just about formatting. v3: - remove accidental whitespace insertion (Ian) v4: - Update the module docstring to be accurate after commit 443abf5 (Thomas) v5: - Fix small typo (Thomas) Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com> Reviewed-by: Thomas Wood <thomas.wood@intel.com>
-rw-r--r--tests/igt.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/tests/igt.py b/tests/igt.py
index 743ccb2e0..a144cddf0 100644
--- a/tests/igt.py
+++ b/tests/igt.py
@@ -22,6 +22,16 @@
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
+"""Integration for running intel-gpu-tools with the piglit framework.
+
+To use this either configure piglit.conf's [igt] section, or set IGT_TEST_ROOT
+to the root of a built igt directory.
+
+This will stop if you are not running as root, or if there are other users of
+drm. Even if you have rendernode support enabled.
+
+"""
+
import os
import re
import sys
@@ -33,16 +43,13 @@ from framework.profile import TestProfile, Test
__all__ = ['profile']
-#############################################################################
-##### IGTTest: Execute an intel-gpu-tools test
-#####
-##### To use this, create an igt symlink in piglit/bin which points to the root
-##### of the intel-gpu-tools sources with the compiled tests. Piglit will
-##### automatically add all tests into the 'igt' category.
-#############################################################################
-
def check_environment():
+ """Check that the environment that piglit is running in is appropriate.
+
+ IGT requires root, debugfs to be mounted, and to be the only drm client.
+
+ """
debugfs_path = "/sys/kernel/debug/dri"
if os.getuid() != 0:
print "Test Environment check: not root!"
@@ -78,15 +85,17 @@ if not (os.path.exists(os.path.join(IGT_TEST_ROOT, 'single-tests.txt'))
class IGTTestProfile(TestProfile):
- """ Test profile for intel-gpu-tools tests. """
+ """Test profile for intel-gpu-tools tests."""
def _pre_run_hook(self):
if not check_environment():
sys.exit(1)
+
profile = IGTTestProfile() # pylint: disable=invalid-name
class IGTTest(Test):
+ """Test class for running libdrm."""
def __init__(self, binary, arguments=None):
if arguments is None:
arguments = []
@@ -107,6 +116,7 @@ class IGTTest(Test):
def list_tests(listname):
+ """Parse igt test list and return them as a list."""
with open(os.path.join(IGT_TEST_ROOT, listname + '.txt'), 'r') as f:
lines = (line.rstrip() for line in f.readlines())
@@ -123,6 +133,7 @@ def list_tests(listname):
def add_subtest_cases(test):
+ """Get subtest instances."""
proc = subprocess.Popen(
[os.path.join(IGT_TEST_ROOT, test), '--list-subtests'],
stdout=subprocess.PIPE,