[Piglit] [PATCH 09/35] tests: use BuiltInConstantsClass

2018-04-04 Thread Dylan Baker
---
 tests/all.py | 55 ++---
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index fe4a14c..a50a4c3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -21,7 +21,7 @@ from framework.driver_classifier import DriverClassifier
 from framework.test import (PiglitGLTest, PiglitBaseTest,
 GLSLParserTest, GLSLParserNoConfigError)
 from framework.test.shader_test import ShaderTest, MultiShaderTest
-from framework.test.piglit_test import ASMParserTest
+from framework.test.piglit_test import ASMParserTest, BuiltInConstantsTest
 from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
 
 __all__ = ['profile']
@@ -1224,11 +1224,10 @@ with profile.test_list.group_manager(
 
 # Group spec/glsl-es-1.00
 with profile.test_list.group_manager(
-PiglitGLTest,
+BuiltInConstantsTest,
 grouptools.join('spec', 'glsl-es-1.00')) as g:
 g(['built-in-constants_gles2',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-es-1.00',
-'minimum-maximums.txt')],
+   os.path.join(TESTS_DIR, 'spec', 'glsl-es-1.00', 
'minimum-maximums.txt')],
   'built-in constants')
 
 # Group spec/glsl-1.10
@@ -1262,7 +1261,7 @@ with profile.test_list.group_manager(
   'simple {} {}'.format(type_, arrayspec))
 
 with profile.test_list.group_manager(
-PiglitGLTest,
+BuiltInConstantsTest,
 grouptools.join('spec', 'glsl-1.10')) as g:
 g(['built-in-constants',
os.path.join(TESTS_DIR, 'spec', 'glsl-1.10', 'minimum-maximums.txt')],
@@ -1280,7 +1279,8 @@ with profile.test_list.group_manager(
 g(['glsl-1.20-getactiveuniform-constant'])
 g(['built-in-constants',
os.path.join(TESTS_DIR, 'spec', 'glsl-1.20', 'minimum-maximums.txt')],
-  'built-in constants')
+  'built-in constants',
+  override_class=BuiltInConstantsTest)
 
 with profile.test_list.group_manager(
 PiglitGLTest,
@@ -1381,7 +1381,8 @@ with profile.test_list.group_manager(
 g(['glsl-1.30-texel-offset-limits'], 'texel-offset-limits')
 g(['built-in-constants',
os.path.join(TESTS_DIR, 'spec', 'glsl-1.30', 'minimum-maximums.txt')],
-  'built-in constants')
+  'built-in constants',
+   override_class=BuiltInConstantsTest)
 
 with profile.test_list.group_manager(
 PiglitGLTest,
@@ -1498,7 +1499,7 @@ with profile.test_list.group_manager(
 
 # Group spec/glsl-1.40
 with profile.test_list.group_manager(
-PiglitGLTest,
+BuiltInConstantsTest,
 grouptools.join('spec', 'glsl-1.40')) as g:
 g(['built-in-constants',
os.path.join(TESTS_DIR, 'spec', 'glsl-1.40', 'minimum-maximums.txt')],
@@ -1544,7 +1545,8 @@ with profile.test_list.group_manager(
 grouptools.join('spec', 'glsl-1.50')) as g:
 g(['built-in-constants',
os.path.join(TESTS_DIR, 'spec', 'glsl-1.50', 'minimum-maximums.txt')],
-  'built-in constants')
+  'built-in constants',
+  override_class=BuiltInConstantsTest)
 g(['glsl-1.50-gs-emits-too-few-verts'], 'gs-emits-too-few-verts')
 g(['glsl-1.50-geometry-end-primitive-optional-with-points-out'],
   'gs-end-primitive-optional-with-points-out')
@@ -1616,16 +1618,15 @@ with profile.test_list.group_manager(
   prim_type, restart_index))
 
 with profile.test_list.group_manager(
-PiglitGLTest, grouptools.join('spec', 'glsl-3.30')) as g:
+BuiltInConstantsTest, grouptools.join('spec', 'glsl-3.30')) as g:
 g(['built-in-constants',
os.path.join(TESTS_DIR, 'spec', 'glsl-3.30', 'minimum-maximums.txt')],
   'built-in constants')
 
 with profile.test_list.group_manager(
-PiglitGLTest, grouptools.join('spec', 'glsl-es-3.00')) as g:
+BuiltInConstantsTest, grouptools.join('spec', 'glsl-es-3.00')) as g:
 g(['built-in-constants_gles3',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-es-3.00',
-'minimum-maximums.txt')],
+   os.path.join(TESTS_DIR, 'spec', 'glsl-es-3.00', 
'minimum-maximums.txt')],
   'built-in constants')
 
 with profile.test_list.group_manager(
@@ -1634,10 +1635,9 @@ with profile.test_list.group_manager(
 g(['varying-struct-centroid_gles3'])
 
 with profile.test_list.group_manager(
-PiglitGLTest, grouptools.join('spec', 'glsl-es-3.10')) as g:
+BuiltInConstantsTest, grouptools.join('spec', 'glsl-es-3.10')) as g:
 g(['built-in-constants_gles3',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-es-3.10',
-'minimum-maximums.txt')],
+   os.path.join(TESTS_DIR, 'spec', 'glsl-es-3.10', 
'minimum-maximums.txt')],
   'built-in constants')
 
 # AMD_performance_monitor
@@ -1669,9 +1669,9 @@ with profile.test_list.group_manager(
 g(['arb_tessellation_shader-invalid-patch-vertices-range'])
 g(['arb_tessellation_shader-invalid-primitive'])
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 

[Piglit] [PATCH 30/35] tests/cl.py: fix out of tree serialization

2018-04-04 Thread Dylan Baker
---
 tests/cl.py | 67 --
 1 file changed, 45 insertions(+), 22 deletions(-)

diff --git a/tests/cl.py b/tests/cl.py
index 56b3fc1..7d4e17d 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -104,47 +104,70 @@ with profile.test_list.group_manager(PiglitCLTest, 
'interop') as g:
 g(['cl-interop-egl_khr_cl_event2'], 'EGL_KHR_cl_event2')
 
 
-def add_program_test_dir(group, dirpath):
-for filename in os.listdir(dirpath):
+def add_program_test_dir(group, dirpath, buildbase, installbase):
+for filename in os.listdir(os.path.join(buildbase, dirpath)):
 testname, ext = os.path.splitext(filename)
 if ext not in ['.cl', '.program_test']:
 continue
 
 profile.test_list[grouptools.join(group, testname)] = CLProgramTester(
-os.path.join(os.path.relpath(dirpath, ROOT_DIR), filename))
+os.path.join(installbase, dirpath, os.path.basename(filename)))
 
 
+base_test_dir = os.path.basename(TESTS_DIR)
+base_gen_dir = os.path.basename(GENERATED_TESTS_DIR)
+
 add_program_test_dir(grouptools.join('program', 'build'),
- os.path.join(TESTS_DIR, 'cl', 'program', 'build'))
+ os.path.join('cl', 'program', 'build'),
+ TESTS_DIR,
+ base_test_dir)
 add_program_test_dir(grouptools.join('program', 'build', 'fail'),
- os.path.join(TESTS_DIR, 'cl', 'program', 'build', 'fail'))
+ os.path.join('cl', 'program', 'build', 'fail'),
+ TESTS_DIR,
+ base_test_dir)
 add_program_test_dir(grouptools.join('program', 'execute'),
- os.path.join(TESTS_DIR, 'cl', 'program', 'execute'))
+ os.path.join('cl', 'program', 'execute'),
+ TESTS_DIR,
+ base_test_dir)
 add_program_test_dir(grouptools.join('program', 'execute'),
- os.path.join(TESTS_DIR, 'cl', 'program', 'execute',
-  'builtin', 'atomic'))
+ os.path.join('cl', 'program', 'execute', 'builtin', 
'atomic'),
+ TESTS_DIR,
+ base_test_dir)
 add_program_test_dir(grouptools.join('program', 'execute'),
- os.path.join(TESTS_DIR, 'cl', 'program', 'execute',
-  'builtin', 'convert'))
+ os.path.join('cl', 'program', 'execute', 'builtin', 
'convert'),
+ TESTS_DIR,
+ base_test_dir)
 
 # Run generated built-in tests
 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin', 'int'))
+ os.path.join('cl', 'builtin', 'int'),
+ GENERATED_TESTS_DIR,
+ base_gen_dir)
 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin',
-  'math'))
+ os.path.join('cl', 'builtin', 'math'),
+ GENERATED_TESTS_DIR,
+ base_gen_dir)
 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin',
-  'relational'))
+ os.path.join('cl', 'builtin', 'relational'),
+ GENERATED_TESTS_DIR,
+ base_gen_dir)
 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin',
-  'common'))
+ os.path.join('cl', 'builtin', 'common'),
+ GENERATED_TESTS_DIR,
+ base_gen_dir)
 add_program_test_dir(grouptools.join('program', 'execute', 'builtin'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'builtin',
-  'misc'))
+ os.path.join('cl', 'builtin', 'misc'),
+ GENERATED_TESTS_DIR,
+ base_gen_dir)
 add_program_test_dir(grouptools.join('program', 'execute', 'store'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'store'))
+ os.path.join('cl', 'store'),
+ GENERATED_TESTS_DIR,
+ base_gen_dir)
 add_program_test_dir(grouptools.join('program', 'execute', 'vstore'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'vstore'))
+ os.path.join('cl', 'vstore'),
+ GENERATED_TESTS_DIR,
+ base_gen_dir)
 add_program_test_dir(grouptools.join('program', 'execute', 'vload'),
- os.path.join(GENERATED_TESTS_DIR, 'cl', 'vload'))
+ os.path.join('cl', 'vload'),
+  

[Piglit] [PATCH 20/35] profile: Add support for loading xml based profiles

2018-04-04 Thread Dylan Baker
Which includes de-serialization on demand. This will vastly reduce the
amount of resident memory that is necessary to hold the tests since test
instances are made on demand, and can be garbage collected as soon as
the run in complete.
---
 framework/profile.py| 108 +-
 unittests/framework/test_profile.py |   5 +-
 2 files changed, 108 insertions(+), 5 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index 925271e..7b1b41b 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -30,15 +30,18 @@ tests, and the Test instance.
 from __future__ import (
 absolute_import, division, print_function, unicode_literals
 )
+import ast
 import collections
 import contextlib
 import copy
 import importlib
+import io
 import itertools
 import multiprocessing
 import multiprocessing.dummy
 import os
 import re
+import xml.etree.cElementTree as et
 
 import six
 
@@ -47,6 +50,12 @@ from framework.dmesg import get_dmesg
 from framework.log import LogManager
 from framework.monitoring import Monitoring
 from framework.test.base import Test, DummyTest
