Exemplo n.º 1
0
    def NormalizeTestName(test_name, step_name=None):
        """Normalizes test names by removing parameters and queries.

    Removes prefixes and parameters from test names if they are gtests. For
    example, 'A/ColorSpaceTest.PRE_PRE_testNullTransform/137' maps to
    'ColorSpaceTest.testNullTransform'.

    Removes queries from test names if they are webkit_layout_tests. For
    example, 'external/wpt/editing/run/inserttext.html?2001-last' maps to
    'external/wpt/editing/run/inserttext.html'

    step_name is an optional argument to help identify the type of the tests.
    If not given, goes through all normalizers for different types of tests.
    Note that without step name, this function is not perfect, for example,
    a/suite/c.html can be both a type parameterized version of suite.html gtest
    or a webkit_layout_tests.

    Args:
      test_name: Any test name, and it can be original test name containing
                 parameters, normalized test name (no-op) or a test label name
                 with masks.
      step_name: The original step name, needed to identify the type of the
                 test, such as webkit_layout_tests, gtests.

    Returns:
      Normalized version of the given test name.
    """
        if step_name and 'webkit_layout_tests' in step_name:
            return test_name_util.RemoveSuffixFromWebkitLayoutTestName(
                test_name_util.RemoveVirtualLayersFromWebkitLayoutTestName(
                    test_name))

        test_name = test_name_util.RemoveAllPrefixesFromGTestName(
            test_name_util.RemoveParametersFromGTestName(test_name))

        return test_name_util.RemoveSuffixFromWebkitLayoutTestName(
            test_name_util.RemoveVirtualLayersFromWebkitLayoutTestName(
                test_name))
Exemplo n.º 2
0
 def testRemoveAllPrefixesFromGTestNameNoPrefix(self):
     test = 'abc_test'
     self.assertEqual(test,
                      test_name_util.RemoveAllPrefixesFromGTestName(test))
Exemplo n.º 3
0
 def testRemoveMaskedPrefixesFromGTestName(self):
     test = 'abc_test.*test1'
     self.assertEqual('abc_test.test1',
                      test_name_util.RemoveAllPrefixesFromGTestName(test))