示例#1
0
    def testOwnerStringOnSubClass(self):
        @decorators.Owner(emails=['*****@*****.**'], component='comp')
        class Car(object):
            pass

        class Ford(Car):
            pass

        self.assertEquals(['*****@*****.**'], decorators.GetEmails(Car))
        self.assertEquals('comp', decorators.GetComponent(Car))
        self.assertFalse(decorators.GetEmails(Ford))
        self.assertFalse(decorators.GetComponent(Ford))
  def testInfoStringOnSubClass(self):

    @decorators.Info(emails=['*****@*****.**'], component='comp',
                     documentation_url='https://car.com')
    class Car(object):
      pass

    class Ford(Car):
      pass

    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Car))
    self.assertEquals('comp', decorators.GetComponent(Car))
    self.assertEquals('https://car.com', decorators.GetDocumentationLink(Car))
    self.assertFalse(decorators.GetEmails(Ford))
    self.assertFalse(decorators.GetComponent(Ford))
    self.assertFalse(decorators.GetDocumentationLink(Ford))
示例#3
0
    def GetOwnership(self):
        """Returns an Ownership Diagnostic containing the benchmark's information.

    Returns:
      Diagnostic with the benchmark's owners' e-mails and component name
    """
        return histogram.Ownership(decorators.GetEmails(self),
                                   decorators.GetComponent(self))
示例#4
0
def get_all_benchmarks_metadata(metadata):
  benchmark_list = current_benchmarks()

  for benchmark in benchmark_list:
    emails = decorators.GetEmails(benchmark)
    if emails:
      emails = ', '.join(emails)
    metadata[benchmark.Name()] = BenchmarkMetadata(
        emails, decorators.GetComponent(benchmark), False)
  return metadata
示例#5
0
    def GetBugComponents(self):
        """Returns a GenericSet Diagnostic containing the benchmark's Monorail
       component.

    Returns:
      GenericSet Diagnostic with the benchmark's bug component name
    """
        benchmark_component = decorators.GetComponent(self)
        component_diagnostic_value = ([benchmark_component]
                                      if benchmark_component else [])
        return histogram.GenericSet(component_diagnostic_value)
示例#6
0
def get_all_benchmarks_metadata(metadata):
    benchmark_list = current_benchmarks()

    for benchmark in benchmark_list:
        disabled = 'all' in decorators.GetDisabledAttributes(benchmark)

        emails = decorators.GetEmails(benchmark)
        if emails:
            emails = ', '.join(emails)
        metadata[benchmark.Name()] = BenchmarkMetadata(
            emails, decorators.GetComponent(benchmark), disabled)
    return metadata
示例#7
0
def _get_telemetry_perf_benchmarks_metadata():
    metadata = {}
    benchmark_list = benchmark_finders.GetAllPerfBenchmarks()

    for benchmark in benchmark_list:
        emails = decorators.GetEmails(benchmark)
        if emails:
            emails = ', '.join(emails)
        tags_set = benchmark_utils.GetStoryTags(benchmark())
        metadata[benchmark.Name()] = BenchmarkMetadata(
            emails, decorators.GetComponent(benchmark),
            decorators.GetDocumentationLink(benchmark), ','.join(tags_set))
    return metadata
示例#8
0
def _get_telemetry_perf_benchmarks_metadata():
    metadata = {}
    for benchmark in benchmark_finders.GetOfficialBenchmarks():
        benchmark_name = benchmark.Name()
        emails = decorators.GetEmails(benchmark)
        if emails:
            emails = ', '.join(emails)
        metadata[benchmark_name] = BenchmarkMetadata(
            emails=emails,
            component=decorators.GetComponent(benchmark),
            documentation_url=decorators.GetDocumentationLink(benchmark),
            stories=benchmark_utils.GetBenchmarkStoryInfo(benchmark()))
    return metadata
示例#9
0
def get_all_benchmarks_metadata(metadata):
    benchmark_list = current_benchmarks()

    for benchmark in benchmark_list:
        emails = decorators.GetEmails(benchmark)
        if emails:
            emails = ', '.join(emails)
        tags_set = benchmark_utils.GetStoryTags(benchmark())
        metadata[benchmark.Name()] = BenchmarkMetadata(
            emails, decorators.GetComponent(benchmark),
            decorators.GetDocumentationLink(benchmark), ','.join(tags_set),
            False)
    return metadata
示例#10
0
    def testOwnerStringOnClass(self):
        @decorators.Owner(emails=['*****@*****.**'])
        class Ford(object):
            pass

        self.assertEquals(['*****@*****.**'], decorators.GetEmails(Ford))

        @decorators.Owner(emails=['*****@*****.**'])
        @decorators.Owner(component='component')
        class Honda(object):
            pass

        self.assertEquals(['*****@*****.**'], decorators.GetEmails(Honda))
        self.assertEquals('component', decorators.GetComponent(Honda))
        self.assertEquals(['*****@*****.**'], decorators.GetEmails(Ford))
def get_all_benchmarks_metadata(metadata):
  benchmark_list = current_benchmarks()

  for benchmark in benchmark_list:
    exp = benchmark().GetExpectations()
    disabled = 'all' in decorators.GetDisabledAttributes(benchmark) or any(
        any(isinstance(condition, expectations.ALL.__class__)
            for condition in conditions)
        for (conditions, _) in exp.disabled_platforms)

    emails = decorators.GetEmails(benchmark)
    if emails:
      emails = ', '.join(emails)
    metadata[benchmark.Name()] = BenchmarkMetadata(
        emails, decorators.GetComponent(benchmark), disabled)
  return metadata
  def testInfoStringOnClass(self):

    @decorators.Info(emails=['*****@*****.**'],
                     documentation_url='http://foo.com')
    class Ford(object):
      pass

    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Ford))

    @decorators.Info(emails=['*****@*****.**'])
    @decorators.Info(component='component',
                     documentation_url='http://bar.com')
    class Honda(object):
      pass

    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Honda))
    self.assertEquals('http://bar.com', decorators.GetDocumentationLink(Honda))
    self.assertEquals('component', decorators.GetComponent(Honda))
    self.assertEquals(['*****@*****.**'], decorators.GetEmails(Ford))
    self.assertEquals('http://foo.com', decorators.GetDocumentationLink(Ford))
示例#13
0
 def GetBugComponents(self):
     """Return the benchmark's Monorail component as a string."""
     return decorators.GetComponent(self)