Exemplo n.º 1
0
                          '-t cacomposite -f a8r8g8b8,x8r8g8b8')
    _add_rendercheck_test(profile, 'ca composite/All/a2r10g10b10',
                          '-t cacomposite -f a8r8g8b8,a2r10g10b10')
    _add_rendercheck_test(profile, 'fill', '-t fill')
    _add_rendercheck_test(profile, 'bug7366', '-t bug7366')
    _add_rendercheck_test(profile, 'destination coordinates', '-t dcoords')
    _add_rendercheck_test(profile, 'source coordinates', '-t scoords')
    _add_rendercheck_test(profile, 'mask coordinates', '-t mcoords')
    _add_rendercheck_test(profile, 'translated source coordinates',
                          '-t tscoords')
    _add_rendercheck_test(profile, 'translated mask coordinates',
                          '-t tmcoords')
    _add_rendercheck_test(profile, 'triangles', '-t triangles')
    _add_rendercheck_test(profile, 'LibreOffice xRGB', '-t libreoffice_xrgb')
    _add_rendercheck_test(profile, 'GTK ARGB vs xBGR', '-t gtk_argb_xbgr')


def _populate_profile():
    """ Populate the profile attribute """
    # Add all tests to the profile
    profile = XTSProfile()  # pylint: disable=redefined-outer-name
    _populate_profile_xts(profile)
    _populate_profile_rendercheck(profile)
    return profile


if not os.path.exists(X_TEST_SUITE):
    raise exceptions.PiglitFatalError('XTest suite not found.')

profile = _populate_profile()  # pylint: disable=invalid-name
Exemplo n.º 2
0
            continue
        clients = open(os.path.join(debugfs_path, subdir, "clients"), 'r')
        lines = clients.readlines()
        if len(lines) > 2:
            raise exceptions.PiglitInternalError(
                "Test Environment check: other drm clients running!")


if 'IGT_TEST_ROOT' in os.environ:
    IGT_TEST_ROOT = os.environ['IGT_TEST_ROOT']
else:
    IGT_TEST_ROOT = os.path.join(
        core.PIGLIT_CONFIG.required_get('igt', 'path'), 'tests')

if not os.path.exists(IGT_TEST_ROOT):
    raise exceptions.PiglitFatalError(
        'IGT directory does not exist. Missing: {}'.format(IGT_TEST_ROOT))

# check for the test lists
if os.path.exists(os.path.join(IGT_TEST_ROOT, 'test-list.txt')):
    TEST_LISTS = ['test-list.txt']
elif (os.path.exists(os.path.join(IGT_TEST_ROOT, 'single-tests.txt')) and
      os.path.exists(os.path.join(IGT_TEST_ROOT, 'multi-tests.txt'))):
    TEST_LISTS = ['single-tests.txt', 'multi-tests.txt']
else:
    raise exceptions.PiglitFatalError("intel-gpu-tools test lists not found.")


class IGTTestProfile(TestProfile):
    """Test profile for intel-gpu-tools tests."""

    def setup(self):
Exemplo n.º 3
0
 def setup(self):
     if options.OPTIONS.execute:
         try:
             check_environment()
         except exceptions.PiglitInternalError as e:
             raise exceptions.PiglitFatalError(str(e))
Exemplo n.º 4
0
    def parse(self):
        # Iterate over the lines in shader file looking for the config section.
        # By using a generator this can be split into two for loops at minimal
        # cost. The first one looks for the start of the config block or raises
        # an exception. The second looks for the GL version or raises an
        # exception
        with io.open(os.path.join(ROOT_DIR, self.filename),
                     'r',
                     encoding='utf-8') as shader_file:
            # The mock in python 3.3 doesn't support readlines(), so use
            # read().split() as a workaround
            lines = (l for l in shader_file.read().split('\n'))

            # Find the config section
            for line in lines:
                # We need to find the first line of the configuration file, as
                # soon as we do then we can move on to getting the
                # configuration. The first line needs to be parsed by the next
                # block.
                if line.startswith('[require]'):
                    break
            else:
                raise exceptions.PiglitFatalError(
                    "In file {}: Config block not found".format(self.filename))

        for line in lines:
            if line.startswith('GL_') and not line.startswith('GL_MAX'):
                self.gl_required.add(line.strip())
                continue

            # Find any GLES requirements.
            if not (self._gl_version or self._gles_version):
                m = self._match_gl_version.match(line)
                if m:
                    self.__op = m.group('op')
                    if m.group('es'):
                        self._gles_version = float(m.group('ver'))
                    else:
                        self._gl_version = float(m.group('ver'))
                    continue

            if not (self._glsl_version or self._glsl_es_version):
                # Find any GLSL requirements
                m = self._match_glsl_version.match(line)
                if m:
                    self.__sl_op = m.group('op')
                    if m.group('es'):
                        self._glsl_es_version = float(m.group('ver'))
                    else:
                        self._glsl_version = float(m.group('ver'))
                    continue

            if line.startswith('['):
                break

        # Select the correct binary to run the test, but be as conservative as
        # possible by always selecting the lowest version that meets the
        # criteria.
        if self._gles_version:
            if self.__op in ['<', '<='] or (self.__op in ['=', '>=']
                                            and self._gles_version < 3):
                self.prog = 'shader_runner_gles2'
            else:
                self.prog = 'shader_runner_gles3'
        else:
            self.prog = 'shader_runner'
