def __init__(self, host, port_name=None, **kwargs): Port.__init__(self, host, port_name or TestPort.default_port_name, **kwargs) self._tests = unit_test_list() self._flakes = set() # FIXME: crbug.com/279494. This needs to be in the "real layout tests # dir" in a mock filesystem, rather than outside of the checkout, so # that tests that want to write to a TestExpectations file can share # this between "test" ports and "real" ports. This is the result of # rebaseline_unittest.py having tests that refer to "real" port names # and real builders instead of fake builders that point back to the # test ports. rebaseline_unittest.py needs to not mix both "real" ports # and "test" ports self._generic_expectations_path = "/mock-checkout/LayoutTests/TestExpectations" self._results_directory = None self._operating_system = "mac" if self._name.startswith("test-win"): self._operating_system = "win" elif self._name.startswith("test-linux"): self._operating_system = "linux" version_map = { "test-win-win7": "win7", "test-win-win10": "win10", "test-mac-mac10.10": "mac10.10", "test-mac-mac10.11": "mac10.11", "test-linux-x86": "linux32", "test-linux-precise": "precise", "test-linux-trusty": "trusty", } self._version = version_map[self._name] if self._operating_system == "linux" and self._version != "linux32": self._architecture = "x86_64" self.all_systems = ( ("mac10.10", "x86"), ("mac10.11", "x86"), ("win7", "x86"), ("win10", "x86"), ("linux32", "x86"), ("precise", "x86_64"), ("trusty", "x86_64"), ) self.all_build_types = ("debug", "release") # To avoid surprises when introducing new macros, these are # intentionally fixed in time. self.configuration_specifier_macros_dict = { "mac": ["mac10.10", "mac10.11"], "win": ["win7", "win10"], "linux": ["linux32", "precise", "trusty"], }
def __init__(self, host, port_name=None, **kwargs): Port.__init__(self, host, port_name or TestPort.default_port_name, **kwargs) self._tests = unit_test_list() self._flakes = set() # FIXME: crbug.com/279494. This needs to be in the "real layout tests # dir" in a mock filesystem, rather than outside of the checkout, so # that tests that want to write to a TestExpectations file can share # this between "test" ports and "real" ports. This is the result of # rebaseline_unittest.py having tests that refer to "real" port names # and real builders instead of fake builders that point back to the # test ports. rebaseline_unittest.py needs to not mix both "real" ports # and "test" ports self._generic_expectations_path = '/mock-checkout/LayoutTests/TestExpectations' self._results_directory = None self._operating_system = 'mac' if self._name.startswith('test-win'): self._operating_system = 'win' elif self._name.startswith('test-linux'): self._operating_system = 'linux' version_map = { 'test-win-win7': 'win7', 'test-win-win10': 'win10', 'test-mac-mac10.10': 'mac10.10', 'test-mac-mac10.11': 'mac10.11', 'test-linux-x86': 'linux32', 'test-linux-precise': 'precise', 'test-linux-trusty': 'trusty', } self._version = version_map[self._name] if self._operating_system == 'linux' and self._version != 'linux32': self._architecture = 'x86_64' self.all_systems = (('mac10.10', 'x86'), ('mac10.11', 'x86'), ('win7', 'x86'), ('win10', 'x86'), ('linux32', 'x86'), ('precise', 'x86_64'), ('trusty', 'x86_64')) self.all_build_types = ('debug', 'release') # To avoid surprises when introducing new macros, these are # intentionally fixed in time. self.configuration_specifier_macros_dict = { 'mac': ['mac10.10', 'mac10.11'], 'win': ['win7', 'win10'], 'linux': ['linux32', 'precise', 'trusty'] }
def __init__(self, host, port_name=None, **kwargs): Port.__init__(self, host, port_name or TestPort.default_port_name, **kwargs) self._tests = unit_test_list() self._flakes = set() # FIXME: crbug.com/279494. This needs to be in the "real layout tests # dir" in a mock filesystem, rather than outside of the checkout, so # that tests that want to write to a TestExpectations file can share # this between "test" ports and "real" ports. This is the result of # rebaseline_unittest.py having tests that refer to "real" port names # and real builders instead of fake builders that point back to the # test ports. rebaseline_unittest.py needs to not mix both "real" ports # and "test" ports self._generic_expectations_path = '/mock-checkout/LayoutTests/TestExpectations' self._results_directory = None self._operating_system = 'mac' if self._name.startswith('test-win'): self._operating_system = 'win' elif self._name.startswith('test-linux'): self._operating_system = 'linux' version_map = { 'test-win-win7': 'win7', 'test-win-win10': 'win10', 'test-mac-mac10.10': 'mac10.10', 'test-mac-mac10.11': 'mac10.11', 'test-linux-precise': 'precise', 'test-linux-trusty': 'trusty', } self._version = version_map[self._name] if self._operating_system == 'linux': self._architecture = 'x86_64' self.all_systems = (('mac10.10', 'x86'), ('mac10.11', 'x86'), ('win7', 'x86'), ('win10', 'x86'), ('precise', 'x86_64'), ('trusty', 'x86_64')) self.all_build_types = ('debug', 'release') # To avoid surprises when introducing new macros, these are # intentionally fixed in time. self.configuration_specifier_macros_dict = { 'mac': ['mac10.10', 'mac10.11'], 'win': ['win7', 'win10'], 'linux': ['precise', 'trusty'] }
def test_parse_reftest_list(self): port = self.make_port(with_tests=True) port.host.filesystem.files["bar/reftest.list"] = "\n".join( [ "== test.html test-ref.html", "", "# some comment", "!= test-2.html test-notref.html # more comments", "== test-3.html test-ref.html", "== test-3.html test-ref2.html", "!= test-3.html test-notref.html", "fuzzy(80,500) == test-3 test-ref.html", ] ) # Note that we don't support the syntax in the last line; the code should ignore it, rather than crashing. reftest_list = Port._parse_reftest_list(port.host.filesystem, "bar") self.assertEqual( reftest_list, { "bar/test.html": [("==", "bar/test-ref.html")], "bar/test-2.html": [("!=", "bar/test-notref.html")], "bar/test-3.html": [ ("==", "bar/test-ref.html"), ("==", "bar/test-ref2.html"), ("!=", "bar/test-notref.html"), ], }, )
def make_port(self, executive=None, with_tests=False, port_name=None, **kwargs): host = MockSystemHost() if executive: host.executive = executive if with_tests: add_unit_tests_to_mock_filesystem(host.filesystem) return TestPort(host, **kwargs) return Port(host, port_name or 'baseport', **kwargs)
def __init__(self, host, port_name=None, **kwargs): Port.__init__(self, host, port_name or TestPort.default_port_name, **kwargs) self._tests = unit_test_list() self._flakes = set() # FIXME: crbug.com/279494. This needs to be in the "real layout tests # dir" in a mock filesystem, rather than outside of the checkout, so # that tests that want to write to a TestExpectations file can share # this between "test" ports and "real" ports. This is the result of # rebaseline_unittest.py having tests that refer to "real" port names # and real builders instead of fake builders that point back to the # test ports. rebaseline_unittest.py needs to not mix both "real" ports # and "test" ports self._generic_expectations_path = '/mock-checkout/LayoutTests/TestExpectations' self._results_directory = None self._operating_system = 'mac' if self._name.startswith('test-win'): self._operating_system = 'win' elif self._name.startswith('test-linux'): self._operating_system = 'linux' version_map = { 'test-win-win7': 'win7', 'test-win-win10': 'win10', 'test-mac-mac10.10': 'mac10.10', 'test-mac-mac10.11': 'mac10.11', 'test-linux-x86': 'linux32', 'test-linux-precise': 'precise', 'test-linux-trusty': 'trusty', } self._version = version_map[self._name] if self._operating_system == 'linux' and self._version != 'linux32': self._architecture = 'x86_64'
def test_parse_reftest_list(self): port = self.make_port(with_tests=True) port.host.filesystem.files['bar/reftest.list'] = "\n".join(["== test.html test-ref.html", "", "# some comment", "!= test-2.html test-notref.html # more comments", "== test-3.html test-ref.html", "== test-3.html test-ref2.html", "!= test-3.html test-notref.html", "fuzzy(80,500) == test-3 test-ref.html"]) # Note that we don't support the syntax in the last line; the code should ignore it, rather than crashing. reftest_list = Port._parse_reftest_list(port.host.filesystem, 'bar') self.assertEqual(reftest_list, { 'bar/test.html': [('==', 'bar/test-ref.html')], 'bar/test-2.html': [('!=', 'bar/test-notref.html')], 'bar/test-3.html': [('==', 'bar/test-ref.html'), ('==', 'bar/test-ref2.html'), ('!=', 'bar/test-notref.html')]})
def __init__(self, host, **kwargs): Port.__init__(self, host, **kwargs) # All sub-classes override this, but we need an initial value for testing. self._version = 'xp' self._chromium_base_dir = None
def make_port(self): return Port(MockSystemHost(), 'test', optparse.Values({'configuration': 'Release'}))
def is_test_source_file(filesystem, dirname, basename): pass_regex = re.compile(r'\.(css|js)$') fail_regex = re.compile(r'-expected\.') return (Port.is_test_file(filesystem, dirname, basename) or pass_regex.search(basename)) and not fail_regex.search(basename)
def test_can_load_actual_virtual_test_suite_file(self): port = Port(SystemHost(), 'baseport') # If this call returns successfully, we found and loaded the LayoutTests/VirtualTestSuites. _ = port.virtual_test_suites()
def make_port(self): port = Port(MockSystemHost(), 'test', MockOptions(configuration='Release')) port._config.build_directory = lambda configuration: '/mock-checkout/out/' + configuration return port
def __init__(self, host, port_name, **kwargs): Port.__init__(self, host, port_name, **kwargs) # All sub-classes override this, but we need an initial value for testing. self._chromium_base_dir_path = None
def test_is_test_file(self): filesystem = MockFileSystem() self.assertTrue(Port.is_test_file(filesystem, '', 'foo.html')) self.assertTrue(Port.is_test_file(filesystem, '', 'foo.svg')) self.assertTrue(Port.is_test_file(filesystem, '', 'test-ref-test.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo.png')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.svg')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.xht')) self.assertFalse( Port.is_test_file(filesystem, '', 'foo-expected-mismatch.html')) self.assertFalse( Port.is_test_file(filesystem, '', 'foo-expected-mismatch.svg')) self.assertFalse( Port.is_test_file(filesystem, '', 'foo-expected-mismatch.xhtml')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.xht')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.xhtml')) self.assertFalse(Port.is_test_file(filesystem, '', 'ref-foo.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'notref-foo.xhr'))
def test_is_test_file(self): filesystem = MockFileSystem() self.assertTrue(Port.is_test_file(filesystem, "", "foo.html")) self.assertTrue(Port.is_test_file(filesystem, "", "foo.svg")) self.assertTrue(Port.is_test_file(filesystem, "", "test-ref-test.html")) self.assertFalse(Port.is_test_file(filesystem, "", "foo.png")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-expected.html")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-expected.svg")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-expected.xht")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-expected-mismatch.html")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-expected-mismatch.svg")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-expected-mismatch.xhtml")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-ref.html")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-notref.html")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-notref.xht")) self.assertFalse(Port.is_test_file(filesystem, "", "foo-ref.xhtml")) self.assertFalse(Port.is_test_file(filesystem, "", "ref-foo.html")) self.assertFalse(Port.is_test_file(filesystem, "", "notref-foo.xhr"))
def __init__(self, **kwargs): Port.__init__(self, **kwargs) # All sub-classes override this, but we need an initial value for testing. self._version = 'xp' self._chromium_base_dir = None
def make_port(self): port = Port(MockSystemHost(), 'test', MockOptions(configuration='Release')) return port
def test_is_test_file(self): filesystem = MockFileSystem() self.assertTrue(Port.is_test_file(filesystem, '', 'foo.html')) self.assertTrue(Port.is_test_file(filesystem, '', 'foo.svg')) self.assertTrue(Port.is_test_file(filesystem, '', 'test-ref-test.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo.png')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.svg')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.xht')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatch.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatch.svg')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatch.xhtml')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.xht')) self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.xhtml')) self.assertFalse(Port.is_test_file(filesystem, '', 'ref-foo.html')) self.assertFalse(Port.is_test_file(filesystem, '', 'notref-foo.xhr'))