+from framework.test.piglit_test import (
+PiglitCLTest, PiglitGLTest, ASMParserTest, BuiltInConstantsTest,
+CLProgramTester, ROOT_DIR,
+)
+from framework.test.shader_test import ShaderTest, MultiShaderTest
+from framework.test.glsl_parser_test import GLSLParserTest
 
 __all__ = [
 'RegexFilter',
@@ -256,6 +265,100 @@ class TestDict(collections.MutableMapping):
 self.__allow_reassignment -= 1
 
 
+def make_test(element):
+"""Rebuild a test instance from xml."""
+def process(elem, opt):
+k = elem.attrib['name']
+v = elem.attrib['value']
+try:
+opt[k] = ast.literal_eval(v)
+except ValueError:
+opt[k] = v
+
+type_ = element.attrib['type']
+options = {}
+for e in element.findall('./option'):
+process(e, options)
+
+if type_ == 'gl':
+return PiglitGLTest(**options)
+if type_ == 'gl_builtin':
+return BuiltInConstantsTest(**options)
+if type_ == 'cl':
+return PiglitCLTest(**options)
+if type_ == 'cl_prog':
+return CLProgramTester(**options)
+if type_ == 'shader':
+return ShaderTest(**options)
+if type_ == 'glsl_parser':
+return GLSLParserTest(**options)
+if type_ == 'asm_parser':
+return ASMParserTest(**options)
+if type_ == 'multi_shader':
+options['skips'] = []
+for e in element.findall('./Skips/Skip/option'):
+skips = {}
+process(e, skips)
+options['skips'].append(skips)
+return MultiShaderTest(**options)
+raise Exception('Unreachable')
+
+
+class XMLProfile(object):
+
+def __init__(self, filename):
+self.filename = filename
+self.forced_test_list = []
+self.filters = []
+self.options = {
+'dmesg': get_dmesg(False),
+'monitor': Monitoring(False),
+'ignore_missing': False,
+}
+
+def __len__(self):
+if not (self.filters or self.forced_test_list):
+with io.open(self.filename, 'rt') as f:
+iter_ = et.iterparse(f, events=(b'start', ))
+for _, elem in iter_:
+if elem.tag == 'PiglitTestList':
+return int(elem.attrib['count'])
+return sum(1 for _ in self.itertests())
+
+def setup(self):
+pass
+
+def teardown(self):
+pass
+
+def _itertests(self):
+"""Always iterates tests instead of using the forced test_list."""
+with io.open(self.filename, 'rt') as f:
+doc = et.iterparse(f, events=(b'end', ))
+_, root = next(doc)  # get the root so we can keep clearing it
+for _, e in doc:
+if e.tag != 'Test':
+continue
+k = e.attrib['name']
+v = make_test(e)
+if all(f(k, v) for f in self.filters):
+yield k, v
+root.clear()
+
+def itertests(self):
+if self.forced_test_list:
+alltests = dict(self._itertests())
+opts = collections.OrderedDict()
+for n in self.forced_test_list:
+if self.options['ignore_missing'] and n not in alltests:
+opts[n] = DummyTest(n, status.NOTRUN)
+else:
+opts[n] = alltests[n]
+return six.iteritems(opts)
+else:
+return iter(self._itertests())
+
+
 class TestProfile(object):
 """Class that holds a list of tests for execution.
 
@@ -347,6 +450,11 @@ def load_test_profile(filename):
 Arguments:
 filename -- the name of a python module to get a 'profile' from
 """
+name = os.path.splitext(os.path.basename(filename))[0]
+xml = os.path.join(ROOT_DIR, 'tests', name + '.xml')
+if os.path.exists(xml):
+ 

[Piglit] [PATCH 16/35] framework/test: use relative paths for GLSLParser tests

2018-04-04 Thread Dylan Baker
---
 framework/test/glsl_parser_test.py | 13 ++---
 tests/all.py   |  4 ++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index 46344a8..35eadfe 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -33,7 +33,7 @@ import six
 from framework import exceptions
 from .base import TestIsSkip
 from .opengl import FastSkipMixin
-from .piglit_test import PiglitBaseTest, TEST_BIN_DIR
+from .piglit_test import PiglitBaseTest, TEST_BIN_DIR, ROOT_DIR
 
 __all__ = [
 'GLSLParserTest',
@@ -95,11 +95,12 @@ class Parser(object):
 self.gl_required = set()
 self.glsl_es_version = None
 self.glsl_version = None
+abs_filepath = os.path.join(ROOT_DIR, filepath)
 
 try:
-with io.open(filepath, mode='r', encoding='utf-8') as testfile:
+with io.open(abs_filepath, mode='r', encoding='utf-8') as testfile:
 testfile = testfile.read()
-self.config = self.parse(testfile, filepath)
+self.config = self.parse(testfile, abs_filepath)
 self.command = self.get_command(filepath)
 except GLSLParserInternalError as e:
 raise exceptions.PiglitFatalError(
@@ -278,6 +279,12 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 command, run_concurrent=True, gl_required=gl_required,
 glsl_version=glsl_version, glsl_es_version=glsl_es_version)
 
+@PiglitBaseTest.command.getter
+def command(self):
+command = super(GLSLParserTest, self).command
+glslfile = os.path.join(ROOT_DIR, command[1])
+return [command[0], glslfile] + command[2:]
+
 @classmethod
 def new(cls, filepath):
 parsed = Parser(filepath)
diff --git a/tests/all.py b/tests/all.py
index cf6ee5a..e0c7311 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -305,8 +305,8 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
 for filename in filenames:
 testname, ext = os.path.splitext(filename)
+dirname = os.path.relpath(dirpath, ROOT_DIR)
 if ext == '.shader_test':
-dirname = os.path.relpath(dirpath, ROOT_DIR)
 if PROCESS_ISOLATION:
 test = ShaderTest.new(os.path.join(dirname, filename))
 else:
@@ -314,7 +314,7 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 continue
 elif ext in ['.vert', '.tesc', '.tese', '.geom', '.frag', '.comp']:
 try:
-test = GLSLParserTest.new(os.path.join(dirpath, filename))
+test = GLSLParserTest.new(os.path.join(dirname, filename))
 except GLSLParserNoConfigError:
 # In the event that there is no config assume that it is a
 # legacy test, and continue
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 28/35] fix glslparser test for out of tree builds

2018-04-04 Thread Dylan Baker
---
 framework/test/glsl_parser_test.py | 19 +--
 tests/glslparser.py| 13 +++--
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index 88646c9..8840c2d 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -89,7 +89,7 @@ class Parser(object):
 _CONFIG_KEYS = frozenset(['expect_result', 'glsl_version',
   'require_extensions', 'check_link'])
 
-def __init__(self, filepath):
+def __init__(self, filepath, installpath=None):
 # a set that stores a list of keys that have been found already
 self.__found_keys = set()
 self.gl_required = set()
@@ -101,7 +101,7 @@ class Parser(object):
 with io.open(abs_filepath, mode='r', encoding='utf-8') as testfile:
 testfile = testfile.read()
 self.config = self.parse(testfile, abs_filepath)
-self.command = self.get_command(filepath)
+self.command = self.get_command(filepath, installpath)
 except GLSLParserInternalError as e:
 raise exceptions.PiglitFatalError(
 'In file "{}":\n{}'.format(filepath, six.text_type(e)))
@@ -153,7 +153,7 @@ class Parser(object):
 else:
 return 'glslparsertest'
 
-def get_command(self, filepath):
+def get_command(self, filepath, installpath):
 """ Create the command argument to pass to super()
 
 This private helper creates a configparser object, then reads in the
@@ -172,7 +172,7 @@ class Parser(object):
 glsl = self.config['glsl_version']
 command = [
 self.pick_binary(glsl),
-filepath,
+installpath or filepath,
 self.config['expect_result'],
 self.config['glsl_version']
 ]
@@ -282,8 +282,15 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 return [command[0], glslfile] + command[2:]
 
 @classmethod
-def new(cls, filepath):
-parsed = Parser(filepath)
+def new(cls, filepath, installpath=None):
+"""Parse a file and create an instance.
+
+:param str filepath: the file to parse
+:param Optional[str] installpath:
+The relative path the file will be isntalled to if different than
+filepath
+"""
+parsed = Parser(filepath, installpath)
 return cls(
 parsed.command,
 gl_required=parsed.gl_required,
diff --git a/tests/glslparser.py b/tests/glslparser.py
index 9d50dab..b7de9f6 100644
--- a/tests/glslparser.py
+++ b/tests/glslparser.py
@@ -17,15 +17,24 @@ profile = TestProfile()
 
 # Find and add all shader tests.
 basepath = os.path.normpath(os.path.join(TESTS_DIR, '..'))
+gen_basepath = os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), 
basepath)
+
 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
+isgenerated = basedir == GENERATED_TESTS_DIR
 for dirpath, _, filenames in os.walk(basedir):
 groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
 for filename in filenames:
 testname, ext = os.path.splitext(filename)
 if ext in ['.vert', '.tesc', '.tese', '.geom', '.frag', '.comp']:
+dirname = os.path.relpath(dirpath, basepath)
+filepath = os.path.join(dirname, filename)
+if isgenerated:
+installpath = os.path.relpath(filepath, gen_basepath)
+else:
+installpath = None
+
 try:
-test = GLSLParserTest.new(
-os.path.join(os.path.relpath(dirpath, basepath), 
filename))
+test = GLSLParserTest.new(filepath, installpath)
 except GLSLParserNoConfigError:
 # In the event that there is no config assume that it is a
 # legacy test, and continue
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 14/35] framework/test: Add class for cl-program-tester

2018-04-04 Thread Dylan Baker
These tests need some special handling for serializing, since they take
file paths as arguments.
---
 framework/test/piglit_test.py | 35 +--
 tests/cl.py   |  6 +++---
 2 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index b5c9a53..f5fd0c8 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -181,16 +181,6 @@ class PiglitGLTest(WindowResizeMixin, PiglitBaseTest):
 self._command = [n for n in new if n not in ['-auto', '-fbo']]
 
 
-class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
-""" OpenCL specific Test class.
-
-Set concurrency based on CL requirements.
-
-"""
-def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
-super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
-
-
 class ASMParserTest(PiglitBaseTest):
 
 """Test class for ASM parser tests."""
@@ -208,3 +198,28 @@ class ASMParserTest(PiglitBaseTest):
 class BuiltInConstantsTest(PiglitBaseTest):
 
 """Test class for handling built in constants tests."""
+
+
+class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
+""" OpenCL specific Test class.
+
+Set concurrency based on CL requirements.
+
+"""
+def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
+super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
+
+
+class CLProgramTester(PiglitCLTest):
+
+"""Class for cl-program-tester tests."""
+
+def __init__(self, filename):
+super(CLProgramTester, self).__init__(['cl-program-tester'])
+self.filename = filename
+
+@PiglitCLTest.command.getter
+def command(self):
+command = super(CLProgramTester, self).command
+command.insert(1, self.filename)
+return command
diff --git a/tests/cl.py b/tests/cl.py
index 24febe5..2ab3502 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -14,7 +14,7 @@ from __future__ import (
 import os
 
 from framework.profile import TestProfile
-from framework.test import PiglitCLTest
+from framework.test.piglit_test import PiglitCLTest, CLProgramTester
 from framework import grouptools
 from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
 
@@ -110,8 +110,8 @@ def add_program_test_dir(group, dirpath):
 if ext not in ['.cl', '.program_test']:
 continue
 
-profile.test_list[grouptools.join(group, testname)] = PiglitCLTest(
-['cl-program-tester', os.path.join(dirpath, filename)])
+profile.test_list[grouptools.join(group, testname)] = CLProgramTester(
+os.path.join(dirpath, filename))
 
 
 add_program_test_dir(grouptools.join('program', 'build'),
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 03/35] framework/profile: Allow a group manager class to be overwritten

2018-04-04 Thread Dylan Baker
This is useful for classes like the coming BuiltInConstantsTest class,
where just one or two tests need to change the test class.
---
 framework/profile.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index d77ac09..b6deed0 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -205,7 +205,7 @@ class TestDict(collections.MutableMapping):
 """
 assert isinstance(group, six.string_types), type(group)
 
-def adder(args, name=None, **kwargs):
+def adder(args, name=None, override_class=None, **kwargs):
 """Helper function that actually adds the tests.
 
 Arguments:
@@ -228,7 +228,9 @@ class TestDict(collections.MutableMapping):
 assert isinstance(name, six.string_types)
 lgroup = grouptools.join(group, name)
 
-self[lgroup] = test_class(
+class_ = override_class or test_class
+
+self[lgroup] = class_(
 args,
 **dict(itertools.chain(six.iteritems(default_args),
six.iteritems(kwargs
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 11/35] framework: do the same for shader test

2018-04-04 Thread Dylan Baker
---
 framework/test/shader_test.py| 46 +++--
 tests/all.py |  4 +-
 unittests/framework/test/test_shader_test.py | 20 -
 3 files changed, 38 insertions(+), 32 deletions(-)

diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index a3fb8e2..64edb58 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -154,26 +154,31 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest):
 
 """
 
-def __init__(self, filename):
-if bool(os.environ.get('PIGLIT_NO_FAST_SKIP', False)):
-# No need to parse the shader test file if we've disabled
-# the FastSkip feature.
-super(ShaderTest, self).__init__(
-['shader_runner', filename],
-run_concurrent=True,)
-else:
-parser = Parser(filename)
-parser.parse()
-
-super(ShaderTest, self).__init__(
-[parser.prog, parser.filename],
-run_concurrent=True,
-gl_required=parser.gl_required,
-gl_version=parser.gl_version,
-gles_version=parser.gles_version,
-glsl_version=parser.glsl_version,
-glsl_es_version=parser.glsl_es_version)
-
+def __init__(self, command, gl_required=set(), gl_version=None,
+ gles_version=None, glsl_version=None, glsl_es_version=None,
+ **kwargs):
+super(ShaderTest, self).__init__(
+command,
+run_concurrent=True,
+gl_required=gl_required,
+gl_version=gl_version,
+gles_version=gles_version,
+glsl_version=glsl_version,
+glsl_es_version=glsl_es_version)
+
+@classmethod
+def new(cls, filename):
+parser = Parser(filename)
+parser.parse()
+
+return cls(
+[parser.prog, parser.filename],
+run_concurrent=True,
+gl_required=parser.gl_required,
+gl_version=parser.gl_version,
+gles_version=parser.gles_version,
+glsl_version=parser.glsl_version,
+glsl_es_version=parser.glsl_es_version)
 
 @PiglitBaseTest.command.getter
 def command(self):
@@ -197,6 +202,7 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
 """
 
 def __init__(self, filenames):
+# TODO
 assert filenames
 prog = None
 files = []
diff --git a/tests/all.py b/tests/all.py
index fa6b1c3..cbbe7d7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -305,7 +305,7 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 testname, ext = os.path.splitext(filename)
 if ext == '.shader_test':
 if PROCESS_ISOLATION:
-test = ShaderTest(os.path.join(dirpath, filename))
+test = ShaderTest.new(os.path.join(dirpath, filename))
 else:
 shader_tests[groupname].append(os.path.join(dirpath, 
filename))
 continue
@@ -337,7 +337,7 @@ for group, files in six.iteritems(shader_tests):
 if len(files) == 1:
 group = grouptools.join(
 group, os.path.basename(os.path.splitext(files[0])[0]))
-profile.test_list[group] = ShaderTest(files[0])
+profile.test_list[group] = ShaderTest.new(files[0])
 else:
 profile.test_list[group] = MultiShaderTest(files)
 
diff --git a/unittests/framework/test/test_shader_test.py 
b/unittests/framework/test/test_shader_test.py
index 1637231..c7a8da2 100644
--- a/unittests/framework/test/test_shader_test.py
+++ b/unittests/framework/test/test_shader_test.py
@@ -93,7 +93,7 @@ class TestConfigParsing(object):
 
 [next section]
 """.format(operator, gles)))
-test = shader_test.ShaderTest(six.text_type(p))
+test = shader_test.ShaderTest.new(six.text_type(p))
 
 assert os.path.basename(test.command[0]) == expected
 
@@ -105,7 +105,7 @@ class TestConfigParsing(object):
 GL ES >= 3.0
 GLSL ES >= 3.00 es
 """))
-test = shader_test.ShaderTest(six.text_type(p))
+test = shader_test.ShaderTest.new(six.text_type(p))
 
 assert os.path.basename(test.command[0]) == "shader_runner_gles3"
 
@@ -117,7 +117,7 @@ class TestConfigParsing(object):
 GL >= 3.0
 GL_ARB_ham_sandwhich
 """))
-test = shader_test.ShaderTest(six.text_type(p))
+test = shader_test.ShaderTest.new(six.text_type(p))
 
 assert test.gl_required == {'GL_ARB_ham_sandwhich'}
 