Exemplo n.º 5
0
def run(input_):
    """ Function for piglit run command

    This is a function because it allows it to be shared between piglit-run.py
    and piglit run

    """
    args = _run_parser(input_)
    base.Test.timeout = args.timeout
    _disable_windows_exception_messages()

    # If dmesg is requested we must have serial run, this is because dmesg
    # isn't reliable with threaded run
    if args.dmesg or args.monitored:
        args.concurrency = "none"

    # Pass arguments into Options
    options.OPTIONS.execute = args.execute
    options.OPTIONS.valgrind = args.valgrind
    options.OPTIONS.sync = args.sync
    options.OPTIONS.deqp_mustpass = args.deqp_mustpass
    options.OPTIONS.process_isolation = args.process_isolation
    options.OPTIONS.jobs = args.jobs
    options.OPTIONS.force_glsl = args.glsl

    # Set the platform to pass to waffle
    options.OPTIONS.env['PIGLIT_PLATFORM'] = args.platform

    # Change working directory to the root of the piglit directory
    piglit_dir = path.dirname(path.realpath(sys.argv[0]))
    os.chdir(piglit_dir)

    # If the results directory already exists and if overwrite was set, then
    # clear the directory. If it wasn't set, then raise fatal error.
    try:
        core.check_dir(args.results_path,
                       failifexists=args.overwrite,
                       handler=_results_handler)
    except exceptions.PiglitException:
        raise exceptions.PiglitFatalError(
            'Cannot overwrite existing folder without the -o/--overwrite '
            'option being set.')

    # If a test list is provided then set the forced_test_list value.
    forced_test_list = None
    if args.test_list:
        if len(args.test_profile) != 1:
            raise exceptions.PiglitFatalError(
                'Unable to force a test list with more than one profile')

        with open(args.test_list) as test_list:
            # Strip newlines and comments, ignore empty lines
            stripped = (t.split('#')[0].strip() for t in test_list)
            forced_test_list = [t for t in stripped if t]

    time_elapsed = TimeAttribute(start=time.time())

    backend = backends.get_backend(args.backend)(
        args.results_path,
        junit_suffix=args.junit_suffix,
        junit_subtests=args.junit_subtests)
    backend.initialize(
        _create_metadata(args, args.name or path.basename(args.results_path),
                         forced_test_list))

    profiles = [profile.load_test_profile(p) for p in args.test_profile]
    for p in profiles:
        p.results_dir = args.results_path

    # Set the forced_test_list, if applicable
    if forced_test_list:
        profiles[0].forced_test_list = forced_test_list

    # Set the dmesg type
    if args.dmesg:
        for p in profiles:
            p.options['dmesg'] = dmesg.get_dmesg(args.dmesg)

    if args.monitored:
        for p in profiles:
            p.options['monitor'] = monitoring.Monitoring(args.monitored)

    if args.ignore_missing:
        for p in profiles:
            p.options['ignore_missing'] = args.ignore_missing

    for p in profiles:
        if args.exclude_tests:
            p.filters.append(
                profile.RegexFilter(args.exclude_tests, inverse=True))
        if args.include_tests:
            p.filters.append(profile.RegexFilter(args.include_tests))

    profile.run(profiles, args.log_level, backend, args.concurrency, args.jobs)

    time_elapsed.end = time.time()
    backend.finalize({'time_elapsed': time_elapsed.to_json()})

    print('Thank you for running Piglit!\n'
          'Results have been written to ' + args.results_path)
