Example #1
0
 def testDuplicateResults(self):
     """Tests that duplicate results are not merged."""
     r = [
         {
             'name': ('gpu_tests.webgl_conformance_integration_test.'
                      'WebGLConformanceIntegrationTest.'
                      'conformance/textures/misc/video-rotation.html'),
             'id':
             'build-1111',
             'typ_tags': ['win', 'nvidia'],
         },
         {
             'name': ('gpu_tests.webgl_conformance_integration_test.'
                      'WebGLConformanceIntegrationTest.'
                      'conformance/textures/misc/video-rotation.html'),
             'id':
             'build-1111',
             'typ_tags': ['win', 'nvidia'],
         },
     ]
     expected_results = [
         data_types.Result('webgl_conformance_integration_test',
                           'conformance/textures/misc/video-rotation.html',
                           ('nvidia', 'win'), '1111'),
         data_types.Result('webgl_conformance_integration_test',
                           'conformance/textures/misc/video-rotation.html',
                           ('nvidia', 'win'), '1111'),
     ]
     self.assertEqual(results._ConvertJsonResultsToResultObjects(r),
                      expected_results)
Example #2
0
 def testBasic(self):
     """Basic functionality test."""
     r = [
         {
             'name': ('gpu_tests.webgl_conformance_integration_test.'
                      'WebGLConformanceIntegrationTest.'
                      'conformance/textures/misc/video-rotation.html'),
             'id':
             'build-1111',
             'typ_tags': ['win', 'nvidia'],
         },
         {
             'name': ('gpu_tests.webgl_conformance_integration_test.'
                      'WebGLConformanceIntegrationTest.'
                      'conformance/textures/misc/video-rotation.html'),
             'id':
             'build-2222',
             'typ_tags': ['nvidia', 'win'],
         },
     ]
     expected_results = [
         data_types.Result('webgl_conformance_integration_test',
                           'conformance/textures/misc/video-rotation.html',
                           ('nvidia', 'win'), '1111'),
         data_types.Result(
             'webgl_conformance_integration_test',
             'conformance/textures/misc/video-rotation.html',
             ('nvidia', 'win'),
             '2222',
         ),
     ]
     self.assertEqual(results._ConvertJsonResultsToResultObjects(r),
                      expected_results)
 def testAppliesToResultDoesNotApply(self):
   """Tests that AppliesToResult properly returns False on expected Results."""
   # Name mismatch
   e = data_types.Expectation('test', ['win', 'nvidia'], ['Failure'])
   r = data_types.Result('suite', 'notatest', ('win', 'nvidia'), 'id')
   self.assertFalse(e.AppliesToResult(r))
   # Tag superset
   r = data_types.Result('suite', 'test', tuple(['win']), 'id')
   self.assertFalse(e.AppliesToResult(r))
 def testAppliesToResultApplies(self):
   """Tests that AppliesToResult properly returns True on expected Results."""
   # Exact match.
   e = data_types.Expectation('test', ['win', 'nvidia'], ['Failure'])
   r = data_types.Result('suite', 'test', ('win', 'nvidia'), 'id')
   self.assertTrue(e.AppliesToResult(r))
   # Tag subset
   r = data_types.Result('suite', 'test', ('win', 'nvidia', 'release'), 'id')
   self.assertTrue(e.AppliesToResult(r))
   # Glob match
   e = data_types.Expectation('t*', ['win', 'nvidia'], ['Failure'])
   self.assertTrue(e.AppliesToResult(r))
Example #5
0
    def testNoSuppressedResults(self):
        """Tests functionality when no expectations apply to the given results."""
        self._local_mock.return_value = {
            'foo_expectations.txt': GENERIC_EXPECTATION_FILE_CONTENTS,
        }

        r = [
            data_types.Result('foo_integration_test', 'foo_test',
                              tuple(['linux']), 'id'),
            data_types.Result('foo_integration_test', 'bar_test',
                              tuple(['win']), 'id'),
            data_types.Result('bar_integration_test', 'foo_test',
                              tuple(['win']), 'id')
        ]
        self.assertEqual(results._FilterOutSuppressedResults(r), r)
Example #6
0
def _ConvertJsonResultsToResultObjects(results):
  """Converts JSON BigQuery results to data_types.Result objects.

  Args:
    results: Parsed JSON results from a BigQuery query

  Returns:
    The contents of |results| as a list of data_types.Result objects.
  """
  object_results = []
  for r in results:
    _, suite, __, test_name = r['name'].split('.', 3)
    build_id = r['id'].split('-')[-1]
    typ_tags = r['typ_tags']
    typ_tags.sort()
    typ_tags = tuple(typ_tags)
    object_results.append(
        data_types.Result(suite, test_name, typ_tags, build_id))
  return object_results
  def testEquality(self):
    """Tests that equality is properly calculated."""
    r = data_types.Result('suite', 'test', ('win', 'nvidia'), 'id')
    other = data_types.Result('suite', 'test', ('win', 'nvidia'), 'id')
    self.assertEqual(r, other)

    other = data_types.Result('notsuite', 'test', ('win', 'nvidia'), 'id')
    self.assertNotEqual(r, other)

    other = data_types.Result('suite', 'nottest', ('win', 'nvidia'), 'id')
    self.assertNotEqual(r, other)

    other = data_types.Result('suite', 'test', tuple(['win']), 'id')
    self.assertNotEqual(r, other)

    other = data_types.Result('suite', 'test', ('win', 'nvidia'), 'notid')
    self.assertNotEqual(r, other)

    other = None
    self.assertNotEqual(r, other)
 def testHashability(self):
   """Tests that Result objects are hashable."""
   r = data_types.Result('suite', 'test', ('win', 'nvidia'), 'id')
   _ = set([r])
 def testWildcardsDisallowed(self):
   with self.assertRaises(AssertionError):
     _ = data_types.Result('suite', 't*', ('win', 'nvidia'), 'id')
 def testTupleEnforced(self):
   """Tests that tags must be in a tuple."""
   with self.assertRaises(AssertionError):
     _ = data_types.Result('suite', 'test', ['win', 'nvidia'], 'id')