@@ -129,7 +129,7 @@ class TestConfigParsing(object):
 GL >= 2.0
 GL_ARB_ham_sandwhich
 """))
-test = shader_test.ShaderTest(six.text_type(p))
+test = shader_test.ShaderTest.new(six.text_type(p))
 
 assert test.gl_version == 2.0
 
@@ -141,7 +141,7 @@ class 

[Piglit] [PATCH 26/35] shader_tests: correctly generate xml during out of tree builds

2018-04-04 Thread Dylan Baker
---
 framework/test/shader_test.py | 14 ++
 tests/shader.py   | 31 +++
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index dbad16b..719b92f 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -167,12 +167,18 @@ class ShaderTest(FastSkipMixin, PiglitBaseTest):
 glsl_es_version=glsl_es_version)
 
 @classmethod
-def new(cls, filename):
+def new(cls, filename, installed_name=None):
+"""Parse an XML file and create a new instance.
+
+:param str filename: The name of the file to parse
+:param str installed_name: The relative path to the file when installed
+if not the same as the parsed name
+"""
 parser = Parser(filename)
 parser.parse()
 
 return cls(
-[parser.prog, parser.filename],
+[parser.prog, installed_name or filename],
 run_concurrent=True,
 gl_required=parser.gl_required,
 gl_version=parser.gl_version,
@@ -215,7 +221,7 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
 self.skips = [FastSkip(**s) for s in skips]
 
 @classmethod
-def new(cls, filenames):
+def new(cls, filenames, installednames=None):
 # TODO
 assert filenames
 prog = None
@@ -257,7 +263,7 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
 'glsl_es_version': parser.glsl_es_version,
 })
 
-return cls(prog, filenames, subtests, skips)
+return cls(prog, installednames or filenames, subtests, skips)
 
 def _process_skips(self):
 r_files = []
diff --git a/tests/shader.py b/tests/shader.py
index 0396c4c..3a43bcf 100644
--- a/tests/shader.py
+++ b/tests/shader.py
@@ -6,6 +6,7 @@ from __future__ import (
 import collections
 import os
 
+from six.moves import zip
 import six
 
 from framework.options import OPTIONS
@@ -22,17 +23,26 @@ shader_tests = collections.defaultdict(list)
 
 # Find and add all shader tests.
 basepath = os.path.normpath(os.path.join(TESTS_DIR, '..'))
+gen_basepath = os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), 
basepath)
+
 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
+isgenerated = basedir == GENERATED_TESTS_DIR
 for dirpath, _, filenames in os.walk(basedir):
 groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
 for filename in filenames:
 testname, ext = os.path.splitext(filename)
 if ext == '.shader_test':
 dirname = os.path.relpath(dirpath, basepath)
+filepath = os.path.join(dirname, filename)
+if isgenerated:
+installpath = os.path.relpath(filepath, gen_basepath)
+else:
+installpath = None
+
 if OPTIONS.process_isolation:
-test = ShaderTest.new(os.path.join(dirname, filename))
+test = ShaderTest.new(filepath, installpath)
 else:
-shader_tests[groupname].append(os.path.join(dirname, 
filename))
+shader_tests[groupname].append((filepath, installpath))
 continue
 else:
 continue
@@ -46,11 +56,24 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 # this dictionary is constructed, then added to the actual test dictionary.
 for group, files in six.iteritems(shader_tests):
 assert group not in profile.test_list, 'duplicate group: {}'.format(group)
+
+# We'll end up with a list of tuples, split that into two lists
+files, installedfiles = list(zip(*files))
+files = list(files)
+installedfiles = list(installedfiles)
+
 # If there is only one file in the directory use a normal shader_test.
 # Otherwise use a MultiShaderTest
 if len(files) == 1:
 group = grouptools.join(
 group, os.path.basename(os.path.splitext(files[0])[0]))
-profile.test_list[group] = ShaderTest.new(files[0])
+profile.test_list[group] = ShaderTest.new(files[0], installedfiles[0])
 else:
-profile.test_list[group] = MultiShaderTest.new(files)
+if all(i is None for i in installedfiles):
+installedfiles = None
+else:
+for i, n in enumerate(installedfiles):
+if n is None:
+installedfiles[i] = files[i]
+
+profile.test_list[group] = MultiShaderTest.new(files, installedfiles)
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 13/35] framework/test/piglit_test: make cl_concurrency always a boolean

2018-04-04 Thread Dylan Baker
Just a nice cleanup.
---
 framework/test/piglit_test.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 0986ab0..b5c9a53 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -56,8 +56,8 @@ else:
 
 TEST_BIN_DIR = os.path.normpath(os.path.join(ROOT_DIR, 'bin'))
 
-CL_CONCURRENT = (not sys.platform.startswith('linux') or
- glob.glob('/dev/dri/render*'))
+CL_CONCURRENT = bool(not sys.platform.startswith('linux') or
+ glob.glob('/dev/dri/render*'))
 
 
 class PiglitBaseTest(ValgrindMixin, Test):
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 29/35] fix asmparser test serialization for out of tree builds

2018-04-04 Thread Dylan Baker
---
 tests/glslparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/glslparser.py b/tests/glslparser.py
index b7de9f6..fe2b3c5 100644
--- a/tests/glslparser.py
+++ b/tests/glslparser.py
@@ -59,7 +59,7 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 'asmparsertest', os.path.relpath(dirpath, _basedir)))
 type_ = os.path.basename(dirpath)
 
-dirname = os.path.relpath(dirpath, ROOT_DIR)
+dirname = os.path.relpath(dirpath, os.path.join(basedir, '..'))
 for filename in filenames:
 if not os.path.splitext(filename)[1] == '.txt':
 continue
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 32/35] Add script to serialize profiles to XML

2018-04-04 Thread Dylan Baker
This script loads a python module and creates an XML profiles. It will
be used at build time to serialize the built-in profiles. It currently
cannot serialize integrated suites (such as dEQP or IGC), but it could
be extended to do so.
---
 tests/serializer.py | 149 +-
 1 file changed, 149 insertions(+)
 create mode 100644 tests/serializer.py

diff --git a/tests/serializer.py b/tests/serializer.py
new file mode 100644
index 000..58b3a14
--- /dev/null
+++ b/tests/serializer.py
@@ -0,0 +1,149 @@
+# encoding=utf-8
+# Copyright © 2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""Script for taking profiles in python format and serializing them to XML."""
+
+import argparse
+import os
+import sys
+import xml.etree.cElementTree as et
+
+import six
+
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 
'..'))
+
+from framework.test.piglit_test import (
+PiglitGLTest, PiglitCLTest, ASMParserTest, BuiltInConstantsTest,
+CLProgramTester,
+)
+from framework.test.shader_test import ShaderTest, MultiShaderTest
+from framework.test.glsl_parser_test import GLSLParserTest
+from framework.profile import load_test_profile
+from framework.options import OPTIONS
+
+
+def parser():
+"""Parse command line arguments."""
+parser = argparse.ArgumentParser()
+parser.add_argument('name')
+parser.add_argument('input')
+parser.add_argument('output')
+parser.add_argument('--no-process-isolation', action='store_true')
+parser.add_argument('--glsl-arb-compat', action='store_true')
+args = parser.parse_args()
+return args
+
+
+def _serialize_skips(test, elem):
+if getattr(test, 'gl_required', None):
+et.SubElement(elem, 'option', name='gl_required',
+  value=repr(test.gl_required))
+if getattr(test, 'gl_version', None):
+et.SubElement(elem, 'option', name='gl_version',
+  value=repr(test.gl_version))
+if getattr(test, 'gles_version', None):
+et.SubElement(elem, 'option', name='gles_version',
+  value=repr(test.gles_version))
+if getattr(test, 'glsl_version', None):
+et.SubElement(elem, 'option', name='glsl_version',
+  value=repr(test.glsl_version))
+if getattr(test, 'glsl_es_version', None):
+et.SubElement(elem, 'option', name='glsl_es_version',
+  value=repr(test.glsl_es_version))
+
+
+def serializer(name, profile, outfile):
+"""Take each test in the profile and write it out into the xml."""
+# TODO: This is going to take a lot of memory
+root = et.Element('PiglitTestList', count=six.text_type(len(profile)),
+  name=name)
+for name, test in profile.itertests():
+if isinstance(test, PiglitGLTest):
+elem = et.SubElement(root, 'Test', type='gl', name=name)
+if test.require_platforms:
+et.SubElement(elem, 'option', name='require_platforms',
+  value=repr(test.require_platforms))
+if test.exclude_platforms:
+et.SubElement(elem, 'option', name='exclude_platforms',
+  value=repr(test.exclude_platforms))
+_serialize_skips(test, elem)
+elif isinstance(test, BuiltInConstantsTest):
+elem = et.SubElement(root, 'Test', type='gl_builtin', name=name)
+elif isinstance(test, GLSLParserTest):
+elem = et.SubElement(root, 'Test', type='glsl_parser', name=name)
+_serialize_skips(test, elem)
+elif isinstance(test, ASMParserTest):
+elem = et.SubElement(root, 'Test', type='asm_parser', name=name)
+et.SubElement(elem, 'option', name='type_',
+  value=repr(test.command[1]))
+et.SubElement(elem, 'option', name='filename',
+  

[Piglit] [PATCH 07/35] framework: Use custom class for ASM parser tests

2018-04-04 Thread Dylan Baker
This is going to make serialization easier, since asmparser tests take a
file argument, which must be relative at build time, but absolute at run
time.
---
 framework/test/piglit_test.py | 14 ++
 tests/all.py  |  6 --
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index ef3bfdc..c53c3e5 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -189,3 +189,17 @@ class PiglitCLTest(PiglitBaseTest):  # pylint: 
disable=too-few-public-methods
 """
 def __init__(self, command, run_concurrent=CL_CONCURRENT, **kwargs):
 super(PiglitCLTest, self).__init__(command, run_concurrent, **kwargs)
+
+
+class ASMParserTest(PiglitBaseTest):
+
+"""Test class for ASM parser tests."""
+
+def __init__(self, type_, filename):
+super(ASMParserTest, self).__init__(['asmparsertest', type_])
+self.filename = filename
+
+@PiglitBaseTest.command.getter
+def command(self):
+command = super(ASMParserTest, self).command
+return command + [os.path.join(ROOT_DIR, self.filename)]
diff --git a/tests/all.py b/tests/all.py
index 7c8580e..fe4a14c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -21,6 +21,7 @@ from framework.driver_classifier import DriverClassifier
 from framework.test import (PiglitGLTest, PiglitBaseTest,
 GLSLParserTest, GLSLParserNoConfigError)
 from framework.test.shader_test import ShaderTest, MultiShaderTest
+from framework.test.piglit_test import ASMParserTest
 from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
 
 __all__ = ['profile']
@@ -340,6 +341,7 @@ for group, files in six.iteritems(shader_tests):
 else:
 profile.test_list[group] = MultiShaderTest(files)
 
+
 # Collect and add all asmparsertests
 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 _basedir = os.path.join(basedir, 'asmparsertest', 'shaders')
@@ -353,8 +355,8 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 continue
 
 group = grouptools.join(base_group, filename)
-profile.test_list[group] = PiglitGLTest(
-['asmparsertest', type_, os.path.join(dirpath, filename)])
+profile.test_list[group] = ASMParserTest(
+type_, os.path.join(dirpath, filename))
 
 # Find and add all apitrace tests.
 classifier = DriverClassifier()
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 35/35] profile: use gz to compress profiles

2018-04-04 Thread Dylan Baker
This results in substantially smaller profiles and doesn't seem to
affect runtime.
---
 CMakeLists.txt  | 4 ++--
 framework/profile.py| 8 
 tests/CMakeLists.no_api.txt | 6 +++---
 tests/serializer.py | 4 +++-
 4 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db047b4..2e870d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -533,14 +533,14 @@ install (
 install (
DIRECTORY tests
DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-   FILES_MATCHING REGEX 
".*\\.(xml|py|program_test|shader_test|frag|vert|geom|tesc|tese|comp|ktx|cl|txt|inc)$"
+   FILES_MATCHING REGEX 
".*\\.(xml.gz|py|program_test|shader_test|frag|vert|geom|tesc|tese|comp|ktx|cl|txt|inc)$"
REGEX 
"CMakeFiles|CMakeLists|serializer.py|opengl.py|cl.py|quick_gl.py|glslparser.py|shader.py|quick_shader.py|no_error.py|llvmpipe_gl.py|sanity.py"
 EXCLUDE
 )
 
 install (
DIRECTORY ${CMAKE_BINARY_DIR}/tests
DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-   FILES_MATCHING REGEX ".*\\.xml"
+   FILES_MATCHING REGEX ".*\\.xml.gz"
 )
 
 install (
diff --git a/framework/profile.py b/framework/profile.py
index 3975d06..7eefeeb 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -34,8 +34,8 @@ import ast
 import collections
 import contextlib
 import copy
+import gzip
 import importlib
-import io
 import itertools
 import multiprocessing
 import multiprocessing.dummy
@@ -318,7 +318,7 @@ class XMLProfile(object):
 
 def __len__(self):
 if not (self.filters or self.forced_test_list):
-with io.open(self.filename, 'rt') as f:
+with gzip.open(self.filename, 'rt') as f:
 iter_ = et.iterparse(f, events=(b'start', ))
 for _, elem in iter_:
 if elem.tag == 'PiglitTestList':
@@ -333,7 +333,7 @@ class XMLProfile(object):
 
 def _itertests(self):
 """Always iterates tests instead of using the forced test_list."""
-with io.open(self.filename, 'rt') as f:
+with gzip.open(self.filename, 'rt') as f:
 doc = et.iterparse(f, events=(b'end', ))
 _, root = next(doc)  # get the root so we can keep clearing it
 for _, e in doc:
@@ -517,7 +517,7 @@ def load_test_profile(filename, python=None):
 if os.path.exists(meta):
 return MetaProfile(meta)
 
-xml = os.path.join(ROOT_DIR, 'tests', name + '.xml')
+xml = os.path.join(ROOT_DIR, 'tests', name + '.xml.gz')
 if os.path.exists(xml):
 return XMLProfile(xml)
 
diff --git a/tests/CMakeLists.no_api.txt b/tests/CMakeLists.no_api.txt
index d7f95af..3ffba74 100644
--- a/tests/CMakeLists.no_api.txt
+++ b/tests/CMakeLists.no_api.txt
@@ -45,14 +45,14 @@ add_custom_target(
 
 function(piglit_generate_xml name profile meta_target extra_args)
add_custom_command(
-   OUTPUT ${CMAKE_BINARY_DIR}/tests/${name}.xml
-   COMMAND ${CMAKE_COMMAND} -E env 
PIGLIT_BUILD_TREE=${CMAKE_BINARY_DIR} ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${name} 
${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py ${CMAKE_BINARY_DIR}/tests/${name}.xml 
 ${extra_args}
+   OUTPUT ${CMAKE_BINARY_DIR}/tests/${name}.xml.gz
+   COMMAND ${CMAKE_COMMAND} -E env 
PIGLIT_BUILD_TREE=${CMAKE_BINARY_DIR} ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${name} 
${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py 
${CMAKE_BINARY_DIR}/tests/${name}.xml.gz  ${extra_args}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${ARGN}
VERBATIM
)
add_custom_target(
generate-${name}-xml
-   DEPENDS ${CMAKE_BINARY_DIR}/tests/${name}.xml
+   DEPENDS ${CMAKE_BINARY_DIR}/tests/${name}.xml.gz
)
add_dependencies(${meta_target} generate-${name}-xml)
 endfunction()
diff --git a/tests/serializer.py b/tests/serializer.py
index 58b3a14..32beb42 100644
--- a/tests/serializer.py
+++ b/tests/serializer.py
@@ -22,6 +22,7 @@
 """Script for taking profiles in python format and serializing them to XML."""
 
 import argparse
+import gzip
 import os
 import sys
 import xml.etree.cElementTree as et
@@ -133,7 +134,8 @@ def serializer(name, profile, outfile):
 et.SubElement(env, 'env', name=k, value=v)
 
 tree = et.ElementTree(root)
-tree.write(outfile, encoding='utf-8', xml_declaration=True)
+with gzip.open(outfile, 'wb') as f:
+tree.write(f, encoding='utf-8', xml_declaration=True)
 
 
 def main():
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 00/35] Serialize profiles into XML at build time

2018-04-04 Thread Dylan Baker
Quoting Dylan Baker (2018-04-04 15:26:48)
> I don't expect everyone I've CC'd to give thorough review (or any
> review), I've mostly CC'd people who I think would be interested in this
> work, or who's work flow I might be altered by it.
> 
> Piglit has struggled to cope with the growing number of tests that it
> contains, especially with startup time. Piglit has always calculated
> tests at runtime, which was not a problem when there were only a few
> hundred or even thousand tests. Piglit now has roughly 55,000
> OpenGL/OpenGL ES tests, which is a lot to calculate at start up. It also
> means that piglit needs to keep a python object for each of those tests
> in memory, which has sent the resident memory usage soaring. We've also
> moved to automatic test discovery for glslparser, asmparser, and shader
> tests, which is very convenient and reduces typing, but further
> increases the amount of time spent starting up. This has even made
> features which decrease runtime, like fast skipping, hurt startup
> performance, making it a less than desirable tradeoff in some cases.
> Even on a relatively fast machine with an nvme disk 15-20 seconds is not
> an unheard of startup time. That might be okay to run 55,000 tests, but
> not if you only need a dozen, such as when bisecting.
> 
> This series is my proposal to fix that, mainly by moving much of that
> cost to build time. This series creates the infrastructure build XML
> base profiles at build time, which are installed with piglit instead of
> the python profiles. These profiles are lazily iterated over to ease
> memory usage, test objects are created as they are run, and python can
> garbage collect them as soon as they are done running. Along with that
> any filters applied to profiles (like removing 80% of the vs_in shader
> tests in quick) are done before the profile is serialized, and all fast
> skipping information is collected at build time as well, and encoded in
> the XML. All this means that start times are vastly reduced.
> 
> For example:
> XML profiles
> quick: 0.5
> shader: 0.5
> 
> master
> quick: 11.6
> shader: 7.3
> 
> This series also implements some optimizations for running without
> filters or test-lists, if you add a filter quick would take 2.5
> seconds, because that is necessary to calculate the total number of
> tests before starting.
> 
> To keep classic profiles like all, quick, quick_cl, gpu, cpu, and
> llvmpipe working this series adds meta profiles, small XML snippets that
> list other profiles. These can contain other meta profiles, xml
> profiles, or python profiles. This means that for most uses cases your
> existing command line will still work, `./piglit run quick out -c` will
> still do exactly the same thing as before, just faster.
> 
> The XML generated is dumb, there is no encoding of options or logic. An
> early version of this series did contain logic and options, but the
> result was pretty terrible. It was very hard to read, and the code to
> handle it was very complicated. I've chosen not to go down that path.
> There are drawbacks, some things that relied on run time generation have
> cannot be handled the same way, among them the "multi shader" concept,
> where shader_runner consumes a directory of shader_tests at a time. This
> was previously handled via a --process-isolation=false flag, now its
> encoded into profiles, "shader_multi" and "quick_shader_multi"; there
> was also an option to use glslparsertest with ES shaders and
> ARB_ES_compatibility, that is now "glslparser_arb_compat". I haven't
> added metaprofiles for these cases, although we certainly could (or you
> can write your own, the schema is dead simple), so `./piglit run quick
> out --process-isolation=false` is now `./piglit run quick_gl glslparser
> quick_shader_multi out`.
> 
> I've run this through our CI extensively, and gotten green results out
> of it across the board.
> 
> I know this is a big series, but piglit makes a lot of assumptions about the
> test profiles being created at runtime, and we've had to changes those
> assumptions.
> 
> 
> Dylan Baker (35):
>   update git ignore for this series
>   test/piglit_test: add ROOT_DIR variable
>   framework/profile: Allow a group manager class to be overwritten
>   framework/test: Use getter for altering PiglitBaseTest Command
>   framework/test: expose required and excluded platforms
>   framework/profile: Add a __len__ method to TestProfile
>   framework: Use custom class for ASM parser tests
>   framework/test: add a test class for built-in constants
>   tests: use BuiltInConstantsClass
>   framework: use a class method for building test via parsing
>   framework: do the same for shader test
>   framework/test: Split multishader too
>   framework/test/piglit_test: make cl_concurrency always a boolean
>   framework/test: Add class for cl-program-tester
>   framework/test: Make shader paths relative
>   framework/test: use relative paths for GLSLParser tests
>   

[Piglit] [PATCH v2 35/35] profile: use gz to compress profiles

2018-04-04 Thread Dylan Baker
This results in substantially smaller profiles and doesn't seem to
affect runtime.

v2: - install xml and xml.gz files. This is needed so that meta profiles
  will be installed.
---
 CMakeLists.txt  |  4 ++--
 framework/profile.py| 10 +-
 tests/CMakeLists.no_api.txt |  6 +++---
 tests/serializer.py |  4 +++-
 4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db047b4b2..8c7d16270 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -533,14 +533,14 @@ install (
 install (
DIRECTORY tests
DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-   FILES_MATCHING REGEX 
".*\\.(xml|py|program_test|shader_test|frag|vert|geom|tesc|tese|comp|ktx|cl|txt|inc)$"
+   FILES_MATCHING REGEX 
".*\\.(xml|xml.gz|py|program_test|shader_test|frag|vert|geom|tesc|tese|comp|ktx|cl|txt|inc)$"
REGEX 
"CMakeFiles|CMakeLists|serializer.py|opengl.py|cl.py|quick_gl.py|glslparser.py|shader.py|quick_shader.py|no_error.py|llvmpipe_gl.py|sanity.py"
 EXCLUDE
 )
 
 install (
DIRECTORY ${CMAKE_BINARY_DIR}/tests
DESTINATION ${PIGLIT_INSTALL_LIBDIR}
-   FILES_MATCHING REGEX ".*\\.xml"
+   FILES_MATCHING REGEX ".*\\.xml.gz"
 )
 
 install (
diff --git a/framework/profile.py b/framework/profile.py
index 3975d0606..1c75025b3 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -34,8 +34,8 @@ import ast
 import collections
 import contextlib
 import copy
+import gzip
 import importlib
-import io
 import itertools
 import multiprocessing
 import multiprocessing.dummy
@@ -318,7 +318,7 @@ class XMLProfile(object):
 
 def __len__(self):
 if not (self.filters or self.forced_test_list):
-with io.open(self.filename, 'rt') as f:
+with gzip.open(self.filename, 'rt') as f:
 iter_ = et.iterparse(f, events=(b'start', ))
 for _, elem in iter_:
 if elem.tag == 'PiglitTestList':
@@ -333,7 +333,7 @@ class XMLProfile(object):
 
 def _itertests(self):
 """Always iterates tests instead of using the forced test_list."""
-with io.open(self.filename, 'rt') as f:
+with gzip.open(self.filename, 'rt') as f:
 doc = et.iterparse(f, events=(b'end', ))
 _, root = next(doc)  # get the root so we can keep clearing it
 for _, e in doc:
@@ -517,13 +517,13 @@ def load_test_profile(filename, python=None):
 if os.path.exists(meta):
 return MetaProfile(meta)
 
-xml = os.path.join(ROOT_DIR, 'tests', name + '.xml')
+xml = os.path.join(ROOT_DIR, 'tests', name + '.xml.gz')
 if os.path.exists(xml):
 return XMLProfile(xml)
 
 if python is False:
 raise exceptions.PiglitFatalError(
-'Cannot open "tests/{0}.xml" or "tests/{0}.meta.xml"'.format(name))
+'Cannot open "tests/{0}.xml.gz" or 
"tests/{0}.meta.xml"'.format(name))
 
 try:
 mod = importlib.import_module('tests.{0}'.format(name))
diff --git a/tests/CMakeLists.no_api.txt b/tests/CMakeLists.no_api.txt
index d7f95af0e..3ffba74b0 100644
--- a/tests/CMakeLists.no_api.txt
+++ b/tests/CMakeLists.no_api.txt
@@ -45,14 +45,14 @@ add_custom_target(
 
 function(piglit_generate_xml name profile meta_target extra_args)
add_custom_command(
-   OUTPUT ${CMAKE_BINARY_DIR}/tests/${name}.xml
-   COMMAND ${CMAKE_COMMAND} -E env 
PIGLIT_BUILD_TREE=${CMAKE_BINARY_DIR} ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${name} 
${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py ${CMAKE_BINARY_DIR}/tests/${name}.xml 
 ${extra_args}
+   OUTPUT ${CMAKE_BINARY_DIR}/tests/${name}.xml.gz
+   COMMAND ${CMAKE_COMMAND} -E env 
PIGLIT_BUILD_TREE=${CMAKE_BINARY_DIR} ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${name} 
${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py 
${CMAKE_BINARY_DIR}/tests/${name}.xml.gz  ${extra_args}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${ARGN}
VERBATIM
)
add_custom_target(
generate-${name}-xml
-   DEPENDS ${CMAKE_BINARY_DIR}/tests/${name}.xml
+   DEPENDS ${CMAKE_BINARY_DIR}/tests/${name}.xml.gz
)
add_dependencies(${meta_target} generate-${name}-xml)
 endfunction()
diff --git a/tests/serializer.py b/tests/serializer.py
index 58b3a14e9..32beb428c 100644
--- a/tests/serializer.py
+++ b/tests/serializer.py
@@ -22,6 +22,7 @@
 """Script for taking profiles in python format and serializing them to XML."""
 
 import argparse
+import gzip
 import os
 import sys
 import xml.etree.cElementTree as et
@@ -133,7 +134,8 @@ def serializer(name, profile, outfile):
 et.SubElement(env, 'env', name=k, value=v)
 
 tree = et.ElementTree(root)
-tree.write(outfile, encoding='utf-8', xml_declaration=True)
+with 

[Piglit] [PATCH 06/35] framework/profile: Add a __len__ method to TestProfile

2018-04-04 Thread Dylan Baker
This exposes a standard interface for getting the number of tests in a
profile, which is itself nice. It will also allow us to encapsulate the
differences between the various profiles added in this series.
---
 framework/profile.py | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index b6deed0..925271e 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -284,6 +284,9 @@ class TestProfile(object):
 'ignore_missing': False,
 }
 
+def __len__(self):
+return sum(1 for _ in self.itertests())
+
 def setup(self):
 """Method to do pre-run setup."""
 
@@ -381,15 +384,12 @@ def run(profiles, logger, backend, concurrency):
 """
 chunksize = 1
 
-# The logger needs to know how many tests are running. Because of filters
-# there's no way to do that without making a concrete list out of the
-# filters profiles.
-profiles = [(p, list(p.itertests())) for p in profiles]
-log = LogManager(logger, sum(len(l) for _, l in profiles))
+profiles = [(p, p.itertests()) for p in profiles]
+log = LogManager(logger, sum(len(p) for p, _ in profiles))
 
 # check that after the filters are run there are actually tests to run.
-if not any(l for _, l in profiles):
-raise exceptions.PiglitUserError('no matching tests')
+# if not any(l for _, l in profiles):
+# raise exceptions.PiglitUserError('no matching tests')
 
 def test(name, test, profile, this_pool=None):
 """Function to call test.execute from map"""
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 27/35] tests/glsl_parser_test.py: fix is_skip for serialized profiles

