<commit_before>#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

""" Run the Skia GM executable. """

from build_step import BuildStep
import build_step
import sys


JSON_SUMMARY_FILENAME = 'actual-results.json'


class RunGM(BuildStep):
  def __init__(self, timeout=9600, no_output_timeout=9600, **kwargs):
    super(RunGM, self).__init__(
      timeout=timeout, no_output_timeout=no_output_timeout, **kwargs)

  def _Run(self):
    output_dir = self._flavor_utils.DevicePathJoin(
        self._device_dirs.GMActualDir(), self._builder_name)
    cmd = ['--verbose',
           '--writeChecksumBasedFilenames',
           # Don't bother writing out image files that match our expectations--
           # we know that previous runs have already uploaded those!
           '--mismatchPath', output_dir,
           '--missingExpectationsPath', output_dir,
           '--writeJsonSummaryPath', self._flavor_utils.DevicePathJoin(
               output_dir, JSON_SUMMARY_FILENAME),
           '--ignoreErrorTypes',
               'IntentionallySkipped', 'MissingExpectations',
               'ExpectationsMismatch',
           '--resourcePath', self._device_dirs.ResourceDir(),
           ] + self._gm_args

    device_gm_expectations_path = self._flavor_utils.DevicePathJoin(
        self._device_dirs.GMExpectedDir(), build_step.GM_EXPECTATIONS_FILENAME)
    if self._flavor_utils.DevicePathExists(device_gm_expectations_path):
      cmd.extend(['--readPath', device_gm_expectations_path])

    device_ignore_failures_path = self._flavor_utils.DevicePathJoin(
        self._device_dirs.GMExpectedDir(),
        build_step.GM_IGNORE_FAILURES_FILE)
    if self._flavor_utils.DevicePathExists(device_ignore_failures_path):
      cmd.extend(['--ignoreFailuresFile', device_ignore_failures_path])

    if 'Xoom' in self._builder_name:
      # The Xoom's GPU will crash on some tests if we don't use this flag.
      # http://code.google.com/p/skia/issues/detail?id=1434
      cmd.append('--resetGpuContext')

    if 'Valgrind' in self._builder_name:
      # Poppler has lots of memory errors. Skip PDF rasterisation so we don't
      # have to see them
      # Bug: https://code.google.com/p/skia/issues/detail?id=1806
      cmd.extend(['--pdfRasterizers'])
    if 'ZeroGPUCache' in self._builder_name:
      cmd.extend(['--gpuCacheSize', '0', '0', '--config', 'gpu'])
    if self._builder_name in ('Test-Win7-ShuttleA-HD2000-x86-Release',
                              'Test-Win7-ShuttleA-HD2000-x86-Release-Trybot'):
      cmd.extend(['--useDocumentInsteadOfDevice',
                  '--forcePerspectiveMatrix',
                  # Disabling the following tests because they crash GM in
                  # perspective mode.
                  # See https://code.google.com/p/skia/issues/detail?id=1665
                  '--match',
                  '~scaled_tilemodes',
                  '~convexpaths',
                  '~clipped-bitmap',
                  '~xfermodes3'])

    config = []
    if sys.platform == 'darwin':
      # msaa16 is flaky on Macs (driver bug?) so we skip the test for now
      config = ['--config', 'defaults', '~msaa16']
    elif ('RazrI' in self._builder_name or
          'Nexus10' in self._builder_name or
          'Nexus4' in self._builder_name):
      config = ['--config', 'defaults', 'msaa4']
    elif 'ANGLE' in self._builder_name:
      config = ['--config', 'angle']
    elif (not 'NoGPU' in self._builder_name and
          not 'ChromeOS' in self._builder_name and
          not 'GalaxyNexus' in self._builder_name and
          not 'IntelRhb' in self._builder_name):
      config = ['--config', 'defaults', 'msaa16']

    self._flavor_utils.RunFlavoredCmd('gm', cmd + config)

    if 'Nexus4' in self._builder_name or 'Nexus10' in self._builder_name:
      self._flavor_utils.RunFlavoredCmd(
          'gm', cmd + ['--gpuCompressAlphaMasks'] + ['--config', 'gpu'])