Exemplo n.º 6
0
    def mock_apitrace_subprocess_run(self, cmd, stdout, env=None):
        get_last_call_args = ['dump', '--calls=frame']
        replay_retrace_args = ['--headless']
        if cmd[1:-1] == get_last_call_args:
            # GL get_last_call
            ret = subprocess.CompletedProcess(cmd, 0)
            if cmd[-1] == self.gl_last_frame_fails_trace_path:
                ret.stdout = b'\n'
            else:
                ret.stdout = bytearray(
                    str(int(self.gl_trace_last_call) - 50) +
                    ' glXSwapBuffers(dpy = 0x56060e921f80, '
                    'drawable = 31457282)\n'
                    '\n' + self.gl_trace_last_call +
                    ' glXSwapBuffers(dpy = 0x56060e921f80, '
                    'drawable = 31457282)\n', 'utf-8')

            return ret
        elif cmd[1:2] == replay_retrace_args:
            # GL replay
            ret = subprocess.CompletedProcess(cmd, 0)
            if cmd[-1] == self.gl_trace_path:
                calls = cmd[2].split('=')[1]
                prefix = cmd[3].split('=')[1]
                ret.stdout = b''
                for call in calls.split(','):
                    if call != self.gl_trace_wrong_call:
                        dump = prefix + call.zfill(10) + '.png'
                        with open(dump, 'w') as f:
                            f.write("content")
                        ret.stdout += bytearray('Wrote ' + dump + '\n',
                                                'utf-8')
            else:
                ret.stdout = b'\n'
                if cmd[-1] == self.gl_replay_crashes_trace_path:
                    ret.returncode = 1

            return ret
        elif cmd[2:-1] == get_last_call_args:
            # DXGI get_last_call
            ret = subprocess.CompletedProcess(cmd, 0)
            if cmd[-1] == self.dxgi_last_frame_fails_trace_path:
                ret.stdout = b'\n'
            else:
                ret.stdout = bytearray(
                    str(int(self.dxgi_trace_last_call) - 50) +
                    ' IDXGISwapChain4::Present(this = 0x3de3b0, '
                    'SyncInterval = 1, Flags = 0x0) = S_OK\n'
                    '\n' + self.dxgi_trace_last_call +
                    ' IDXGISwapChain4::Present(this = 0x3de3b0, '
                    'SyncInterval = 1, Flags = 0x0) = S_OK\n', 'utf-8')
            return ret
        elif cmd[2:3] == replay_retrace_args:
            # DXGI replay
            ret = subprocess.CompletedProcess(cmd, 0)
            if cmd[-1] == self.dxgi_trace_path:
                calls = cmd[3].split('=')[1]
                prefix = cmd[4].split('=')[1]
                ret.stdout = b''
                for call in calls.split(','):
                    dump = prefix + call.zfill(10) + '.png'
                    if call != self.dxgi_trace_wrong_call:
                        with open(dump, 'w') as f:
                            f.write("content")
                        ret.stdout += bytearray('Wrote ' + dump + '\n',
                                                'utf-8')
            else:
                ret.stdout = b'\n'
                if cmd[-1] == self.dxgi_replay_crashes_trace_path:
                    ret.returncode = 1

            return ret
        else:
            raise exceptions.PiglitFatalError(
                'Non treated cmd: {}'.format(cmd))
Exemplo n.º 7
0
 def result(self, new):
     try:
         self.__result = status.status_lookup(new)
     except exceptions.PiglitInternalError as e:
         raise exceptions.PiglitFatalError(str(e))
Exemplo n.º 8
0
    def mock_gfxreconstruct_subprocess_run(self, cmd, stdout, env=None):
        if cmd[0].endswith(self.gfxrecon_info):
            # VK get_last_call
            ret = subprocess.CompletedProcess(cmd, 0)
            if cmd[-1] == self.vk_last_frame_fails_trace_path:
                ret.stdout = b''
            else:
                ret.stdout = bytearray(
                    'Total frames: ' + str(int(self.vk_trace_last_call) + 1) +
                    textwrap.dedent('''
                                       Application info:
                                               Application name: vkcube
                                               Application version: 0
                                               Engine name: vkcube
                                               Engine version: 0
                                               Target API version: 4194304 (1.0.0)

                                       Physical device info:
                                               Device name: TESTING DEVICE
                                               Device ID: 0xabcd
                                               Vendor ID: 0xefgh
                                               Driver version: 83890275 (0x5001063)
                                               API version: 4202627 (1.2.131)

                                       Device memory allocation info:
                                               Total allocations: 5
                                               Min allocation size: 1216
                                               Max allocation size: 540680

                                       Pipeline info:
                                               Total graphics pipelines: 1
                                               Total compute pipelines: 0
                                       '''), 'utf-8')

            return ret
        elif cmd[0].endswith(self.gfxrecon_replay):
            # VK replay
            ret = subprocess.CompletedProcess(cmd, 0)
            if cmd[-1] != self.vk_replay_crashes_trace_path:
                calls = env['VK_SCREENSHOT_FRAMES']
                prefix = env['VK_SCREENSHOT_DIR']
                ret.stdout = b''
                if env['VK_INSTANCE_LAYERS'] == 'VK_LAYER_LUNARG_screenshot':
                    for call in calls.split(','):
                        if (call != self.vk_trace_wrong_call and call != '-1'):
                            from PIL import Image
                            dump = path.join(prefix, call + '.ppm')
                            rgba = 'ff00ffff'
                            color = [
                                int(rgba[0:2], 16),
                                int(rgba[2:4], 16),
                                int(rgba[4:6], 16),
                                int(rgba[6:8], 16)
                            ]
                            Image.frombytes('RGBA', (32, 32),
                                            bytes(color * 32 * 32)).save(dump)
                            ret.stdout += bytearray(
                                'Screen Capture file '
                                'is: ' + dump + '\n', 'utf-8')
                ret.stdout += bytearray(
                    '35.650065 fps, 0.280504 seconds, '
                    '10 frames, 1 loop, framerange 1-10\n', 'utf-8')
            else:
                ret.stdout = b'\n'
                ret.returncode = 1

            return ret
        else:
            raise exceptions.PiglitFatalError(
                'Non treated cmd: {}'.format(cmd))