2018-04-04 Thread Dylan Baker
Currently is skip relies on runtime detection of which glslparsertest
binaries are built, but we can't assume that at build time. Instead
always assign the appropriate binary, and then check for the existence
of that binary at run time.
---
 framework/test/glsl_parser_test.py| 20 
 unittests/framework/test/test_glsl_parser_test.py | 13 --
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index 35eadfe..88646c9 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -122,7 +122,7 @@ class Parser(object):
 # If GLES is requested, but piglit was not built with a gles version,
 # then ARB_ES3_compatibility is required. Add it to
 # self.gl_required
-if self.glsl_es_version and not _HAS_GLES_BIN:
+if self.glsl_es_version and _FORCE_DESKTOP_VERSION:
 if self.glsl_es_version == 1.0:
 ver = '2'
 elif self.glsl_es_version == 3.0:
@@ -148,14 +148,10 @@ class Parser(object):
 then the test will be skipped in the python layer.
 
 """
-if (_is_gles_version(version)
-and _HAS_GLES_BIN
-and not _FORCE_DESKTOP_VERSION):
+if _is_gles_version(version) and not _FORCE_DESKTOP_VERSION:
 return 'glslparsertest_gles2'
-elif _HAS_GL_BIN:
-return 'glslparsertest'
 else:
-return 'None'
+return 'glslparsertest'
 
 def get_command(self, filepath):
 """ Create the command argument to pass to super()
@@ -295,8 +291,12 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 glsl_es_version=parsed.glsl_es_version)
 
 def is_skip(self):
-if os.path.basename(self.command[0]) == 'None':
-raise TestIsSkip('Test is for desktop OpenGL, '
- 'but only an OpenGL ES binary has been built')
+if os.path.basename(self.command[0]) == 'glslparsertest' and not 
_HAS_GL_BIN:
+raise TestIsSkip('Test is for desktop OpenGL, but piglit was not '
+ 'built with OpenGL support.')
+elif (os.path.basename(self.command[0]) == 'glslparsertest_gles2'
+  and not _HAS_GLES_BIN):
+raise TestIsSkip('Test is for OpenGL ES, but piglit was not '
+ 'built with OpenGL ES support.')
 
 super(GLSLParserTest, self).is_skip()
diff --git a/unittests/framework/test/test_glsl_parser_test.py 
b/unittests/framework/test/test_glsl_parser_test.py
index b396fea..bf217b1 100644
--- a/unittests/framework/test/test_glsl_parser_test.py
+++ b/unittests/framework/test/test_glsl_parser_test.py
@@ -339,22 +339,21 @@ def test_valid_extensions(ext, tmpdir):
 
 
 @pytest.mark.parametrize(
-"version,has_bin,forced",
+"version,forced",
 itertools.product(
 ['1.00', '3.00', '3.10', '3.20', '3.00 es', '3.10 es', '3.20 es'],
-[True, False], [True, False]))
-def test_get_glslparsertest_gles2(version, has_bin, forced, tmpdir, mocker):
+[True, False]))
+def test_get_glslparsertest_gles2(version, forced, tmpdir, mocker):
 """Tests for assigning the correct binary for GLES tests.
 
 Tests with and without the gles binary and with and without the force
 desktop mode.
 """
-if not has_bin or forced:
+if forced:
 expected = 'glslparsertest'
 else:
 expected = 'glslparsertest_gles2'
 
-mocker.patch('framework.test.glsl_parser_test._HAS_GLES_BIN', has_bin)
 mocker.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION',
  forced)
 
@@ -436,7 +435,7 @@ def test_add_compatibility_requirement_fastskip(version, 
extension, tmpdir,
 
 This test checks the fast skipping variable
 """
-mocker.patch('framework.test.glsl_parser_test._HAS_GLES_BIN', False)
+mocker.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION', 
True)
 
 p = tmpdir.join('test.frag')
 p.write(textwrap.dedent("""\
@@ -466,7 +465,7 @@ def test_add_compatibility_requirement_binary(version, 
extension, tmpdir,
 
 This test checks the glslparsertest binary command line.
 """
-mocker.patch('framework.test.glsl_parser_test._HAS_GLES_BIN', False)
+mocker.patch('framework.test.glsl_parser_test._FORCE_DESKTOP_VERSION', 
True)
 
 p = tmpdir.join('test.frag')
 p.write(textwrap.dedent("""\
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 31/35] opengl.py: Remove exported gl extensions

2018-04-04 Thread Dylan Baker
This conflicts with the idea of serializing the tests at build time,
since we can't assume that the build machine has the same features set
as the machine that will run tests, we can't run such a filter.

Since startup time is much faster and fast skip calculations are done at
build time I hope that no one will miss this.
---
 tests/opengl.py | 335 +
 1 file changed, 122 insertions(+), 213 deletions(-)

diff --git a/tests/opengl.py b/tests/opengl.py
index ec80be1..3a203a1 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -11,9 +11,7 @@ import platform
 from six.moves import range
 
 from framework import grouptools
-from framework.test import opengl
 from framework import options
-from framework import wflinfo
 from framework.profile import TestProfile
 from framework.driver_classifier import DriverClassifier
 from framework.test.piglit_test import (
@@ -206,86 +204,6 @@ def power_set(s):
 # Collecting all tests
 profile = TestProfile()  # pylint: disable=invalid-name
 
-wfl_info = wflinfo.WflInfo()
-
-
-def gl_extension_supported(ext_name):
-"""Is the named OpenGL extension supported?"""
-if wfl_info.gl_extensions == set():
-# Don't know what extensions are supported.  Return true so we don't
-# skip anything.
-return True
-return ext_name in wfl_info.gl_extensions
-
-
-def is_feature_directory_supported(dir_name):
-"""Determine if dir_name specifies an OpenGL feature (extension or GL
-version) which is supported by the host.  If we return False, it means
-the extension/version is definitely not supported.  If we return True,
-it means the extension/version is possibly suppported.  We're a little
-fuzzy because we don't yet parse all the directory name possibilities
-(like ES tests).
-
-Also, if the 'wflinfo' program is not installed or fails (i.e. we can't
-determine the GL version/extension) we return True.
-"""
-if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}:
-# The directory is a GL extension name, but of the format "arb_foo_bar"
-# instead of "GL_ARB_foo_bar".  We convert the former into the later
-# and check if the extension is supported.
-ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:]
-return gl_extension_supported(ext_name)
-elif dir_name[:5] == "gles-":
-# OpenGL ES test
-version = float(dir_name[5:])
-return wfl_info.gles_version is None or version <= 
wfl_info.gles_version
-elif dir_name[:8] == "glsl-es-":
-# OpenGL ES shader test
-version = float(dir_name[8:])
-return wfl_info.glsl_es_version is None or version <= 
wfl_info.glsl_es_version
-elif dir_name[:3] == "gl-":
-# The directory is a GL version
-version = float(dir_name[3:])
-return wfl_info.gl_version is None or version <= wfl_info.gl_version
-elif dir_name[:5] == "glsl-":
-# The directory is a GLSL version
-version = float(dir_name[5:])
-return wfl_info.glsl_version is None or version <= 
wfl_info.glsl_version
-else:
-# The directory is something else.  Don't skip it.
-return True
-
-
-def walk_filter_dir_tree(root):
-"""Recursively walk the directory tree rooted at 'root'.
-If we find a directory path of the form ".../spec/foo/" we'll check if
-'foo' is a supported extension/feature/version.  If not, we do not
-traverse foo/.  Otherwise, we add continue traversing.
-The return value is a list of (dirpath, filename) tuples.
-"""
-curdir = os.path.split(root)[1]
-files = []
-retval = []
-
-for entry in os.listdir(root):
-full_path = os.path.join(root, entry)
-if os.path.isdir(full_path):
-# Check if we're in a "spec/" direcotry
-if curdir == "spec" and not is_feature_directory_supported(entry):
-# The directory's tests aren't supported by the driver.
-print("Skipping spec/{}".format(entry))
-else:
-# recursively walk the subdirectory
-retval += walk_filter_dir_tree(full_path)
-elif os.path.isfile(full_path):
-# Add the file to the files list
-files += [entry]
-
-retval += [(root, [], files)]
-
-return retval
-
-
 # Find and add all apitrace tests.
 classifier = DriverClassifier()
 for basedir in [os.path.join(TESTS_DIR, 'apitrace', 'traces')]:
@@ -1680,28 +1598,25 @@ with profile.test_list.group_manager(
   '{}-textureSize-{}'.format(stage, sampler))
 
 # Group ARB_texture_gather
-if gl_extension_supported("GL_ARB_texture_gather"):
-with profile.test_list.group_manager(
-PiglitGLTest,
-grouptools.join('spec', 'ARB_texture_gather')) as g:
-stages = ['vs', 'fs']
-comps = ['r', 'rg', 'rgb', 'rgba']
-types = ['unorm', 'float', 'int', 'uint']
-samplers = 

[Piglit] [PATCH 21/35] profile: allow forcing python or xml loading

2018-04-04 Thread Dylan Baker
This will be used during build time to allow profiles that modify other
profiles to load XML instead of rebuilding.
---
 framework/profile.py | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index 7b1b41b..2395b22 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -429,7 +429,7 @@ class TestProfile(object):
 yield k, v
 
 
-def load_test_profile(filename):
+def load_test_profile(filename, python=None):
 """Load a python module and return it's profile attribute.
 
 All of the python test files provide a profile attribute which is a
@@ -449,15 +449,24 @@ def load_test_profile(filename):
 
 Arguments:
 filename -- the name of a python module to get a 'profile' from
+
+Keyword Arguments:
+python -- If this is None (the default) XML is tried, and then a python
+  module. If True, then only python is tried, if False then only
+  XML is tried.
 """
 name = os.path.splitext(os.path.basename(filename))[0]
-xml = os.path.join(ROOT_DIR, 'tests', name + '.xml')
-if os.path.exists(xml):
-return XMLProfile(xml)
+xml = os.path.join('tests', name + '.xml')
+if not python:
+xml = os.path.join(ROOT_DIR, 'tests', name + '.xml')
+if os.path.exists(xml):
+return XMLProfile(xml)
+
+if python is False:
+raise exceptions.PiglitFatalError('Cannot open 
"tests/{}.xml"'.format(name))
 
 try:
-mod = importlib.import_module('tests.{0}'.format(
-os.path.splitext(os.path.basename(filename))[0]))
+mod = importlib.import_module('tests.{0}'.format(name))
 except ImportError:
 raise exceptions.PiglitFatalError(
 'Failed to import "{}", there is either something wrong with the '
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 00/35] Serialize profiles into XML at build time

2018-04-04 Thread Dylan Baker
I don't expect everyone I've CC'd to give thorough review (or any
review), I've mostly CC'd people who I think would be interested in this
work, or who's work flow I might be altered by it.

Piglit has struggled to cope with the growing number of tests that it
contains, especially with startup time. Piglit has always calculated
tests at runtime, which was not a problem when there were only a few
hundred or even thousand tests. Piglit now has roughly 55,000
OpenGL/OpenGL ES tests, which is a lot to calculate at start up. It also
means that piglit needs to keep a python object for each of those tests
in memory, which has sent the resident memory usage soaring. We've also
moved to automatic test discovery for glslparser, asmparser, and shader
tests, which is very convenient and reduces typing, but further
increases the amount of time spent starting up. This has even made
features which decrease runtime, like fast skipping, hurt startup
performance, making it a less than desirable tradeoff in some cases.
Even on a relatively fast machine with an nvme disk 15-20 seconds is not
an unheard of startup time. That might be okay to run 55,000 tests, but
not if you only need a dozen, such as when bisecting.

This series is my proposal to fix that, mainly by moving much of that
cost to build time. This series creates the infrastructure build XML
base profiles at build time, which are installed with piglit instead of
the python profiles. These profiles are lazily iterated over to ease
memory usage, test objects are created as they are run, and python can
garbage collect them as soon as they are done running. Along with that
any filters applied to profiles (like removing 80% of the vs_in shader
tests in quick) are done before the profile is serialized, and all fast
skipping information is collected at build time as well, and encoded in
the XML. All this means that start times are vastly reduced.

For example:
XML profiles
quick: 0.5
shader: 0.5

master
quick: 11.6
shader: 7.3

This series also implements some optimizations for running without
filters or test-lists, if you add a filter quick would take 2.5
seconds, because that is necessary to calculate the total number of
tests before starting.

To keep classic profiles like all, quick, quick_cl, gpu, cpu, and
llvmpipe working this series adds meta profiles, small XML snippets that
list other profiles. These can contain other meta profiles, xml
profiles, or python profiles. This means that for most uses cases your
existing command line will still work, `./piglit run quick out -c` will
still do exactly the same thing as before, just faster.

The XML generated is dumb, there is no encoding of options or logic. An
early version of this series did contain logic and options, but the
result was pretty terrible. It was very hard to read, and the code to
handle it was very complicated. I've chosen not to go down that path.
There are drawbacks, some things that relied on run time generation have
cannot be handled the same way, among them the "multi shader" concept,
where shader_runner consumes a directory of shader_tests at a time. This
was previously handled via a --process-isolation=false flag, now its
encoded into profiles, "shader_multi" and "quick_shader_multi"; there
was also an option to use glslparsertest with ES shaders and
ARB_ES_compatibility, that is now "glslparser_arb_compat". I haven't
added metaprofiles for these cases, although we certainly could (or you
can write your own, the schema is dead simple), so `./piglit run quick
out --process-isolation=false` is now `./piglit run quick_gl glslparser
quick_shader_multi out`.

I've run this through our CI extensively, and gotten green results out
of it across the board.

I know this is a big series, but piglit makes a lot of assumptions about the
test profiles being created at runtime, and we've had to changes those
assumptions.


Dylan Baker (35):
  update git ignore for this series
  test/piglit_test: add ROOT_DIR variable
  framework/profile: Allow a group manager class to be overwritten
  framework/test: Use getter for altering PiglitBaseTest Command
  framework/test: expose required and excluded platforms
  framework/profile: Add a __len__ method to TestProfile
  framework: Use custom class for ASM parser tests
  framework/test: add a test class for built-in constants
  tests: use BuiltInConstantsClass
  framework: use a class method for building test via parsing
  framework: do the same for shader test
  framework/test: Split multishader too
  framework/test/piglit_test: make cl_concurrency always a boolean
  framework/test: Add class for cl-program-tester
  framework/test: Make shader paths relative
  framework/test: use relative paths for GLSLParser tests
  tests/all: Make asmparser tests path relative
  framework/test: make BuiltInConstantTest files relative
  framework/test: make CLProgramTester take relative paths
  profile: Add support for loading xml based profiles
  profile: allow 

[Piglit] [PATCH 02/35] test/piglit_test: add ROOT_DIR variable

2018-04-04 Thread Dylan Baker
This variable always points to the root of the piglit directory, which
contains the tests and generated_tests directories.
---
 framework/test/piglit_test.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index b6cec71..cc129ed 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -45,14 +45,16 @@ __all__ = [
 'PiglitGLTest',
 'PiglitBaseTest',
 'CL_CONCURRENT',
+'ROOT_DIR',
 'TEST_BIN_DIR',
 ]
 
 if 'PIGLIT_BUILD_DIR' in os.environ:
-TEST_BIN_DIR = os.path.join(os.environ['PIGLIT_BUILD_DIR'], 'bin')
+ROOT_DIR = os.environ['PIGLIT_BUILD_DIR']
 else:
-TEST_BIN_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__),
- '../../bin'))
+ROOT_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), 
'../..'))
+
+TEST_BIN_DIR = os.path.normpath(os.path.join(ROOT_DIR, 'bin'))
 
 CL_CONCURRENT = (not sys.platform.startswith('linux') or
  glob.glob('/dev/dri/render*'))
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 23/35] py_modules: Add support for out of tree builds

2018-04-04 Thread Dylan Baker
For out of tree builds we need to point at a TESTS_DIR that is in tree,
and a GENERATED_TESTS dir that is out of tree. At no other time do we
need to do this.
---
 tests/py_modules/constants.py | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/py_modules/constants.py b/tests/py_modules/constants.py
index 94a41db..c9a7a41 100644
--- a/tests/py_modules/constants.py
+++ b/tests/py_modules/constants.py
@@ -32,9 +32,11 @@ TESTS_DIR = 
os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
 # If the PIGLIT_BUILD_DIR env var is set, we want to look for the
 # generated tests in $PIGLIT_BUILD_DIR/generated_tests/.  Otherwise,
 # look in TESTS_DIR/../generated_tests.
-GENERATED_TESTS_DIR = os.path.abspath(os.path.join(
-os.environ.get('PIGLIT_BUILD_DIR', os.path.join(TESTS_DIR, '..')),
-'generated_tests'))
+build_dir = os.environ.get('PIGLIT_BUILD_TREE')
+if not build_dir:
+build_dir = os.environ.get('PIGLIT_BUILD_DIR', os.path.join(TESTS_DIR, 
'..'))
+
+GENERATED_TESTS_DIR = os.path.abspath(os.path.join(build_dir, 
'generated_tests'))
 
 # If on cygwin convert to a dos style path
 if sys.platform == 'cygwin':
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 33/35] tests: Add script to find all hand written test files

2018-04-04 Thread Dylan Baker
Including asmparser, glslparser, shader, and program tests, which will
be used by cmake to regenerate the appropriate xml whenever a new test
is added.
---
 tests/find_static_tests.py | 74 +++-
 1 file changed, 74 insertions(+)
 create mode 100644 tests/find_static_tests.py

diff --git a/tests/find_static_tests.py b/tests/find_static_tests.py
new file mode 100644
index 000..2152731
--- /dev/null
+++ b/tests/find_static_tests.py
@@ -0,0 +1,74 @@
+# encoding=utf-8
+# Copyright © 2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+"""Script that finds all static tests of one kind or another."""
+
+from __future__ import (
+absolute_import, division, print_function, unicode_literals
+)
+import argparse
+import io
+import os
+
+
+def main():
+parser = argparse.ArgumentParser()
+parser.add_argument('sourcedir')
+parser.add_argument(
+'mode',
+choices=['shader', 'glslparser', 'asmparser', 'program'])
+parser.add_argument('output')
+args = parser.parse_args()
+
+if args.mode == 'asmparser':
+exts = ['.txt']
+directory = os.path.join(args.sourcedir, 'asmparsertest', 'shaders')
+elif args.mode == 'glslparser':
+exts = ['.frag', '.vert', '.goem', '.tess', 'tesc', '.comp']
+directory = args.sourcedir
+elif args.mode == 'shader':
+exts = ['.shader_test']
+directory = args.sourcedir
+elif args.mode == 'program':
+exts = ['.program_test']
+directory = args.sourcedir
+
+files = []
+for dirpath, _, filenames in os.walk(directory):
+for filename in filenames:
+if os.path.splitext(filename)[1] in exts:
+files.append(os.path.join(dirpath, filename))
+
+if os.path.exists(args.output):
+with io.open(args.output, 'rt', encoding='utf-8') as f:
+existing = f.read().rstrip().split('\n')
+else:
+existing = []
+
+if sorted(files) != sorted(existing):
+with io.open(args.output, 'wt', encoding='utf-8') as f:
+for filename in files:
+f.write(filename)
+f.write('\n')
+
+
+if __name__ == '__main__':
+main()
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 22/35] framework/profile: Add support for meta profiles