if '__main__' == __name__:
  sys.exit(BuildStep.RunBuildStep(RunGM))<commit_msg>Revert of Add extra run of GM on N4 and N10 with --gpuCompressAlphaMasks (patchset #4 of https://codereview.chromium.org/472083005/)<commit_after>#!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

""" Run the Skia GM executable. """

from build_step import BuildStep
import build_step
import sys


JSON_SUMMARY_FILENAME = 'actual-results.json'


class RunGM(BuildStep):
  def __init__(self, timeout=9600, no_output_timeout=9600, **kwargs):
    super(RunGM, self).__init__(
      timeout=timeout, no_output_timeout=no_output_timeout, **kwargs)

  def _Run(self):
    output_dir = self._flavor_utils.DevicePathJoin(
        self._device_dirs.GMActualDir(), self._builder_name)
    cmd = ['--verbose',
           '--writeChecksumBasedFilenames',
           # Don't bother writing out image files that match our expectations--
           # we know that previous runs have already uploaded those!
           '--mismatchPath', output_dir,
           '--missingExpectationsPath', output_dir,
           '--writeJsonSummaryPath', self._flavor_utils.DevicePathJoin(
               output_dir, JSON_SUMMARY_FILENAME),
           '--ignoreErrorTypes',
               'IntentionallySkipped', 'MissingExpectations',
               'ExpectationsMismatch',
           '--resourcePath', self._device_dirs.ResourceDir(),
           ] + self._gm_args

    device_gm_expectations_path = self._flavor_utils.DevicePathJoin(
        self._device_dirs.GMExpectedDir(), build_step.GM_EXPECTATIONS_FILENAME)
    if self._flavor_utils.DevicePathExists(device_gm_expectations_path):
      cmd.extend(['--readPath', device_gm_expectations_path])

    device_ignore_failures_path = self._flavor_utils.DevicePathJoin(
        self._device_dirs.GMExpectedDir(),
        build_step.GM_IGNORE_FAILURES_FILE)
    if self._flavor_utils.DevicePathExists(device_ignore_failures_path):
      cmd.extend(['--ignoreFailuresFile', device_ignore_failures_path])

    if 'Xoom' in self._builder_name:
      # The Xoom's GPU will crash on some tests if we don't use this flag.
      # http://code.google.com/p/skia/issues/detail?id=1434
      cmd.append('--resetGpuContext')

    if sys.platform == 'darwin':
      # msaa16 is flaky on Macs (driver bug?) so we skip the test for now
      cmd.extend(['--config', 'defaults', '~msaa16'])
    elif ('RazrI' in self._builder_name or
          'Nexus10' in self._builder_name or
          'Nexus4' in self._builder_name):
      cmd.extend(['--config', 'defaults', 'msaa4'])
    elif 'ANGLE' in self._builder_name:
      cmd.extend(['--config', 'angle'])
    elif (not 'NoGPU' in self._builder_name and
          not 'ChromeOS' in self._builder_name and
          not 'GalaxyNexus' in self._builder_name and
          not 'IntelRhb' in self._builder_name):
      cmd.extend(['--config', 'defaults', 'msaa16'])

    if 'Valgrind' in self._builder_name:
      # Poppler has lots of memory errors. Skip PDF rasterisation so we don't
      # have to see them
      # Bug: https://code.google.com/p/skia/issues/detail?id=1806
      cmd.extend(['--pdfRasterizers'])
    if 'ZeroGPUCache' in self._builder_name:
      cmd.extend(['--gpuCacheSize', '0', '0', '--config', 'gpu'])
    if self._builder_name in ('Test-Win7-ShuttleA-HD2000-x86-Release',
                              'Test-Win7-ShuttleA-HD2000-x86-Release-Trybot'):
      cmd.extend(['--useDocumentInsteadOfDevice',
                  '--forcePerspectiveMatrix',
                  # Disabling the following tests because they crash GM in
                  # perspective mode.
                  # See https://code.google.com/p/skia/issues/detail?id=1665
                  '--match',
                  '~scaled_tilemodes',
                  '~convexpaths',
                  '~clipped-bitmap',
                  '~xfermodes3'])

    self._flavor_utils.RunFlavoredCmd('gm', cmd)


if '__main__' == __name__:
  sys.exit(BuildStep.RunBuildStep(RunGM))
{'fraction_non_alphanumeric': 0.11751010905526284, 'fraction_numerical': 0.014459012375934322, 'mean_word_length': 2.7909893172317695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3499303', 'n_tokens_mistral': 2646, 'n_tokens_neox': 2488, 'n_words': 561}