Exemplo n.º 9
0
except ImportError:
    import xml.etree.cElementTree as etree

from framework import grouptools, backends, exceptions
from framework import status
from framework.core import PIGLIT_CONFIG
from framework.profile import TestProfile, Test

__all__ = ['profile']

crucible_bin = os.environ.get('PIGLIT_CRUCIBLE_BIN', None)
if crucible_bin is None:
    crucible_bin = PIGLIT_CONFIG.safe_get('crucible', 'bin')

if crucible_bin is None:
    raise exceptions.PiglitFatalError(
        'Cannot get "PIGLIT_CRUCIBLE_BIN" or conf value "crucible:bin"')


class CrucibleTest(Test):
    """Test representation for Crucible"""
    def __init__(self, case_name):
        self.__out_xml = tempfile.NamedTemporaryFile(delete=True).name
        command = [crucible_bin, 'run',
                   '--junit-xml={}'.format(self.__out_xml), case_name]
        self._case = case_name
        super(CrucibleTest, self).__init__(command)

    def interpret_result(self):
        try:
            test = backends.junit.REGISTRY.load(self.__out_xml, 'none')
            result = test.get_result(next(six.iterkeys(test.tests)))
Exemplo n.º 10
0
def html(input_):
    # Make a copy of the status text list and add all. This is used as the
    # argument list for -e/--exclude
    statuses = set(str(s) for s in status.ALL)
    statuses.add('all')
    """Combine files in a tests/ directory into a single results file."""
    unparsed = parsers.parse_config(input_)[1]

    # Adding the parent is necissary to get the help options
    parser = argparse.ArgumentParser(parents=[parsers.CONFIG])
    parser.add_argument("-o",
                        "--overwrite",
                        action="store_true",
                        help="Overwrite existing directories")
    parser.add_argument("-l",
                        "--list",
                        action="store",
                        help="Load a newline separated list of results. These "
                        "results will be prepended to any Results "
                        "specified on the command line")
    parser.add_argument("-e",
                        "--exclude-details",
                        default=[],
                        action="append",
                        choices=statuses,
                        help="Optionally exclude the generation of HTML pages "
                        "for individual test pages with the status(es) "
                        "given as arguments. This speeds up HTML "
                        "generation, but reduces the info in the HTML "
                        "pages. May be used multiple times")
    parser.add_argument("summaryDir",
                        metavar="<Summary Directory>",
                        help="Directory to put HTML files in")
    parser.add_argument("resultsFiles",
                        metavar="<Results Files>",
                        nargs="*",
                        help="Results files to include in HTML")
    args = parser.parse_args(unparsed)

    # If args.list and args.resultsFiles are empty, then raise an error
    if not args.list and not args.resultsFiles:
        raise parser.error("Missing required option -l or <resultsFiles>")

    # Convert the exclude_details list to status objects, without this using
    # the -e option will except
    if args.exclude_details:
        # If exclude-results has all, then change it to be all
        if 'all' in args.exclude_details:
            args.exclude_details = status.ALL
        else:
            args.exclude_details = frozenset(
                status.status_lookup(i) for i in args.exclude_details)

    # if overwrite is requested delete the output directory
    if path.exists(args.summaryDir) and args.overwrite:
        shutil.rmtree(args.summaryDir)

    # If the requested directory doesn't exist, create it or throw an error
    try:
        core.check_dir(args.summaryDir, not args.overwrite)
    except exceptions.PiglitException:
        raise exceptions.PiglitFatalError(
            '{} already exists.\n'
            'use -o/--overwrite if you want to overwrite it.'.format(
                args.summaryDir))

    # Merge args.list and args.resultsFiles
    if args.list:
        args.resultsFiles.extend(core.parse_listfile(args.list))

    # Create the HTML output
    summary.html(args.resultsFiles, args.summaryDir, args.exclude_details)