2018-04-04 Thread Dylan Baker
MetaProfiles are a single profile composed of more than one profile.
This is designed to allow the old all-inclusive names to continue to
exist without having to keep duplicates of each profile around. A
metaprofile simply declares that it needs profiles a, b, and c and then
runs those.

This allows an "all" meta profile to include opengl, shader, and
glslparser, for example.

A metaprofile is allowed to include XML or python based profiles.
---
 framework/profile.py | 64 +++--
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/framework/profile.py b/framework/profile.py
index 2395b22..3975d06 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -359,6 +359,62 @@ class XMLProfile(object):
 return iter(self._itertests())
 
 
+class MetaProfile(object):
+
+"""Holds multiple profiles but acts like one.
+
+This is meant to allow classic profiles like all to exist after being
+split.
+"""
+
+def __init__(self, filename):
+self.forced_test_list = []
+self.filters = []
+self.options = {
+'dmesg': get_dmesg(False),
+'monitor': Monitoring(False),
+'ignore_missing': False,
+}
+
+tree = et.parse(filename)
+root = tree.getroot()
+self._profiles = [load_test_profile(p.text)
+  for p in root.findall('.//Profile')]
+
+for p in self._profiles:
+p.options = self.options
+
+def __len__(self):
+if self.forced_test_list or self.filters:
+return sum(1 for _ in self.itertests())
+return sum(len(p) for p in self._profiles)
+
+def setup(self):
+pass
+
+def teardown(self):
+pass
+
+def _itertests(self):
+for p in self._profiles:
+for k, v in p.itertests():
+if all(f(k, v) for f in self.filters):
+yield k, v
+
+def itertests(self):
+if self.forced_test_list:
+alltests = dict(self._itertests())
+opts = collections.OrderedDict()
+for n in self.forced_test_list:
+if self.options['ignore_missing'] and n not in alltests:
+opts[n] = DummyTest(n, status.NOTRUN)
+else:
+opts[n] = alltests[n]
+return six.iteritems(opts)
+else:
+return iter(self._itertests())
+
+
 class TestProfile(object):
 """Class that holds a list of tests for execution.
 
@@ -456,14 +512,18 @@ def load_test_profile(filename, python=None):
   XML is tried.
 """
 name = os.path.splitext(os.path.basename(filename))[0]
-xml = os.path.join('tests', name + '.xml')
 if not python:
+meta = os.path.join(ROOT_DIR, 'tests', name + '.meta.xml')
+if os.path.exists(meta):
+return MetaProfile(meta)
+
 xml = os.path.join(ROOT_DIR, 'tests', name + '.xml')
 if os.path.exists(xml):
 return XMLProfile(xml)
 
 if python is False:
-raise exceptions.PiglitFatalError('Cannot open 
"tests/{}.xml"'.format(name))
+raise exceptions.PiglitFatalError(
+'Cannot open "tests/{0}.xml" or "tests/{0}.meta.xml"'.format(name))
 
 try:
 mod = importlib.import_module('tests.{0}'.format(name))
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 12/35] framework/test: Split multishader too

2018-04-04 Thread Dylan Baker
---
 framework/test/shader_test.py| 63 ++---
 tests/all.py |  2 +-
 unittests/framework/test/test_shader_test.py | 17 +-
 3 files changed, 59 insertions(+), 23 deletions(-)

diff --git a/framework/test/shader_test.py b/framework/test/shader_test.py
index 64edb58..3dc2c39 100644
--- a/framework/test/shader_test.py
+++ b/framework/test/shader_test.py
@@ -201,11 +201,22 @@ class MultiShaderTest(ReducedProcessMixin, 
PiglitBaseTest):
 filenames -- a list of absolute paths to shader test files
 """
 
-def __init__(self, filenames):
+def __init__(self, prog, files, subtests, skips):
+super(MultiShaderTest, self).__init__(
+[prog] + files,
+subtests=subtests,
+run_concurrent=True)
+
+self.prog = prog
+self.files = files
+self.subtests = subtests
+self.skips = [FastSkip(**s) for s in skips]
+
+@classmethod
+def new(cls, filenames):
 # TODO
 assert filenames
 prog = None
-files = []
 subtests = []
 skips = []
 
@@ -215,7 +226,7 @@ class MultiShaderTest(ReducedProcessMixin, PiglitBaseTest):
 for each in filenames:
 parser = Parser(each)
 parser.parse()
-subtest = os.path.basename(os.path.splitext(each)[0]).lower()
+
subtests.append(os.path.basename(os.path.splitext(each)[0]).lower())
 
 if prog is not None:
 # This allows mixing GLES2 and GLES3 shader test files
@@ -236,30 +247,42 @@ class MultiShaderTest(ReducedProcessMixin, 
PiglitBaseTest):
 else:
 prog = parser.prog
 
+skips.append({
+'gl_required': parser.gl_required,
+'gl_version': parser.gl_version,
+'glsl_version': parser.glsl_version,
+'gles_version': parser.gles_version,
+'glsl_es_version': parser.glsl_es_version,
+})
+
+return cls(prog, filenames, subtests, skips)
+
+def _process_skips(self):
+r_files = []
+r_subtests = []
+r_skips = []
+for f, s, k in zip(self.files, self.subtests, self.skips):
 try:
-skipper = FastSkip(gl_required=parser.gl_required,
-   gl_version=parser.gl_version,
-   gles_version=parser.gles_version,
-   glsl_version=parser.glsl_version,
-   glsl_es_version=parser.glsl_es_version)
-skipper.test()
+k.test()
 except TestIsSkip:
-skips.append(subtest)
-continue
-files.append(parser.filename)
-subtests.append(subtest)
+r_skips.append(s)
+else:
+r_files.append(f)
+r_subtests.append(s)
 
-assert len(subtests) + len(skips) == len(filenames), \
+assert len(r_subtests) + len(r_skips) == len(self.files), \
 'not all tests accounted for'
 
-super(MultiShaderTest, self).__init__(
-[prog] + files,
-subtests=subtests,
-run_concurrent=True)
-
-for name in skips:
+for name in r_skips:
 self.result.subtests[name] = status.SKIP
 
+self._expected = r_subtests
+self._command = [self._command[0]] + r_files
+
+def run(self):
+self._process_skips()
+super(MultiShaderTest, self).run()
+
 @PiglitBaseTest.command.getter  # pylint: disable=no-member
 def command(self):
 """Add -auto to the test command."""
diff --git a/tests/all.py b/tests/all.py
index cbbe7d7..6a2b990 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -339,7 +339,7 @@ for group, files in six.iteritems(shader_tests):
 group, os.path.basename(os.path.splitext(files[0])[0]))
 profile.test_list[group] = ShaderTest.new(files[0])
 else:
-profile.test_list[group] = MultiShaderTest(files)
+profile.test_list[group] = MultiShaderTest.new(files)
 
 
 # Collect and add all asmparsertests
diff --git a/unittests/framework/test/test_shader_test.py 
b/unittests/framework/test/test_shader_test.py
index c7a8da2..49caecb 100644
--- a/unittests/framework/test/test_shader_test.py
+++ b/unittests/framework/test/test_shader_test.py
@@ -33,6 +33,7 @@ except ImportError:
 import pytest
 import six
 
+from framework import status
 from framework.test import shader_test
 
 # pylint: disable=invalid-name,no-self-use,protected-access
@@ -242,7 +243,7 @@ class TestMultiShaderTest(object):
 
 [vertex shader]"""))
 
-return shader_test.MultiShaderTest(
+return shader_test.MultiShaderTest.new(
 [six.text_type(one), six.text_type(two)])
 
 def test_prog(self, inst):
@@ -268,10 +269,11 @@ class 

[Piglit] [PATCH 01/35] update git ignore for this series

2018-04-04 Thread Dylan Baker
---
 .gitignore | 4 
 1 file changed, 4 insertions(+)

diff --git a/.gitignore b/.gitignore
index c005a5a..0f4c952 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,7 @@ __pycache__/
 
 *.css
 *.html
+
+tests/*.xml
+tests/*.xml.gz
+!tests/*.meta.xml
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 24/35] tests/quick: fix filtering of vs_in shader tests

2018-04-04 Thread Dylan Baker
This filter is incorrect as is, in that it can mask tests that it can
remove tests it shouldn't, for example
spec@arb_enhanced_layouts@arb_enhanced_layouts-transform-feedback-layout-qualifiers_vs_interface.
Correcting this is problematic because it changes the way the filter
works and filter will now remove different tests than it did before.

However, it is necessary for a couple of reasons. 1) it's removing tests
it shouldn't, 2) this series is going to split reverse the
shader.py/all.py relationship, and this bug is going to surface there.

The good new is that while this changes the specific tests run, at least
on Intel hardware no failures are removed and no failures are added.
---
 tests/quick.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/quick.py b/tests/quick.py
index 73c4678..2d05d7a 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -17,6 +17,7 @@ import random
 
 from framework import grouptools
 from framework.test import PiglitGLTest
+from framework.test.shader_test import ShaderTest
 from tests.all import profile as _profile
 
 __all__ = ['profile']
@@ -32,8 +33,8 @@ class FilterVsIn(object):
 self.random = random.Random()
 self.random.seed(42)
 
-def __call__(self, name, _):
-if 'vs_in' in name:
+def __call__(self, name, test):
+if isinstance(test, ShaderTest) and 'vs_in' in grouptools.split(name):
 # 20%
 return self.random.random() <= .2
 return True
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 04/35] framework/test: Use getter for altering PiglitBaseTest Command

2018-04-04 Thread Dylan Baker
This removes mutation of the class, and pushes the change out to run
time instead of build time. This is better coding style, and is required
for XML serialization, since paths need to be relative in the XML, and
made absolute at runtime.
---
 framework/test/piglit_test.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index cc129ed..3d5b156 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -70,8 +70,11 @@ class PiglitBaseTest(ValgrindMixin, Test):
 def __init__(self, command, run_concurrent=True, **kwargs):
 super(PiglitBaseTest, self).__init__(command, run_concurrent, **kwargs)
 
+@Test.command.getter
+def command(self):
 # Prepend TEST_BIN_DIR to the path.
-self._command[0] = os.path.join(TEST_BIN_DIR, self._command[0])
+cmd = os.path.join(TEST_BIN_DIR, super(PiglitBaseTest, 
self).command[0])
+return [cmd] + self._command[1:]
 
 def interpret_result(self):
 out = []
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 19/35] framework/test: make CLProgramTester take relative paths

2018-04-04 Thread Dylan Baker
---
 framework/test/piglit_test.py | 2 +-
 tests/cl.py   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 4fd825a..6511e0f 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -226,5 +226,5 @@ class CLProgramTester(PiglitCLTest):
 @PiglitCLTest.command.getter
 def command(self):
 command = super(CLProgramTester, self).command
-command.insert(1, self.filename)
+command.insert(1, os.path.join(ROOT_DIR, self.filename))
 return command
diff --git a/tests/cl.py b/tests/cl.py
index 2ab3502..56b3fc1 100644
--- a/tests/cl.py
+++ b/tests/cl.py
@@ -14,7 +14,7 @@ from __future__ import (
 import os
 
 from framework.profile import TestProfile
-from framework.test.piglit_test import PiglitCLTest, CLProgramTester
+from framework.test.piglit_test import PiglitCLTest, CLProgramTester, ROOT_DIR
 from framework import grouptools
 from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
 
@@ -111,7 +111,7 @@ def add_program_test_dir(group, dirpath):
 continue
 
 profile.test_list[grouptools.join(group, testname)] = CLProgramTester(
-os.path.join(dirpath, filename))
+os.path.join(os.path.relpath(dirpath, ROOT_DIR), filename))
 
 
 add_program_test_dir(grouptools.join('program', 'build'),
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 10/35] framework: use a class method for building test via parsing

2018-04-04 Thread Dylan Baker
Since the serialized tests wont need this path, build a generic
constructor that this special constructor can leverage.
---
 framework/test/glsl_parser_test.py| 12 +++-
 tests/all.py  |  2 +-
 unittests/framework/test/test_glsl_parser_test.py | 48 
 3 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/framework/test/glsl_parser_test.py 
b/framework/test/glsl_parser_test.py
index 6a06bc3..46344a8 100644
--- a/framework/test/glsl_parser_test.py
+++ b/framework/test/glsl_parser_test.py
@@ -272,11 +272,17 @@ class GLSLParserTest(FastSkipMixin, PiglitBaseTest):
 .tesc, .tese, .geom or .frag
 """
 
-def __init__(self, filepath):
-parsed = Parser(filepath)
+def __init__(self, command, gl_required=set(), glsl_version=None,
+ glsl_es_version=None, **kwargs):
 super(GLSLParserTest, self).__init__(
+command, run_concurrent=True, gl_required=gl_required,
+glsl_version=glsl_version, glsl_es_version=glsl_es_version)
+
+@classmethod
+def new(cls, filepath):
+parsed = Parser(filepath)
+return cls(
 parsed.command,
-run_concurrent=True,
 gl_required=parsed.gl_required,
 glsl_version=parsed.glsl_version,
 glsl_es_version=parsed.glsl_es_version)
diff --git a/tests/all.py b/tests/all.py
index a50a4c3..fa6b1c3 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -311,7 +311,7 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 continue
 elif ext in ['.vert', '.tesc', '.tese', '.geom', '.frag', '.comp']:
 try:
-test = GLSLParserTest(os.path.join(dirpath, filename))
+test = GLSLParserTest.new(os.path.join(dirpath, filename))
 except GLSLParserNoConfigError:
 # In the event that there is no config assume that it is a
 # legacy test, and continue
diff --git a/unittests/framework/test/test_glsl_parser_test.py 
b/unittests/framework/test/test_glsl_parser_test.py
index d252e27..b396fea 100644
--- a/unittests/framework/test/test_glsl_parser_test.py
+++ b/unittests/framework/test/test_glsl_parser_test.py
@@ -83,7 +83,7 @@ def test_no_config_start(tmpdir):
 // [end config]"""))
 
 with pytest.raises(glsl.GLSLParserNoConfigError):
-glsl.GLSLParserTest(six.text_type(p))
+glsl.GLSLParserTest.new(six.text_type(p))
 
 
 def test_find_config_start(tmpdir):
@@ -96,7 +96,7 @@ def test_find_config_start(tmpdir):
 // glsl_version: 1.10"""))
 
 with pytest.raises(exceptions.PiglitFatalError):
-glsl.GLSLParserTest(six.text_type(p))
+glsl.GLSLParserTest.new(six.text_type(p))
 
 
 def test_no_config_end(tmpdir):
@@ -106,7 +106,7 @@ def test_no_config_end(tmpdir):
 p.write('// [config]')
 
 with pytest.raises(exceptions.PiglitFatalError):
-glsl.GLSLParserTest(six.text_type(p))
+glsl.GLSLParserTest.new(six.text_type(p))
 
 
 def test_no_expect_result(tmpdir):
@@ -119,7 +119,7 @@ def test_no_expect_result(tmpdir):
 // [end config]"""))
 
 with pytest.raises(exceptions.PiglitFatalError):
-glsl.GLSLParserTest(six.text_type(p))
+glsl.GLSLParserTest.new(six.text_type(p))
 
 
 def test_no_glsl_version(tmpdir):
@@ -132,7 +132,7 @@ def test_no_glsl_version(tmpdir):
 // [end config]"""))
 
 with pytest.raises(exceptions.PiglitFatalError):
-glsl.GLSLParserTest(six.text_type(p))
+glsl.GLSLParserTest.new(six.text_type(p))
 
 
 def test_cpp_comments(tmpdir):
@@ -144,7 +144,7 @@ def test_cpp_comments(tmpdir):
 // expect_result: pass
 // glsl_version: 1.10
 // [end config]"""))
-test = glsl.GLSLParserTest(six.text_type(p))
+test = glsl.GLSLParserTest.new(six.text_type(p))
 
 assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'),
 six.text_type(p), 'pass', '1.10']
@@ -161,7 +161,7 @@ def test_c_comments(tmpdir):
  * [end config]
  */"""))
 
-test = glsl.GLSLParserTest(six.text_type(p))
+test = glsl.GLSLParserTest.new(six.text_type(p))
 
 assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'),
 six.text_type(p), 'pass', '1.10']
@@ -177,7 +177,7 @@ def test_blank_in_config_cpp(tmpdir):
 // expect_result: pass
 // glsl_version: 1.10
 // [end config]"""))
-test = glsl.GLSLParserTest(six.text_type(p))
+test = glsl.GLSLParserTest.new(six.text_type(p))
 
 assert test.command == [os.path.join(_TEST_BIN_DIR, 'glslparsertest'),
 six.text_type(p), 'pass', '1.10']
@@ -193,7 +193,7 @@ def test_empty_in_config_cpp(tmpdir):
 // expect_result: pass
 // glsl_version: 1.10
 // [end config]"""))
-test = 

[Piglit] [PATCH 34/35] Generate xml for builtin profiles

