def test_setup_environ_for_server(self): port = MacPort(MockHost(), options=MockOptions(leaks=True, guard_malloc=True)) env = port.setup_environ_for_server(port.driver_name()) self.assertEquals(env['MallocStackLogging'], '1') self.assertEquals(env['DYLD_INSERT_LIBRARIES'], '/usr/lib/libgmalloc.dylib')
def _assert_search_path(self, search_paths, version, use_webkit2=False): # FIXME: Port constructors should not "parse" the port name, but # rather be passed components (directly or via setters). Once # we fix that, this method will need a re-write. port = MacPort(port_name='mac-%s' % version, options=MockOptions(webkit_test_runner=use_webkit2), filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) absolute_search_paths = map(port._webkit_baseline_path, search_paths) self.assertEquals(port.baseline_search_path(), absolute_search_paths)
def test_show_results_html_file(self): port = MacPort(MockHost()) # Delay setting a should_log executive to avoid logging from MacPort.__init__. port._executive = MockExecutive(should_log=True) expected_stderr = "MOCK run_command: ['Tools/Scripts/run-safari', '--release', '-NSOpen', 'test.html'], cwd=/mock-checkout\n" OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr)
def test_tests_for_other_platforms(self): platforms = ['mac', 'chromium-linux', 'mac-snowleopard'] port = MacPort(port_name='mac-snowleopard', filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) platform_dir_paths = map(port._webkit_baseline_path, platforms) # Replace our empty mock file system with one which has our expected platform directories. port._filesystem = MockFileSystem(dirs=platform_dir_paths) dirs_to_skip = port._tests_for_other_platforms() self.assertTrue('platform/chromium-linux' in dirs_to_skip) self.assertFalse('platform/mac' in dirs_to_skip) self.assertFalse('platform/mac-snowleopard' in dirs_to_skip)
def test_tests_for_other_platforms(self): platforms = ['mac', 'chromium-linux', 'mac-snowleopard'] port = MacPort(MockHost(), port_name='mac-snowleopard') platform_dir_paths = map(port._webkit_baseline_path, platforms) # Replace our empty mock file system with one which has our expected platform directories. port._filesystem = MockFileSystem(dirs=platform_dir_paths) dirs_to_skip = port._tests_for_other_platforms() self.assertTrue('platform/chromium-linux' in dirs_to_skip) self.assertFalse('platform/mac' in dirs_to_skip) self.assertFalse('platform/mac-snowleopard' in dirs_to_skip)
def test_version(self): port = MacPort(filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) self.assertTrue(port.version())
def assert_name(self, port_name, os_version_string, expected): port = MacPort(port_name=port_name, os_version_string=os_version_string, filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) self.assertEquals(expected, port.name())
def test_tests_from_skipped_file_contents(self): port = MacPort(filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) self.assertEqual(port._tests_from_skipped_file_contents(self.example_skipped_file), self.example_skipped_tests)
def assert_skipped_file_search_paths(self, port_name, expected_paths): port = MacPort(port_name=port_name, filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) self.assertEqual(port._skipped_file_search_paths(), expected_paths)
def test_show_results_html_file(self): port = MacPort(filesystem=MockFileSystem(), user=MockUser(), executive=MockExecutive()) # Delay setting a should_log executive to avoid logging from MacPort.__init__. port._executive = MockExecutive(should_log=True) expected_stderr = "MOCK run_command: ['Tools/Scripts/run-safari', '--release', '-NSOpen', 'test.html'], cwd=/mock-checkout\n" OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr)
def test_setup_environ_for_server(self): port = MacPort(options=MockOptions(leaks=True, guard_malloc=True)) env = port.setup_environ_for_server(port.driver_name()) self.assertEquals(env['MallocStackLogging'], '1') self.assertEquals(env['DYLD_INSERT_LIBRARIES'], '/usr/lib/libgmalloc.dylib')
def test_version(self): port = MacPort(MockHost()) self.assertTrue(port.version())