[Piglit] [Patch v2 6/8] igt.py: add docstrings.

Thomas Wood thomas.wood at intel.com
Wed Jan 28 03:37:23 PST 2015


On 26 January 2015 at 19:28, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> In some cases this is really just about formatting.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  tests/igt.py | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)
>
> diff --git a/tests/igt.py b/tests/igt.py
> index b7ee165..4a46fb0 100644
> --- a/tests/igt.py
> +++ b/tests/igt.py
> @@ -22,6 +22,14 @@
>  # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>  # DEALINGS IN THE SOFTWARE.
>
> +"""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.

The symlink instructions are actually no longer valid (since commit
443abf5 igt: use piglit.conf instead of a symlink). The configuration
file should be used instead, or the IGT_TEST_ROOT environment variable
can be set to point to the tests.


> +
> +"""
> +
>  import os
>  import re
>  import sys
> @@ -33,16 +41,14 @@ 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 appropraite.

Small typo in "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!"
> @@ -77,11 +83,11 @@ if not (os.path.exists(os.path.join(IGT_TEST_ROOT, 'single-tests.txt'))
>      sys.exit(0)
>
>  IGT_ENVIRONMENT_OK = check_environment()
> -
>  profile = TestProfile()  # pylint: disable=invalid-name
>
>
>  class IGTTest(Test):
> +    """Test class for running libdrm."""
>      def __init__(self, binary, arguments=None):
>          if arguments is None:
>              arguments = []
> @@ -112,6 +118,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())
>
> @@ -130,6 +137,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,
> --
> 2.2.2
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list