2018-04-04 Thread Dylan Baker
This creates and installs xml for all builtin profiles. Using these
profiles I see startup times of ~1 second as opposed to more than 10
with current master, and runtimes that drop by ~1 minute.
---
 CMakeLists.txt  |  8 ++-
 tests/CMakeLists.no_api.txt | 89 ++-
 tests/CMakeLists.txt|  2 +-
 3 files changed, 98 insertions(+), 1 deletion(-)
 create mode 100644 tests/CMakeLists.no_api.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dc80ece..db047b4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -534,7 +534,13 @@ install (
DIRECTORY tests
DESTINATION ${PIGLIT_INSTALL_LIBDIR}
FILES_MATCHING REGEX 
".*\\.(xml|py|program_test|shader_test|frag|vert|geom|tesc|tese|comp|ktx|cl|txt|inc)$"
-   REGEX "CMakeFiles|CMakeLists" EXCLUDE
+   REGEX 
"CMakeFiles|CMakeLists|serializer.py|opengl.py|cl.py|quick_gl.py|glslparser.py|shader.py|quick_shader.py|no_error.py|llvmpipe_gl.py|sanity.py"
 EXCLUDE
+)
+
+install (
+   DIRECTORY ${CMAKE_BINARY_DIR}/tests
+   DESTINATION ${PIGLIT_INSTALL_LIBDIR}
+   FILES_MATCHING REGEX ".*\\.xml"
 )
 
 install (
diff --git a/tests/CMakeLists.no_api.txt b/tests/CMakeLists.no_api.txt
new file mode 100644
index 000..d7f95af
--- /dev/null
+++ b/tests/CMakeLists.no_api.txt
@@ -0,0 +1,89 @@
+# Copyright © 2018 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+add_custom_target(
+   static-shader-tests
+   BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/shader.list
+   COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/find_static_tests.py ${CMAKE_CURRENT_SOURCE_DIR} 
shader ${CMAKE_CURRENT_BINARY_DIR}/shader.list
+   VERBATIM
+)
+add_custom_target(
+   static-glslparser-tests
+   BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/glslparser.list
+   COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/find_static_tests.py ${CMAKE_CURRENT_SOURCE_DIR} 
glslparser ${CMAKE_CURRENT_BINARY_DIR}/glslparser.list
+   VERBATIM
+)
+add_custom_target(
+   static-asmparser-tests
+   BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/asmparser.list
+   COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/find_static_tests.py ${CMAKE_CURRENT_SOURCE_DIR} 
asmparser ${CMAKE_CURRENT_BINARY_DIR}/asmparser.list
+   VERBATIM
+)
+add_custom_target(
+   static-program-tests
+   BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/program.list
+   COMMAND ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/find_static_tests.py ${CMAKE_CURRENT_SOURCE_DIR} 
program ${CMAKE_CURRENT_BINARY_DIR}/program.list
+   VERBATIM
+)
+
+function(piglit_generate_xml name profile meta_target extra_args)
+   add_custom_command(
+   OUTPUT ${CMAKE_BINARY_DIR}/tests/${name}.xml
+   COMMAND ${CMAKE_COMMAND} -E env 
PIGLIT_BUILD_TREE=${CMAKE_BINARY_DIR} ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${name} 
${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py ${CMAKE_BINARY_DIR}/tests/${name}.xml 
 ${extra_args}
+   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${profile}.py 
${CMAKE_CURRENT_SOURCE_DIR}/serializer.py ${ARGN}
+   VERBATIM
+   )
+   add_custom_target(
+   generate-${name}-xml
+   DEPENDS ${CMAKE_BINARY_DIR}/tests/${name}.xml
+   )
+   add_dependencies(${meta_target} generate-${name}-xml)
+endfunction()
+
+add_custom_target(gen-gl-xml)
+piglit_generate_xml(opengl opengl gen-gl-xml "")
+piglit_generate_xml(no_error no_error gen-gl-xml "")
+piglit_generate_xml(quick_gl quick_gl gen-gl-xml "")
+piglit_generate_xml(llvmpipe_gl llvmpipe_gl gen-gl-xml "")
+piglit_generate_xml(sanity sanity gen-gl-xml "")
+
+add_custom_target(gen-gl-gen-xml)
+piglit_generate_xml(glslparser glslparser gen-gl-gen-xml "" gen-gl-tests 
${CMAKE_CURRENT_BINARY_DIR}/glslparser.list 
${CMAKE_CURRENT_BINARY_DIR}/asmparser.list)
+piglit_generate_xml(glslparser_arb_compat glslparser gen-gl-gen-xml 

[Piglit] [PATCH 18/35] framework/test: make BuiltInConstantTest files relative

2018-04-04 Thread Dylan Baker
---
 framework/test/piglit_test.py |  5 +
 tests/all.py  | 26 +-
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index f5fd0c8..4fd825a 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -199,6 +199,11 @@ class BuiltInConstantsTest(PiglitBaseTest):
 
 """Test class for handling built in constants tests."""
 
+@PiglitBaseTest.command.getter
+def command(self):
+command = super(BuiltInConstantsTest, self).command
+command[1] = os.path.join(ROOT_DIR, 'tests', command[1])
+return command
 
 class PiglitCLTest(PiglitBaseTest):  # pylint: disable=too-few-public-methods
 """ OpenCL specific Test class.
diff --git a/tests/all.py b/tests/all.py
index 6aa45f0..33bca19 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1231,7 +1231,7 @@ with profile.test_list.group_manager(
 BuiltInConstantsTest,
 grouptools.join('spec', 'glsl-es-1.00')) as g:
 g(['built-in-constants_gles2',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-es-1.00', 
'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-es-1.00', 'minimum-maximums.txt')],
   'built-in constants')
 
 # Group spec/glsl-1.10
@@ -1268,7 +1268,7 @@ with profile.test_list.group_manager(
 BuiltInConstantsTest,
 grouptools.join('spec', 'glsl-1.10')) as g:
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-1.10', 'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-1.10', 'minimum-maximums.txt')],
   'built-in constants')
 
 with profile.test_list.group_manager(
@@ -1282,7 +1282,7 @@ with profile.test_list.group_manager(
 grouptools.join('spec', 'glsl-1.20')) as g:
 g(['glsl-1.20-getactiveuniform-constant'])
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-1.20', 'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-1.20', 'minimum-maximums.txt')],
   'built-in constants',
   override_class=BuiltInConstantsTest)
 
@@ -1384,7 +1384,7 @@ with profile.test_list.group_manager(
 grouptools.join('spec', 'glsl-1.30')) as g:
 g(['glsl-1.30-texel-offset-limits'], 'texel-offset-limits')
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-1.30', 'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-1.30', 'minimum-maximums.txt')],
   'built-in constants',
override_class=BuiltInConstantsTest)
 
@@ -1506,7 +1506,7 @@ with profile.test_list.group_manager(
 BuiltInConstantsTest,
 grouptools.join('spec', 'glsl-1.40')) as g:
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-1.40', 'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-1.40', 'minimum-maximums.txt')],
   'built-in constants')
 
 with profile.test_list.group_manager(
@@ -1548,7 +1548,7 @@ with profile.test_list.group_manager(
 PiglitGLTest,
 grouptools.join('spec', 'glsl-1.50')) as g:
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-1.50', 'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-1.50', 'minimum-maximums.txt')],
   'built-in constants',
   override_class=BuiltInConstantsTest)
 g(['glsl-1.50-gs-emits-too-few-verts'], 'gs-emits-too-few-verts')
@@ -1624,13 +1624,13 @@ with profile.test_list.group_manager(
 with profile.test_list.group_manager(
 BuiltInConstantsTest, grouptools.join('spec', 'glsl-3.30')) as g:
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-3.30', 'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-3.30', 'minimum-maximums.txt')],
   'built-in constants')
 
 with profile.test_list.group_manager(
 BuiltInConstantsTest, grouptools.join('spec', 'glsl-es-3.00')) as g:
 g(['built-in-constants_gles3',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-es-3.00', 
'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-es-3.00', 'minimum-maximums.txt')],
   'built-in constants')
 
 with profile.test_list.group_manager(
@@ -1641,7 +1641,7 @@ with profile.test_list.group_manager(
 with profile.test_list.group_manager(
 BuiltInConstantsTest, grouptools.join('spec', 'glsl-es-3.10')) as g:
 g(['built-in-constants_gles3',
-   os.path.join(TESTS_DIR, 'spec', 'glsl-es-3.10', 
'minimum-maximums.txt')],
+   os.path.join('spec', 'glsl-es-3.10', 'minimum-maximums.txt')],
   'built-in constants')
 
 # AMD_performance_monitor
@@ -1673,7 +1673,7 @@ with profile.test_list.group_manager(
 g(['arb_tessellation_shader-invalid-patch-vertices-range'])
 g(['arb_tessellation_shader-invalid-primitive'])
 g(['built-in-constants',
-   os.path.join(TESTS_DIR, 'spec', 'arb_tessellation_shader', 
'minimum-maximums.txt')],
+   os.path.join('spec', 'arb_tessellation_shader', 
'minimum-maximums.txt')],
   'built-in-constants',
   

[Piglit] [PATCH 17/35] tests/all: Make asmparser tests path relative

2018-04-04 Thread Dylan Baker
---
 tests/all.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index e0c7311..6aa45f0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -353,13 +353,14 @@ for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
 'asmparsertest', os.path.relpath(dirpath, _basedir)))
 type_ = os.path.basename(dirpath)
 
+dirname = os.path.relpath(dirpath, ROOT_DIR)
 for filename in filenames:
 if not os.path.splitext(filename)[1] == '.txt':
 continue
 
 group = grouptools.join(base_group, filename)
 profile.test_list[group] = ASMParserTest(
-type_, os.path.join(dirpath, filename))
+type_, os.path.join(dirname, filename))
 
 # Find and add all apitrace tests.
 classifier = DriverClassifier()
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 08/35] framework/test: add a test class for built-in constants

2018-04-04 Thread Dylan Baker
This has the same problem as asmparser tests.
---
 framework/test/piglit_test.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index c53c3e5..0986ab0 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -203,3 +203,8 @@ class ASMParserTest(PiglitBaseTest):
 def command(self):
 command = super(ASMParserTest, self).command
 return command + [os.path.join(ROOT_DIR, self.filename)]
+
+
+class BuiltInConstantsTest(PiglitBaseTest):
+
+"""Test class for handling built in constants tests."""
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 05/35] framework/test: expose required and excluded platforms

2018-04-04 Thread Dylan Baker
These need to be exposed for serialization.
---
 framework/test/piglit_test.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index 3d5b156..ef3bfdc 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -137,13 +137,13 @@ class PiglitGLTest(WindowResizeMixin, PiglitBaseTest):
 
 if not require_platforms or set(require_platforms).issubset(
 set(core.PLATFORMS)):
-self.__require_platforms = require_platforms or []
+self.require_platforms = require_platforms or []
 else:
 raise Exception("Error: require_platform is not valid")
 
 if (not exclude_platforms or
 set(exclude_platforms).issubset(set(core.PLATFORMS))):
-self.__exclude_platforms = exclude_platforms or []
+self.exclude_platforms = exclude_platforms or []
 else:
 raise Exception("Error: exclude_platforms is not valid")
 
@@ -156,16 +156,16 @@ class PiglitGLTest(WindowResizeMixin, PiglitBaseTest):
 
 """
 platform = options.OPTIONS.env['PIGLIT_PLATFORM']
-if self.__require_platforms and platform not in 
self.__require_platforms:
+if self.require_platforms and platform not in self.require_platforms:
 raise TestIsSkip(
 'Test requires one of the following platforms "{}" '
 'but the platform is "{}"'.format(
-self.__require_platforms, platform))
-elif self.__exclude_platforms and platform in self.__exclude_platforms:
+self.require_platforms, platform))
+elif self.exclude_platforms and platform in self.exclude_platforms:
 raise TestIsSkip(
 'Test cannot be run on any of the following platforms "{}" '
 'and the platform is "{}"'.format(
-self.__exclude_platforms, platform))
+self.exclude_platforms, platform))
 super(PiglitGLTest, self).is_skip()
 
 @PiglitBaseTest.command.getter
-- 
git-series 0.9.1
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 8/8] vulkan: Add some tests for glsl450 builtin functions using doubles

2018-04-04 Thread Neil Roberts
---
 .../glsl450/face-forward-double.vk_shader_test | 88 ++
 tests/vulkan/glsl450/frexp-double.vk_shader_test   | 61 +++
 tests/vulkan/glsl450/isinf-double.vk_shader_test   | 81 
 tests/vulkan/glsl450/reflect-double.vk_shader_test | 55 ++
 tests/vulkan/glsl450/refract-double.vk_shader_test | 88 ++
 5 files changed, 373 insertions(+)
 create mode 100644 tests/vulkan/glsl450/face-forward-double.vk_shader_test
 create mode 100644 tests/vulkan/glsl450/frexp-double.vk_shader_test
 create mode 100644 tests/vulkan/glsl450/isinf-double.vk_shader_test
 create mode 100644 tests/vulkan/glsl450/reflect-double.vk_shader_test
 create mode 100644 tests/vulkan/glsl450/refract-double.vk_shader_test

diff --git a/tests/vulkan/glsl450/face-forward-double.vk_shader_test 
b/tests/vulkan/glsl450/face-forward-double.vk_shader_test
new file mode 100644
index 0..3ad439059
--- /dev/null
+++ b/tests/vulkan/glsl450/face-forward-double.vk_shader_test
@@ -0,0 +1,88 @@
+[require]
+shaderFloat64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 430
+
+layout(std140, push_constant) uniform block {
+dvec2 arg0;
+dvec2 arg1;
+dvec2 arg2;
+double tolerance;
+dvec2 expected;
+};
+
+layout(location = 0) out vec4 color_out;
+
+void
+main()
+{
+dvec2 result = faceforward(arg0, arg1, arg2);
+
+color_out = (distance(result, expected) <= tolerance ?
+ vec4(0.0, 1.0, 0.0, 1.0) :
+ vec4(1.0, 0.0, 0.0, 1.0));
+}
+
+[test]
+clear color 0.0 0.0 1.0 0.0
+clear
+
+uniform dvec2 0 -0.10001 -1.2
+uniform dvec2 16 -0.10001 -1.2
+uniform dvec2 32 -0.10001 -1.2
+uniform dvec2 64 0.10001 1.2
+uniform double 48 1.2041594578792297e-05
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+uniform dvec2 0 -0.10001 -1.2
+uniform dvec2 16 -0.10001 -1.2
+uniform dvec2 32 -0.41998 0.47998
+uniform dvec2 64 -0.10001 -1.2
+uniform double 48 1.2041594578792297e-05
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+uniform dvec2 0 -0.10001 -1.2
+uniform dvec2 16 -0.41998 0.47998
+uniform dvec2 32 -0.10001 -1.2
+uniform dvec2 64 -0.10001 -1.2
+uniform double 48 1.2041594578792297e-05
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+uniform dvec2 0 -0.10001 -1.2
+uniform dvec2 16 -0.41998 0.47998
+uniform dvec2 32 -0.41998 0.47998
+uniform dvec2 64 0.10001 1.2
+uniform double 48 1.2041594578792297e-05
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+uniform dvec2 0 -0.41998 0.47998
+uniform dvec2 16 -0.10001 -1.2
+uniform dvec2 32 -0.10001 -1.2
+uniform dvec2 64 0.41998 -0.47998
+uniform double 48 6.3780874876407897e-06
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+uniform dvec2 0 -0.41998 0.47998
+uniform dvec2 16 -0.10001 -1.2
+uniform dvec2 32 -0.41998 0.47998
+uniform dvec2 64 -0.41998 0.47998
+uniform double 48 6.3780874876407897e-06
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+uniform dvec2 0 -0.41998 0.47998
+uniform dvec2 16 -0.41998 0.47998
+uniform dvec2 32 -0.10001 -1.2
+uniform dvec2 64 -0.41998 0.47998
+uniform double 48 6.3780874876407897e-06
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+uniform dvec2 0 -0.41998 0.47998
+uniform dvec2 16 -0.41998 0.47998
+uniform dvec2 32 -0.41998 0.47998
+uniform dvec2 64 0.41998 -0.47998
+uniform double 48 6.3780874876407897e-06
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/vulkan/glsl450/frexp-double.vk_shader_test 
b/tests/vulkan/glsl450/frexp-double.vk_shader_test
new file mode 100644
index 0..1fbae50b1
--- /dev/null
+++ b/tests/vulkan/glsl450/frexp-double.vk_shader_test
@@ -0,0 +1,61 @@
+[require]
+shaderFloat64
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 430
+
+layout(location = 0) out vec4 color;
+
+layout(std140, push_constant) uniform block {
+dvec4 given_doub;
+dvec4 expected_mantissa;
+ivec4 expected_exponent;
+};
+
+void main()
+{
+   /* Green if both pass. */
+   color = vec4(0.0, 1.0, 0.0, 1.0);
+
+   ivec4 exponent;
+   dvec4 mantissa;
+
+   mantissa = frexp(given_doub, exponent);
+
+   if (mantissa != expected_mantissa) {
+   color.r = 1.0;
+   }
+
+   if (exponent != expected_exponent) {
+   color.b = 1.0;
+   }
+}
+
+[test]
+uniform dvec4 0 0.0 -0.0 0.5 -0.5
+uniform dvec4 

[Piglit] [PATCH 7/8] framework: Add a vulkan tests profile

2018-04-04 Thread Neil Roberts
This searches for files named *.vk_shader_test in the tests/vulkan
directory and runs them with VkRunner.
---
 framework/test/vk_shader_test.py | 39 +++
 tests/vulkan.py  | 30 ++
 2 files changed, 69 insertions(+)
 create mode 100644 framework/test/vk_shader_test.py
 create mode 100644 tests/vulkan.py

diff --git a/framework/test/vk_shader_test.py b/framework/test/vk_shader_test.py
new file mode 100644
index 0..e6eab0e15
--- /dev/null
+++ b/framework/test/vk_shader_test.py
@@ -0,0 +1,39 @@
+# Copyright (C) 2018 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# This permission notice shall be included in all copies or
+# substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+# PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHOR(S) BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+""" This module enables running VkRunner shader tests. """
+
+from .piglit_test import PiglitBaseTest
+
+__all__ = [
+'VkShaderTest',
+]
+
+
+class VkShaderTest(PiglitBaseTest):
+""" Make a PiglitTest instance for a VkRunner shader test file """
+
+def __init__(self, filename):
+super(VkShaderTest, self).__init__(
+['vkrunner', filename],
+run_concurrent=True)
diff --git a/tests/vulkan.py b/tests/vulkan.py
new file mode 100644
index 0..e9c48f6a4
--- /dev/null
+++ b/tests/vulkan.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""All Vulkan tests that come with piglit, using default settings."""
+
+import os
+
+from framework.profile import TestProfile
+from framework.test import PiglitCLTest
+from framework import grouptools
+from framework.test.vk_shader_test import VkShaderTest
+from .py_modules.constants import TESTS_DIR, GENERATED_TESTS_DIR
+
+__all__ = ['profile']
+
+profile = TestProfile()
+
+# Find and add all shader tests.
+for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
+_basedir = os.path.join(basedir, 'vulkan')
+for dirpath, _, filenames in os.walk(_basedir):
+groupname = grouptools.from_path(os.path.relpath(dirpath, _basedir))
+for filename in filenames:
+testname, ext = os.path.splitext(filename)
+if ext != '.vk_shader_test':
+continue
+test = VkShaderTest(os.path.join(dirpath, filename))
+group = grouptools.join(groupname, testname)
+assert group not in profile.test_list, group
+
+profile.test_list[group] = test
-- 
2.14.3

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 5/8] framework: Add a Vulkan platform

2018-04-04 Thread Neil Roberts
This defaults to building only on Linux as with the GLES platforms
because later patches add code using fork/exec which will need porting
to compile on Windows.
---
 CMakeLists.txt |  7 +++
 cmake/piglit_util.cmake|  2 +-
 cmake/target_api/CMakeLists.txt|  4 
 cmake/target_api/vulkan/CMakeLists.txt | 10 ++
 tests/CMakeLists.txt   |  4 
 tests/vulkan/CMakeLists.txt|  0
 6 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 cmake/target_api/vulkan/CMakeLists.txt
 create mode 100644 tests/vulkan/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4259ec832..8de61fa13 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,8 +35,10 @@ endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(PIGLIT_BUILD_GLES_TESTS_DEFAULT ON)
+   set(PIGLIT_BUILD_VULKAN_TESTS_DEFAULT ON)
 else()
set(PIGLIT_BUILD_GLES_TESTS_DEFAULT OFF)
+   set(PIGLIT_BUILD_VULKAN_TESTS_DEFAULT OFF)
 endif()
 
 option(PIGLIT_BUILD_GL_TESTS "Build tests for OpenGL" ON)
@@ -44,6 +46,7 @@ option(PIGLIT_BUILD_GLES1_TESTS "Build tests for OpenGL ES1" 
${PIGLIT_BUILD_GLES
 option(PIGLIT_BUILD_GLES2_TESTS "Build tests for OpenGL ES2" 
${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
 option(PIGLIT_BUILD_GLES3_TESTS "Build tests for OpenGL ES3" 
${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
 option(PIGLIT_BUILD_CL_TESTS "Build tests for OpenCL" OFF)
+option(PIGLIT_BUILD_VULKAN_TESTS "Build tests for Vulkan" 
${PIGLIT_BUILD_VULKAN_TESTS_DEFAULT})
 
 if(PIGLIT_BUILD_GL_TESTS)
find_package(OpenGL REQUIRED)
@@ -128,6 +131,10 @@ if(PIGLIT_BUILD_CL_TESTS)
find_package(OpenCL REQUIRED)
 endif(PIGLIT_BUILD_CL_TESTS)
 
+if(PIGLIT_BUILD_VULKAN_TESTS)
+   pkg_check_modules(VULKAN REQUIRED vulkan)
+endif(PIGLIT_BUILD_VULKAN_TESTS)
+
 IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(X11_FOUND AND OPENGL_gl_LIBRARY)
# Assume the system has GLX. In the future, systems may exist
diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
index 918ea8421..1f9501b66 100644
--- a/cmake/piglit_util.cmake
+++ b/cmake/piglit_util.cmake
@@ -29,7 +29,7 @@ function(piglit_include_target_api)
 # Verify that the value of `piglit_target_api` is valid.
 set(valid_api FALSE)
 
-foreach(api "gl" "gles1" "gles2" "gles3" "cl" "no_api")
+foreach(api "gl" "gles1" "gles2" "gles3" "cl" "vulkan" "no_api")
 if(piglit_target_api STREQUAL ${api})
 set(valid_api TRUE)
 break()
diff --git a/cmake/target_api/CMakeLists.txt b/cmake/target_api/CMakeLists.txt
index 3a0b67f6b..2c89d28bc 100644
--- a/cmake/target_api/CMakeLists.txt
+++ b/cmake/target_api/CMakeLists.txt
@@ -42,3 +42,7 @@ endif(PIGLIT_BUILD_GLES3_TESTS)
 if(PIGLIT_BUILD_CL_TESTS)
add_subdirectory(cl)
 endif(PIGLIT_BUILD_CL_TESTS)
+
+if(PIGLIT_BUILD_VULKAN_TESTS)
+   add_subdirectory(vulkan)
+endif(PIGLIT_BUILD_VULKAN_TESTS)
diff --git a/cmake/target_api/vulkan/CMakeLists.txt 
b/cmake/target_api/vulkan/CMakeLists.txt
new file mode 100644
index 0..ce5d2c1f3
--- /dev/null
+++ b/cmake/target_api/vulkan/CMakeLists.txt
@@ -0,0 +1,10 @@
+set(piglit_target_api "vulkan")
+
+add_definitions(
+   -DUSE_VULKAN
+   )
+
+add_subdirectory(${piglit_SOURCE_DIR}/tests
+   ${piglit_BINARY_DIR}/target_api/${piglit_target_api}/tests
+   )
+
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c588dfca5..58c4a39ff 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -25,3 +25,7 @@ ENDIF(EGL_FOUND)
 IF(PIGLIT_BUILD_CL_TESTS)
add_subdirectory (cl)
 ENDIF(PIGLIT_BUILD_CL_TESTS)
+
+IF(PIGLIT_BUILD_VULKAN_TESTS)
+   add_subdirectory (vulkan)
+ENDIF(PIGLIT_BUILD_VULKAN_TESTS)
diff --git a/tests/vulkan/CMakeLists.txt b/tests/vulkan/CMakeLists.txt
new file mode 100644
index 0..e69de29bb
-- 
2.14.3

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 00/35] Serialize profiles into XML at build time

2018-04-04 Thread Marek Olšák
Is this use case affected?

piglit run --deqp-mustpass-list --process-isolation 0 -p gbm -c quick
cts_gl45 deqp_gles2 deqp_gles3 deqp_gles31

Yes, that is just 1 command to run all those test suites at the same time.

I use my personal "deqp" piglit branch that also disables process isolation
for glcts and deqp, and parses the deqp mustpass lists which are in txt
files.

Marek


On Wed, Apr 4, 2018 at 6:26 PM, Dylan Baker  wrote:

> I don't expect everyone I've CC'd to give thorough review (or any
> review), I've mostly CC'd people who I think would be interested in this
> work, or who's work flow I might be altered by it.
>
> Piglit has struggled to cope with the growing number of tests that it
> contains, especially with startup time. Piglit has always calculated
> tests at runtime, which was not a problem when there were only a few
> hundred or even thousand tests. Piglit now has roughly 55,000
> OpenGL/OpenGL ES tests, which is a lot to calculate at start up. It also
> means that piglit needs to keep a python object for each of those tests
> in memory, which has sent the resident memory usage soaring. We've also
> moved to automatic test discovery for glslparser, asmparser, and shader
> tests, which is very convenient and reduces typing, but further
> increases the amount of time spent starting up. This has even made
> features which decrease runtime, like fast skipping, hurt startup
> performance, making it a less than desirable tradeoff in some cases.
> Even on a relatively fast machine with an nvme disk 15-20 seconds is not
> an unheard of startup time. That might be okay to run 55,000 tests, but
> not if you only need a dozen, such as when bisecting.
>
> This series is my proposal to fix that, mainly by moving much of that
> cost to build time. This series creates the infrastructure build XML
> base profiles at build time, which are installed with piglit instead of
> the python profiles. These profiles are lazily iterated over to ease
> memory usage, test objects are created as they are run, and python can
> garbage collect them as soon as they are done running. Along with that
> any filters applied to profiles (like removing 80% of the vs_in shader
> tests in quick) are done before the profile is serialized, and all fast
> skipping information is collected at build time as well, and encoded in
> the XML. All this means that start times are vastly reduced.
>
> For example:
> XML profiles
> quick: 0.5
> shader: 0.5
>
> master
> quick: 11.6
> shader: 7.3
>
> This series also implements some optimizations for running without
> filters or test-lists, if you add a filter quick would take 2.5
> seconds, because that is necessary to calculate the total number of
> tests before starting.
>
> To keep classic profiles like all, quick, quick_cl, gpu, cpu, and
> llvmpipe working this series adds meta profiles, small XML snippets that
> list other profiles. These can contain other meta profiles, xml
> profiles, or python profiles. This means that for most uses cases your
> existing command line will still work, `./piglit run quick out -c` will
> still do exactly the same thing as before, just faster.
>
> The XML generated is dumb, there is no encoding of options or logic. An
> early version of this series did contain logic and options, but the
> result was pretty terrible. It was very hard to read, and the code to
> handle it was very complicated. I've chosen not to go down that path.
> There are drawbacks, some things that relied on run time generation have
> cannot be handled the same way, among them the "multi shader" concept,
> where shader_runner consumes a directory of shader_tests at a time. This
> was previously handled via a --process-isolation=false flag, now its
> encoded into profiles, "shader_multi" and "quick_shader_multi"; there
> was also an option to use glslparsertest with ES shaders and
> ARB_ES_compatibility, that is now "glslparser_arb_compat". I haven't
> added metaprofiles for these cases, although we certainly could (or you
> can write your own, the schema is dead simple), so `./piglit run quick
> out --process-isolation=false` is now `./piglit run quick_gl glslparser
> quick_shader_multi out`.
>
> I've run this through our CI extensively, and gotten green results out
> of it across the board.
>
> I know this is a big series, but piglit makes a lot of assumptions about
> the
> test profiles being created at runtime, and we've had to changes those
> assumptions.
>
>
> Dylan Baker (35):
>   update git ignore for this series
>   test/piglit_test: add ROOT_DIR variable
>   framework/profile: Allow a group manager class to be overwritten
>   framework/test: Use getter for altering PiglitBaseTest Command
>   framework/test: expose required and excluded platforms
>   framework/profile: Add a __len__ method to TestProfile
>   framework: Use custom class for ASM parser tests
>   framework/test: add a test class for built-in constants
>   tests: use 

[Piglit] [PATCH 1/8] util: Add a PIGLIT_STRINGIFY macro

2018-04-04 Thread Neil Roberts
---
 tests/util/piglit-util.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 0a5eab810..3dfb5d6c5 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -162,6 +162,8 @@ piglit_register_subtests(const char *names[]);
 #define MIN3(a, b, c) MIN2(MIN2((a), (b)), (c))
 #define MAX3(a, b, c) MAX2(MAX2((a), (b)), (c))
 #define ALIGN(value, alignment) (((value) + alignment - 1) & ~(alignment - 1))
+#define PIGLIT_STRINGIFY(macro_or_string) PIGLIT_STRINGIFY_ARG 
(macro_or_string)
+#define PIGLIT_STRINGIFY_ARG(contents) #contents
 
 /**
  * Utility macro that checks for a given opengl error, and report a
-- 
2.14.3

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 3/8] util: Add a libutil_vulkan library

2018-04-04 Thread Neil Roberts
This is currently no different from libutil but it is added anyway to
match the other APIs.
---
 tests/util/CMakeLists.vulkan.txt | 15 +++
 tests/util/piglit-util-vulkan.c  |  1 +
 2 files changed, 16 insertions(+)
 create mode 100644 tests/util/CMakeLists.vulkan.txt
 create mode 100644 tests/util/piglit-util-vulkan.c

diff --git a/tests/util/CMakeLists.vulkan.txt b/tests/util/CMakeLists.vulkan.txt
new file mode 100644
index 0..05db785e4
--- /dev/null
+++ b/tests/util/CMakeLists.vulkan.txt
@@ -0,0 +1,15 @@
+include_directories(
+   ${UTIL_INCLUDES}
+   ${VULKAN_INCLUDE_PATH}
+   )
+
+link_libraries(
+   piglitutil
+   ${link_opts}
+   )
+
+piglit_add_library (piglitutil_${piglit_target_api}
+   piglit-util-vulkan.c
+)
+
+# vim: ft=cmake:
diff --git a/tests/util/piglit-util-vulkan.c b/tests/util/piglit-util-vulkan.c
new file mode 100644
index 0..9e4274691
--- /dev/null
+++ b/tests/util/piglit-util-vulkan.c
@@ -0,0 +1 @@
+/* STUB */
-- 
2.14.3

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 0/8] Vulkan testing with VkRunner

2018-04-04 Thread Neil Roberts
This series sets up a framework for testing Vulkan in Piglit. The main
thing is to import a tool like shader_runner called VkRunner. There
are also 5 actual tests which mainly serve as examples.

The code for VkRunner was developed as a standalone project here:

https://github.com/igalia/vkrunner

If this branch gets merged it would probably make sense to abandon
that repo and have Piglit as the canonical source for the code.

Eventually we could probably get a lot of testing fairly cheaply by
modifying some of the generated_tests scripts to also generate Vulkan
tests. It might even be worth semi-automatically converting existing
GL shader tests using something similar to the script on the
GL_ARB_gl_spirv branch.

For a general overview of VkRunner you might like to take a look at
this blog post:

https://blogs.igalia.com/nroberts/2018/04/03/vkrunner-a-shader-test-tool-for-vulkan/

Neil Roberts (8):
  util: Add a PIGLIT_STRINGIFY macro
  util: Add a piglit_fatal utility
  util: Add a libutil_vulkan library
  util: Move the half float functions from util-gl to util
  framework: Add a Vulkan platform
  Import VkRunner
  framework: Add a vulkan tests profile
  vulkan: Add some tests for glsl450 builtin functions using doubles

 CMakeLists.txt |7 +
 cmake/piglit_util.cmake|2 +-
 cmake/target_api/CMakeLists.txt|4 +
 cmake/target_api/vulkan/CMakeLists.txt |   10 +
 framework/test/vk_shader_test.py   |   39 +
 tests/CMakeLists.txt   |4 +
 tests/util/CMakeLists.vulkan.txt   |   15 +
 tests/util/piglit-util-gl.c|   90 --
 tests/util/piglit-util-gl.h|   29 -
 tests/util/piglit-util-vulkan.c|1 +
 tests/util/piglit-util.c   |  105 ++
 tests/util/piglit-util.h   |   32 +
 tests/vulkan.py|   30 +
 tests/vulkan/CMakeLists.txt|1 +
 .../glsl450/face-forward-double.vk_shader_test |   88 ++
 tests/vulkan/glsl450/frexp-double.vk_shader_test   |   61 +
 tests/vulkan/glsl450/isinf-double.vk_shader_test   |   81 +
 tests/vulkan/glsl450/reflect-double.vk_shader_test |   55 +
 tests/vulkan/glsl450/refract-double.vk_shader_test |   88 ++
 tests/vulkan/vkrunner/CMakeLists.txt   |1 +
 tests/vulkan/vkrunner/CMakeLists.vulkan.txt|   46 +
 tests/vulkan/vkrunner/README.md|  125 ++
 tests/vulkan/vkrunner/main.c   |  160 ++
 tests/vulkan/vkrunner/make-formats.py  |   93 ++
 tests/vulkan/vkrunner/vr-allocate-store.c  |  181 +++
 tests/vulkan/vkrunner/vr-allocate-store.h  |   48 +
 tests/vulkan/vkrunner/vr-buffer.c  |   87 ++
 tests/vulkan/vkrunner/vr-buffer.h  |   73 +
 tests/vulkan/vkrunner/vr-config.c  |  117 ++
 tests/vulkan/vkrunner/vr-config.h  |   49 +
 tests/vulkan/vkrunner/vr-error-message.c   |   41 +
 tests/vulkan/vkrunner/vr-error-message.h   |   35 +
 tests/vulkan/vkrunner/vr-feature-offsets.c |   92 ++
 tests/vulkan/vkrunner/vr-feature-offsets.h |   39 +
 tests/vulkan/vkrunner/vr-flush-memory.c|   52 +
 tests/vulkan/vkrunner/vr-flush-memory.h|   37 +
 tests/vulkan/vkrunner/vr-format-table.h| 1580 
 tests/vulkan/vkrunner/vr-format.c  |  289 
 tests/vulkan/vkrunner/vr-format.h  |   86 ++
 tests/vulkan/vkrunner/vr-list.c|   89 ++
 tests/vulkan/vkrunner/vr-list.h|  122 ++
 tests/vulkan/vkrunner/vr-pipeline.c|  668 +
 tests/vulkan/vkrunner/vr-pipeline.h|   54 +
 tests/vulkan/vkrunner/vr-script.c  |  948 
 tests/vulkan/vkrunner/vr-script.h  |  146 ++
 tests/vulkan/vkrunner/vr-subprocess.c  |   61 +
 tests/vulkan/vkrunner/vr-subprocess.h  |   34 +
 tests/vulkan/vkrunner/vr-test.c|  569 +++
 tests/vulkan/vkrunner/vr-test.h|   40 +
 tests/vulkan/vkrunner/vr-vbo.c |  637 
 tests/vulkan/vkrunner/vr-vbo.h |   77 +
 tests/vulkan/vkrunner/vr-vk-core-funcs.h   |1 +
 tests/vulkan/vkrunner/vr-vk-device-funcs.h |   56 +
 tests/vulkan/vkrunner/vr-vk-instance-funcs.h   |9 +
 tests/vulkan/vkrunner/vr-vk.c  |  148 ++
 tests/vulkan/vkrunner/vr-vk.h  |   56 +
 tests/vulkan/vkrunner/vr-window.c  |  678 +
 tests/vulkan/vkrunner/vr-window.h  |   73 +
 58 files changed, 8319 insertions(+), 120 deletions(-)
 create mode 100644 cmake/target_api/vulkan/CMakeLists.txt
 create mode 100644 

[Piglit] [PATCH 2/8] util: Add a piglit_fatal utility

2018-04-04 Thread Neil Roberts
This prints a formatted error and then aborts.
---
 tests/util/piglit-util.c | 16 
 tests/util/piglit-util.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index ed7d21c95..a79db3fb7 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -867,3 +867,19 @@ piglit_free_aligned(void *p)
free(p);
 #endif
 }
+
+void
+piglit_fatal(const char *format, ...)
+{
+   va_list ap;
+
+   va_start(ap, format);
+   vfprintf(stderr, format, ap);
+   va_end(ap);
+
+   fputc('\n', stderr);
+
+   fflush(stderr);
+
+   abort();
+}
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 3dfb5d6c5..3c9ca9fce 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -460,6 +460,8 @@ piglit_alloc_aligned(size_t alignment, size_t size);
 void
 piglit_free_aligned(void *p);
 
+NORETURN void
+piglit_fatal(const char *format, ...) PRINTFLIKE(1, 2);
 
 #ifdef __cplusplus
 } /* end extern "C" */
-- 
2.14.3

___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 4/8] util: Move the half float functions from util-gl to util

2018-04-04 Thread Neil Roberts
They will be equally useful on Vulkan.
---
 tests/util/piglit-util-gl.c | 90 -
 tests/util/piglit-util-gl.h | 29 ---
 tests/util/piglit-util.c| 89 
 tests/util/piglit-util.h| 28 ++
 4 files changed, 117 insertions(+), 119 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 3a41a5eb0..1b978422f 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -296,96 +296,6 @@ piglit_set_tolerance_for_bits(int rbits, int gbits, int 
bbits, int abits)
}
 }
 
-typedef union { GLfloat f; GLint i; } fi_type;
-
-/**
- * Convert a 4-byte float to a 2-byte half float.
- * Based on code from:
- * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
- *
- * Taken over from Mesa.
- */
-unsigned short
-piglit_half_from_float(float val)
-{
-   const fi_type fi = {val};
-   const int flt_m = fi.i & 0x7f;
-   const int flt_e = (fi.i >> 23) & 0xff;
-   const int flt_s = (fi.i >> 31) & 0x1;
-   int s, e, m = 0;
-   unsigned short result;
-
-   /* sign bit */
-   s = flt_s;
-
-   /* handle special cases */
-   if ((flt_e == 0) && (flt_m == 0)) {
-   /* zero */
-   /* m = 0; - already set */
-   e = 0;
-   }
-   else if ((flt_e == 0) && (flt_m != 0)) {
-   /* denorm -- denorm float maps to 0 half */
-   /* m = 0; - already set */
-   e = 0;
-   }
-   else if ((flt_e == 0xff) && (flt_m == 0)) {
-   /* infinity */
-   /* m = 0; - already set */
-   e = 31;
-   }
-   else if ((flt_e == 0xff) && (flt_m != 0)) {
-   /* NaN */
-   m = 1;
-   e = 31;
-   }
-   else {
-   /* regular number */
-   const int new_exp = flt_e - 127;
-   if (new_exp < -24) {
-   /* this maps to 0 */
-   /* m = 0; - already set */
-   e = 0;
-   }
-   else if (new_exp < -14) {
-   /* this maps to a denorm */
-   /* 2^-exp_val*/
-   unsigned int exp_val = (unsigned int) (-14 - new_exp);
-
-   e = 0;
-   switch (exp_val) {
-   case 0:
-   /* m = 0; - already set */
-   break;
-   case 1: m = 512 + (flt_m >> 14); break;
-   case 2: m = 256 + (flt_m >> 15); break;
-   case 3: m = 128 + (flt_m >> 16); break;
-   case 4: m = 64 + (flt_m >> 17); break;
-   case 5: m = 32 + (flt_m >> 18); break;
-   case 6: m = 16 + (flt_m >> 19); break;
-   case 7: m = 8 + (flt_m >> 20); break;
-   case 8: m = 4 + (flt_m >> 21); break;
-   case 9: m = 2 + (flt_m >> 22); break;
-   case 10: m = 1; break;
-   }
-   }
-   else if (new_exp > 15) {
-   /* map this value to infinity */
-   /* m = 0; - already set */
-   e = 31;
-   }
-   else {
-   /* regular */
-   e = new_exp + 15;
-   m = flt_m >> 13;
-   }
-   }
-
-   result = (s << 15) | (e << 10) | m;
-   return result;
-}
-
-
 /**
  * Return block size info for a specific texture compression format.
  * \param  bw returns the block width, in pixels
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index 7b1cee564..db0b1b60d 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -29,9 +29,6 @@
 extern "C" {
 #endif
 
-#include 
-#include 
-
 #include "piglit-util.h"
 
 #include 
@@ -248,32 +245,6 @@ GLvoid piglit_draw_rect_back(float x, float y, float w, 
float h);
 void piglit_draw_rect_from_arrays(const void *verts, const void *tex,
  bool use_patches, unsigned instance_count);
 
-unsigned short piglit_half_from_float(float val);
-
-/**
- * Wrapper for piglit_half_from_float() which allows using an exact
- * hex bit pattern to generate a half float value.
- */
-static inline unsigned short
-strtohf_hex(const char *nptr, char **endptr)
-{
-   /* skip spaces and tabs */
-   while (*nptr == ' ' || *nptr == '\t')
-   nptr++;
-
-   if (strncmp(nptr, "0x", 2) == 0) {
-   uint32_t u = strtoul(nptr, endptr, 16);
-   if (u > USHRT_MAX) {
-   errno = ERANGE;
-   return USHRT_MAX;
-   } else {
-   return u;
-   }
-   } else {
-  

Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected error when querying a level which hasn't been explicitly defined

2018-04-04 Thread Juan A. Suarez Romero
On Wed, 2018-03-28 at 11:15 -0400, Anthony Pesch wrote:
> From: Anthony Pesch 
> 
> Change expected error from INVALID_OPERATION to INVALID_VALUE when querying
> a level which hasn't been explicitly defined. This is a valid operation, the
> error set should be due to the requested width and height being greater than
> the default width and height of zero.

I have some doubts with this patch. I've been checking OpenGL 4.5 spec, section
8.11.4 Texture Image Queries, and this is what I found:

"An INVALID_VALUE error is generated if level is negative or larger than the
maximum allowable level."


In this case, level is 4, so we aren't in this case, as the level is not
negative, and it is smaller than the maximum allowable level (15, the
implementation I use).


So really don't know what should be the expected error, INVALID_OPERATION or
INVALID_VALUE.


J.A.



>  tests/spec/arb_get_texture_sub_image/errors.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/spec/arb_get_texture_sub_image/errors.c 
> b/tests/spec/arb_get_texture_sub_image/errors.c
> index 34fec4a95..57875fa6a 100644
> --- a/tests/spec/arb_get_texture_sub_image/errors.c
> +++ b/tests/spec/arb_get_texture_sub_image/errors.c
> @@ -200,7 +200,7 @@ test_invalid_values(void)
>8, 8, 1, /* size */
>GL_RGBA, GL_FLOAT,  /* bad enum */
>sizeof(buffer), buffer);
> - if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> + if (!piglit_check_gl_error(GL_INVALID_VALUE))
>   pass = false;
>  
>   /* Test getting invalid offset */
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] arb_get_texture_sub_image: fix depth parameter when performing zero-sized texture queries

2018-04-04 Thread Juan A. Suarez Romero
On Wed, 2018-03-28 at 11:15 -0400, Anthony Pesch wrote:
> From: Anthony Pesch 
> 
> Change zero-sized texture queries to pass a valid depth parameter, otherwise
> they should error as per the OpenGL 4.6 Core spec:
> 
> "An INVALID_VALUE error is generated if the effective target is TEXTURE_1D,
> TEXTURE_1D_ARRAY, TEXTURE_2D or TEXTURE_RECTANGLE, and either zoffset is not
> zero, or depth is not one."

For this patch:

Reviewed-by: Juan A. Suarez 


J.A.

> ---
>  tests/spec/arb_get_texture_sub_image/errors.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/spec/arb_get_texture_sub_image/errors.c 
> b/tests/spec/arb_get_texture_sub_image/errors.c
> index 57875fa6a..1e7b17115 100644
> --- a/tests/spec/arb_get_texture_sub_image/errors.c
> +++ b/tests/spec/arb_get_texture_sub_image/errors.c
> @@ -293,7 +293,7 @@ test_zero_size_image(void)
>   /* getting 0x0 image from 8x8 source should work */
>   glGetTextureSubImage(tex, 0,
>0, 0, 0,
> -  0, 0, 0,
> +  0, 0, 1,
>GL_RGBA, GL_UNSIGNED_BYTE,
>sizeof(image), image);
>   if (!piglit_check_gl_error(GL_NO_ERROR))
> @@ -306,7 +306,7 @@ test_zero_size_image(void)
>   /* getting 0x0 image from 0x0 source should work */
>   glGetTextureSubImage(tex, 0,
>0, 0, 0,
> -  0, 0, 0,
> +  0, 0, 1,
>GL_RGBA, GL_UNSIGNED_BYTE,
>sizeof(image), image);
>   if (!piglit_check_gl_error(GL_NO_ERROR))
> @@ -315,7 +315,7 @@ test_zero_size_image(void)
>   /* getting 0x0 image at an offset from 0x0 source should error */
>   glGetTextureSubImage(tex, 0,
>1, 2, 0,  /* offset */
> -  0, 0, 0,
> +  0, 0, 1,
>GL_RGBA, GL_UNSIGNED_BYTE,
>sizeof(image), image);
>   if (!piglit_check_gl_error(GL_INVALID_VALUE))
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected error when querying a level which hasn't been explicitly defined

2018-04-04 Thread Anthony Pesch
Hey Juan,

The change from INVALID_OPERATION to INVALID_VALUE isn't because the level 
value is invalid.

The level is valid, however, the level hasn't been explicitly defined so it 
should have a default width and height of 0, making the 8x8 query invalid.

From the OpenGL 4.6 spec, 8.22 Texture State and Proxy State:
"Each initial texture image is null. It has zero width, height, and depth,  
internal format RGBA, or R8 for buffer textures, component sizes set to zero 
and component types set to NONE, the compressed flag set to FALSE, a zero 
compressed size, and the bound buffer object name is zero."

From the GetTextureSubImage errors in 8.11.4:
"An INVALID_VALUE error is generated if xoffset + width is greater than the  
texture’s  width, yoffset + height is  greater  than  the  texture’s  height,  
or zoffset + depth is greater than the texture’s depth."

 - Anthony


From: Piglit  on behalf of Juan A. Suarez 
Romero 
Sent: Wednesday, April 4, 2018 7:12 AM
To: Anthony Pesch; piglit@lists.freedesktop.org
Subject: Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected error 
when querying a level which hasn't been explicitly defined

On Wed, 2018-03-28 at 11:15 -0400, Anthony Pesch wrote:
> From: Anthony Pesch 
>
> Change expected error from INVALID_OPERATION to INVALID_VALUE when querying
> a level which hasn't been explicitly defined. This is a valid operation, the
> error set should be due to the requested width and height being greater than
> the default width and height of zero.

I have some doubts with this patch. I've been checking OpenGL 4.5 spec, section
8.11.4 Texture Image Queries, and this is what I found:

"An INVALID_VALUE error is generated if level is negative or larger than the
maximum allowable level."


In this case, level is 4, so we aren't in this case, as the level is not
negative, and it is smaller than the maximum allowable level (15, the
implementation I use).


So really don't know what should be the expected error, INVALID_OPERATION or
INVALID_VALUE.


J.A.



>  tests/spec/arb_get_texture_sub_image/errors.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/arb_get_texture_sub_image/errors.c 
> b/tests/spec/arb_get_texture_sub_image/errors.c
> index 34fec4a95..57875fa6a 100644
> --- a/tests/spec/arb_get_texture_sub_image/errors.c
> +++ b/tests/spec/arb_get_texture_sub_image/errors.c
> @@ -200,7 +200,7 @@ test_invalid_values(void)
>8, 8, 1, /* size */
>GL_RGBA, GL_FLOAT,  /* bad enum */
>sizeof(buffer), buffer);
> - if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> + if (!piglit_check_gl_error(GL_INVALID_VALUE))
>   pass = false;
>
>   /* Test getting invalid offset */
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected error when querying a level which hasn't been explicitly defined

2018-04-04 Thread Juan A. Suarez Romero
On Wed, 2018-04-04 at 15:04 +, Anthony Pesch wrote:
> Hey Juan,
> 
> The change from INVALID_OPERATION to INVALID_VALUE isn't because the level 
> value is invalid.
> 
> The level is valid, however, the level hasn't been explicitly defined so it 
> should have a default width and height of 0, making the 8x8 query invalid.
> 
> From the OpenGL 4.6 spec, 8.22 Texture State and Proxy State:
> "Each initial texture image is null. It has zero width, height, and depth,  
> internal format RGBA, or R8 for buffer textures, component sizes set to zero 
> and component types set to NONE, the compressed flag set to FALSE, a zero 
> compressed size, and the bound buffer object name is zero."
> 
> From the GetTextureSubImage errors in 8.11.4:
> "An INVALID_VALUE error is generated if xoffset + width is greater than the  
> texture’s  width, yoffset + height is  greater  than  the  texture’s  height, 
>  or zoffset + depth is greater than the texture’s depth."
> 


Thanks for the info!

I think your assumption is correct: all non-defined levels have an empty
initialized empty.

Do you mind to include such OpenGL reference in the commit message?

With that,

Reviewed-by: Juan A. Suarez 

>  - Anthony
> 
> 
> From: Piglit  on behalf of Juan A. 
> Suarez Romero 
> Sent: Wednesday, April 4, 2018 7:12 AM
> To: Anthony Pesch; piglit@lists.freedesktop.org
> Subject: Re: [Piglit] [PATCH 1/3] arb_get_texture_sub_image: fix expected 
> error when querying a level which hasn't been explicitly defined
> 
> On Wed, 2018-03-28 at 11:15 -0400, Anthony Pesch wrote:
> > From: Anthony Pesch 
> > 
> > Change expected error from INVALID_OPERATION to INVALID_VALUE when querying
> > a level which hasn't been explicitly defined. This is a valid operation, the
> > error set should be due to the requested width and height being greater than
> > the default width and height of zero.
> 
> I have some doubts with this patch. I've been checking OpenGL 4.5 spec, 
> section
> 8.11.4 Texture Image Queries, and this is what I found:
> 
> "An INVALID_VALUE error is generated if level is negative or larger than the
> maximum allowable level."
> 
> 
> In this case, level is 4, so we aren't in this case, as the level is not
> negative, and it is smaller than the maximum allowable level (15, the
> implementation I use).
> 
> 
> So really don't know what should be the expected error, INVALID_OPERATION or
> INVALID_VALUE.
> 
> 
> J.A.
> 
> 
> 
> >  tests/spec/arb_get_texture_sub_image/errors.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/spec/arb_get_texture_sub_image/errors.c 
> > b/tests/spec/arb_get_texture_sub_image/errors.c
> > index 34fec4a95..57875fa6a 100644
> > --- a/tests/spec/arb_get_texture_sub_image/errors.c
> > +++ b/tests/spec/arb_get_texture_sub_image/errors.c
> > @@ -200,7 +200,7 @@ test_invalid_values(void)
> >8, 8, 1, /* size */
> >GL_RGBA, GL_FLOAT,  /* bad enum */
> >sizeof(buffer), buffer);
> > - if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> > + if (!piglit_check_gl_error(GL_INVALID_VALUE))
> >   pass = false;
> > 
> >   /* Test getting invalid offset */
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Add test for call stack realignment

2018-04-04 Thread Jan Vesely
On Tue, 2018-04-03 at 18:03 -0400, Matt Arsenault wrote:
> ping
> 
> > On Mar 29, 2018, at 10:35, Matt Arsenault  wrote:
> > 
> > ---
> > tests/cl/program/execute/realign-stack.cl | 96 
> > +++
> > 1 file changed, 96 insertions(+)
> > create mode 100644 tests/cl/program/execute/realign-stack.cl
> > 
> > diff --git a/tests/cl/program/execute/realign-stack.cl 
> > b/tests/cl/program/execute/realign-stack.cl
> > new file mode 100644
> > index 0..ed62ea211
> > --- /dev/null
> > +++ b/tests/cl/program/execute/realign-stack.cl
> > @@ -0,0 +1,96 @@
> > +/*!
> > +
> > +[config]
> > +name: call with stack realignment

why does this care about call? 
CLC requires types to be aligned to next power of 2 of their size
irrespective of the location. HOw is this different from any other
__private variable declaration?

> > +
> > +[test]
> > +name: call stack realignment 16
> > +kernel_name: kernel_call_stack_realign16_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

redundant newline

> > +
> > +
> > +[test]
> > +name: call stack realignment 32
> > +kernel_name: kernel_call_stack_realign32_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

same here

> > +
> > +[test]
> > +name: call stack realignment 64
> > +kernel_name: kernel_call_stack_realign64_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

same here

> > +
> > +[test]
> > +name: call stack realignment 128
> > +kernel_name: kernel_call_stack_realign128_func
> > +dimensions: 1
> > +global_size: 1 0 0
> > +
> > +arg_out: 0 buffer int[1] \
> > +  1

and here

> > +
> > +!*/
> > +
> > +// Make sure the absolute private address of stack objects in callee
> > +// functions is properly aligned.
> > +
> > +#define NOINLINE __attribute__((noinline))
> > +
> > +NOINLINE
> > +int test_stack_object_alignment16() {
> > +volatile int4 requires_align16 = 0;
> > +volatile uint addr = (uint)_align16;

this should use uintptr_t. why is the addr variable volatile?
same in the below tests.

Jan

> > +return (addr & 15) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment32() {
> > +volatile int8 requires_align32 = 0;
> > +volatile uint addr = (uint)_align32;
> > +return (addr & 31) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment64() {
> > +volatile int16 requires_align64 = 0;
> > +volatile uint addr = (uint)_align64;
> > +return (addr & 63) == 0;
> > +}
> > +
> > +NOINLINE
> > +int test_stack_object_alignment128() {
> > +volatile long16 requires_align128 = 0;
> > +volatile uint addr = (uint)_align128;
> > +return (addr & 127) == 0;
> > +}
> > +
> > +kernel void kernel_call_stack_realign16_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment16();
> > +}
> > +
> > +kernel void kernel_call_stack_realign32_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment32();
> > +}
> > +
> > +kernel void kernel_call_stack_realign64_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment64();
> > +}
> > +
> > +kernel void kernel_call_stack_realign128_func(global int* out) {
> > +volatile int misalign_stack = 0;
> > +*out = test_stack_object_alignment128();
> > +}
> > -- 
> > 2.14.1
> > 
> 
> 


signature.asc
Description: This is a digitally signed message part
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit