rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
"kOutOfBounds")
"kOutOfBounds", None)
def GetInvalidArg(self, offset, index): """Overridden from Argument.""" if index == 0: return ("kInvalidSharedMemoryId, 0", "kOutOfBounds") else: return ("shared_memory_id_, kInvalidSharedMemoryOffset", "kOutOfBounds")
tests_to_skip = set(self._expectations_from_skipped_files())
expectations_file = self.path_to_test_expectations_file() expectations = file(expectations_file, "r").read() return expectations + self._skips() def _skips(self): tests_to_skip = set(self._expectations_from_skipped_files())
def test_expectations(self): # The WebKit mac port uses 'Skipped' files at the moment. Each # file contains a list of files or directories to be skipped during # the test run. The total list of tests to skipped is given by the # contents of the generic Skipped file found in platform/X plus # a version-specific file fou...
expectations = map(lambda test_path: "BUG_SKIPPED SKIP : %s = FAIL" % test_path, tests_to_skip) return "\n".join(expectations)
skip_lines = map(lambda test_path: "BUG_SKIPPED SKIP : %s = FAIL" % test_path, tests_to_skip) return "\n".join(skip_lines)
def test_expectations(self): # The WebKit mac port uses 'Skipped' files at the moment. Each # file contains a list of files or directories to be skipped during # the test run. The total list of tests to skipped is given by the # contents of the generic Skipped file found in platform/X plus # a version-specific file fou...
return 'mac'
return 'mac' + self.version()
def test_platform_name(self): # At the moment we don't use test platform names, but we have # to return something. return 'mac'
return ('mac',)
return ('mac', 'mac-tiger', 'mac-leopard', 'mac-snowleopard')
def test_platform_names(self): # At the moment we don't use test platform names, but we have # to return something. return ('mac',)
commit_ids = self.run(["git", "log", "--pretty=format:%H", "-%s" % limit, path]).splitlines()
commit_ids = self.run(["git", "log", "--pretty=format:%H", "-%s" % limit, "--", path]).splitlines()
def revisions_changing_file(self, path, limit=5): commit_ids = self.run(["git", "log", "--pretty=format:%H", "-%s" % limit, path]).splitlines() return filter(lambda revision: revision, map(self.svn_revision_from_git_commit, commit_ids))
if sys.platform in ('win32', 'cygwin') and options: options.use_drt = False
def __init__(self, port_name=None, options=None): base.Port.__init__(self, port_name, options) self._chromium_base_dir = None
'test driver')
'test driver') and result
def check_build(self, needs_http): result = True dump_render_tree_binary_path = self._path_to_driver() result = check_file_exists(dump_render_tree_binary_path, 'test driver') if result: result = (self._check_driver_build_up_to_date(self._options.configuration) and result) else: _log.error('')
result = (self._check_driver_build_up_to_date(self._options.configuration) and result)
result = self._check_driver_build_up_to_date( self._options.configuration)
def check_build(self, needs_http): result = True dump_render_tree_binary_path = self._path_to_driver() result = check_file_exists(dump_render_tree_binary_path, 'test driver') if result: result = (self._check_driver_build_up_to_date(self._options.configuration) and result) else: _log.error('')
print " Author: %s" % commit_info["author"] or ("\"%s\" <%s> %" % (commit_info["author_name"], commit_info["author_email"])) print " Reviewer: %s" % commit_info["reviewer"] or commit_info["reviewer_text"] print " Committer: %s" % commit_info["committer"] or commit_info["committer_email"]
author_line = "\"%s\" <%s>" % (commit_info["author_name"], commit_info["author_email"]) print " Author: %s" % (commit_info["author"] or author_line) print " Reviewer: %s" % (commit_info["reviewer"] or commit_info["reviewer_text"]) print " Committer: %s" % (commit_info["committer"] or commit_info["committer_email"])
def _print_blame_information_for_commit(self, commit_info): print "r%s:" % commit_info["revision"] print " %s" % view_source_url(commit_info["revision"]) print " Bug: %s (%s)" % (commit_info["bug_id"], self.tool.bugs.bug_url_for_bug_id(commit_info["bug_id"])) print " Author: %s" % commit_info["author"] or ("\"%s\" <...
return Mock()
commit_message = Mock() commit_message.message = lambda:"This is a fake commit message that is at least 50 characters." return commit_message
def commit_message_for_this_commit(self): return Mock()
WindowsError except NameError: WindowsError = FileSystem._WindowsError
exceptions.WindowsError except AttributeError: exceptions.WindowsError = FileSystem._WindowsError
def remove(self, path, osremove=os.remove): """On Windows, os.remove can sometimes fail. We see this behavior in Chromium tests as well and are unsure why. Others on the internet are equally confused: http://social.msdn.microsoft.com/Forums/en/windowssearch/thread/55582d9d-77ea-47d9-91ce-cff7ca7ef528 http://codesearc...
except WindowsError, e:
except exceptions.WindowsError, e:
def remove(self, path, osremove=os.remove): """On Windows, os.remove can sometimes fail. We see this behavior in Chromium tests as well and are unsure why. Others on the internet are equally confused: http://social.msdn.microsoft.com/Forums/en/windowssearch/thread/55582d9d-77ea-47d9-91ce-cff7ca7ef528 http://codesearc...
metadata = ParseDir(path)
try: metadata = ParseDir(path) except LicenseError: print >>sys.stderr, ("WARNING: licensing info for " + path + " is incomplete, skipping.") continue
def EvaluateTemplate(template, env, escape=True): """Expand a template with variables like {{foo}} using a dictionary of expansions.""" for key, val in env.items(): if escape: val = cgi.escape(val) template = template.replace('{{%s}}' % key, val) return template
return (map(self._webkit_baseline_path, ['chromium-gpu-linux', 'chromium-gpu']) +
return (map(self._webkit_baseline_path, ['chromium-gpu-linux', 'chromium-gpu-win', 'chromium-gpu']) +
def baseline_search_path(self): return (map(self._webkit_baseline_path, ['chromium-gpu-linux', 'chromium-gpu']) + chromium_linux.ChromiumLinuxPort.baseline_search_path(self))
handle_style_error(file_path, 0, 'whitespace/newline', 1,
handle_style_error(0, 'whitespace/newline', 1,
def _process_file(self, processor, file_path, handle_style_error): """Process the file using the given processor.""" try: # Support the UNIX convention of using "-" for stdin. Note that # we are not opening the file with universal newline support # (which codecs doesn't support anyway), so the resulting lines do # con...
def conflicted_files(self): status_command = ['git', 'diff', '--name-status', '-C', '-M', '--diff-filter=U'] status_regexp = '^(?P<status>[U])\t(?P<filename>.+)$' return self.run_status_and_extract_filenames(status_command, status_regexp)
def changed_files(self): status_command = ['git', 'diff', '-r', '--name-status', '-C', '-M', 'HEAD'] status_regexp = '^(?P<status>[ADM])\t(?P<filename>.+)$' return self.run_status_and_extract_filenames(status_command, status_regexp)
self.races = []
self.reports = []
def __init__(self, source_dir, files): '''Reads in a set of files.
self.races.append(tmp)
self.reports.append(tmp) elif self.line_.startswith("ASSERT FAILURE"): self.reports.append(self.line_.strip())
def ParseReportFile(self, filename): self.cur_fd_ = open(filename, 'r')
if len(self.races) > 0: logging.error("Found %i error reports" % len(self.races)) for report_list in self.races:
if len(self.reports) > 0: logging.error("Found %i error reports" % len(self.reports)) for report_list in self.reports:
def Report(self, check_sanity): sys.stdout.flush() #TODO(timurrrr): support positive tests / check_sanity==True
self.browser['flag_type-4'] = ('?',)
try: self.browser['flag_type-4'] = ('?',) except ControlNotFoundError, e: pass
def _fill_attachment_form(self, description, patch_file_object, comment_text=None, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=False, bug_id=None): self.browser['description'] = description self.browser['ispatch'] = ("1",) self.browser['flag_type-1'] = ('?',) if mark_for_review else ('X',)
r'temp_scaffolding_stubs\.h$',
# Bogus ifdef tricks
def __init__(self, name, type): SizeArgument.__init__(self, name, "GLsizei")
def __init__(self, name, type, gl_type): SizeArgument.__init__(self, name, gl_type)
def __init__(self, name, type): SizeArgument.__init__(self, name, "GLsizei")
arg_parts[0] != "GLintptr"):
not arg_parts[0].startswith('GLintptr')):
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1]...
elif arg_parts[0].startswith('GLsizeiNotNegative'): return SizeNotNegativeArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
elif (arg_parts[0].startswith('GLsizeiNotNegative') or arg_parts[0].startswith('GLintptrNotNegative')): return SizeNotNegativeArgument(arg_parts[-1], " ".join(arg_parts[0:-1]), arg_parts[0][0:-11])
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1]...
_NAME_RE = re.compile('[A-Za-z0-9_]+')
_NAME_RE = re.compile('^[A-Za-z0-9_]+$')
def ToTclibMessage(self): msg = grit.extern.tclib.Message( 'utf-8', id=self.id, meaning=self.meaning) self.FillTclibBaseMessage(msg) return msg
'-m', os.path.join(self._web_socket_tests, 'handler_map.txt'),
def Start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.IsRunning(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
if msg.policy_scope == 'cros/device':
if msg.policy_scope == 'chromeos/device':
def ProcessPolicy(self, msg): """Handles a policy request.
dmtoken = None
def CheckToken(self): """Helper for checking whether the client supplied a valid DM token.
if start_dir.endswith('build'): print 'coverage_posix.py: doing a "cd src" to accomodate buildbot PWD' os.chdir('src')
elif self.IsMac(): pass else: if start_dir.endswith('build'): print 'coverage_posix.py: doing a "cd src" to accomodate buildbot PWD' os.chdir('src')
def GenerateLcovPosix(self): """Convert profile data to lcov on Mac or Linux.""" start_dir = os.getcwd() if self.IsLinux(): # With Linux/make (e.g. the coverage_run target), the current # directory for this command is .../build/src/chrome but we need # to be in .../build/src for the relative path of source files # to b...
self._process = subprocess.Popen(start_cmd, env=env)
self._process = subprocess.Popen(start_cmd, env=os.environ)
def start(self): if self.is_running(): raise 'Lighttpd already running'
if '__main__' == __name__: option_parser = optparse.OptionParser() option_parser.add_option('--server', type='choice', choices=['start', 'stop'], default='start', help='Server action (start|stop)') option_parser.add_option('-p', '--port', dest='port', default=None, help='Port to listen on') option_parser.add_option('...
def stop(self, force=False): if not force and not self.is_running(): return
self._process = subprocess.Popen(start_cmd, stdout=self._wsout,
self._process = subprocess.Popen(start_cmd, stdin=open(os.devnull, 'r'), stdout=self._wsout,
def start(self): if not self._web_socket_tests: _log.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
return tsan_analyze.TsanAnalyzer(self._source_dir)
return tsan_analyze.TsanAnalyzer(self._source_dir, use_gdb)
def CreateAnalyzer(self): use_gdb = common.IsMac() return tsan_analyze.TsanAnalyzer(self._source_dir)
pdf_files_path = os.path.join(self.DataDir(), 'pyauto_private', 'pdf')
pdf_files_path = os.path.join(self.DataDir(), 'plugin', 'pdf')
def testPDFRunner(self): """Navigate to pdf files and verify that browser doesn't crash""" # bail out if not a branded build properties = self.GetBrowserInfo()['properties'] if properties['branding'] != 'Google Chrome': return pdf_files_path = os.path.join(self.DataDir(), 'pyauto_private', 'pdf') pdf_files = glob.glob(...
message = script_error.message
message = str(script_error)
def _update_status_for_script_error(cls, tool, state, script_error, is_error=False): message = script_error.message if is_error: message = "Error: %s" % message output = script_error.message_with_output(output_limit=1024*1024) # 1MB # We pre-encode the string to a byte array before passing it # to status_server, becaus...
self.run_webkit_patch(["build", self.port.flag(), "--force-clean", "--quiet"])
self.run_webkit_patch([ "build", self.port.flag(), "--build-style=%s" % self._build_style, "--force-clean", "--quiet"])
def should_proceed_with_work_item(self, patch): try: self.run_webkit_patch(["build", self.port.flag(), "--force-clean", "--quiet"]) self._update_status("Building", patch) except ScriptError, e: self._update_status("Unable to perform a build") return False return True
node.attrs['first_id'] = id_list.pop(0)
node.attrs['first_id'] = str(id_list.pop(0))
def AssignFirstIds(self, filename_or_stream, first_id_filename): '''Assign first ids to each grouping node based on values from tools/grit/resource_ids.''' # If the input is a stream, then we're probably in a unit test and # should skip this step. if type(filename_or_stream) not in (str, unicode): return
result.append(' CoreIPC::handleMessage<Messages::%s::%s>(arguments, this, &%s);\n' % (receiver.name, message.name, handler_function(receiver, message)))
result.append(' CoreIPC::%s<Messages::%s::%s>(arguments, this, &%s);\n' % (dispatch_function, receiver.name, message.name, handler_function(receiver, message)))
def async_case_statement(receiver, message): result = [] result.append(' case Messages::%s::%s:\n' % (receiver.name, message.id())) result.append(' CoreIPC::handleMessage<Messages::%s::%s>(arguments, this, &%s);\n' % (receiver.name, message.name, handler_function(receiver, message))) result.append(' re...
return int(os.popen2("sysctl -n hw.ncpu")[1].read())
ncores = int(os.popen2("sysctl -n hw.ncpu")[1].read()) if ncores > 4: ncores = 4 return ncores
def num_cores(self): return int(os.popen2("sysctl -n hw.ncpu")[1].read())
result = result[content_start:content_end + len(_expected_output_postamble)] + "\n"
postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n"
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + ...
'WebCore::CompositionUnderline',
def struct_or_class(namespace, type): structs = frozenset([ 'WebCore::KeypressCommand', 'WebCore::CompositionUnderline', 'WebCore::PluginInfo', 'WebCore::ViewportArguments', 'WebCore::WindowFeatures', 'WebKit::DrawingAreaInfo', 'WebKit::PlatformPopupMenuData', 'WebKit::PluginProcessCreationParameters', 'WebKit::WebNavi...
'WebCore::CompositionUnderline': '<WebCore/Editor.h>',
def headers_for_type(type): # Check for Vector. match = re.search(r'Vector<(.+)>', type) if match: element_type = match.groups()[0].strip() return ['<wtf/Vector.h>'] + headers_for_type(element_type) special_cases = { 'WTF::String': '<wtf/text/WTFString.h>', 'WebCore::KeypressCommand': '<WebCore/KeyboardEvent.h>', 'Web...
'WebKit::WebTouchEvent': '"WebEvent.h"',
def headers_for_type(type): # Check for Vector. match = re.search(r'Vector<(.+)>', type) if match: element_type = match.groups()[0].strip() return ['<wtf/Vector.h>'] + headers_for_type(element_type) special_cases = { 'WTF::String': '<wtf/text/WTFString.h>', 'WebCore::KeypressCommand': '<WebCore/KeyboardEvent.h>', 'Web...
'third_party', 'WebKit', 'WebKitTools', 'pywebsocket')
'third_party', 'WebKit', 'WebKitTools', 'Scripts', 'webkitpy', 'thirdparty', 'pywebsocket')
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
'third_party', 'WebKit', 'WebKitTools', 'pywebsocket', 'mod_pywebsocket', 'standalone.py')
'third_party', 'WebKit', 'WebKitTools', 'Scripts', 'webkitpy', 'thirdparty', 'pywebsocket', 'mod_pywebsocket', 'standalone.py')
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
bin_dirs = [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release'), ] for d in bin_dirs: sys.path.append(os.path.normpath(d))
bin_dirs = { 'linux2': [ os.path.join(chrome_src, 'out', 'Debug'), os.path.join(chrome_src, 'sconsbuild', 'Debug'), os.path.join(chrome_src, 'out', 'Release'), os.path.join(chrome_src, 'sconsbuild', 'Release')], 'darwin': [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release...
def _LocateBinDirs(): script_dir = os.path.dirname(__file__) chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) # TODO(nirnimesh): Expand this to include win/linux build dirs # crbug.com/32285 bin_dirs = [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'x...
self.assertTrue(location.startswith('http://www.google.com'))
self.assertTrue('google.com' in location)
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
self.assertTrue(location.startswith('http://www.bing.com'))
self.assertTrue('bing.com' in location)
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
filename_queue.put('.', [self._get_test_info_for_file(test_file)])
filename_queue.put( ('.', [self._GetTestInfoForFile(test_file)]))
def _get_test_file_queue(self, test_files): """Create the thread safe queue of lists of (test filenames, test URIs) tuples. Each TestShellThread pulls a list from this queue and runs those tests in order before grabbing the next available list.
def __exit__(self, type, value, traceback): pass
_determined_configuration = None
def __exit__(self, type, value, traceback): pass
class MockExecutive(object): def __init__(self, output='', exit_code=0): self._output = output self._exit_code = exit_code def run_command(self, arg_list, return_exit_code=False, decode_output=False): if return_exit_code: return self._exit_code return self._output
def clear_cached_configuration(): global _determined_configuration _determined_configuration = -1
def __exit__(self, type, value, traceback): pass
class ConfigTest(unittest.TestCase): def tearDown(self): config.clear_cached_configuration()
class Config(object): _FLAGS_FROM_CONFIGURATIONS = { "Debug": "--debug", "Release": "--release", }
def run_command(self, arg_list, return_exit_code=False, decode_output=False): if return_exit_code: return self._exit_code return self._output
def assertConfiguration(self, contents, expected): config.clear_cached_configuration() orig_open = codecs.open
def __init__(self, executive): self._executive = executive self._webkit_base_dir = None self._default_configuration = None self._build_directories = {}
def assertConfiguration(self, contents, expected): # This tests that a configuration file containing # _contents_ endsd up being interpreted as _expected_. # # FIXME: rewrite this when we have a filesystem abstraction we # can mock out more easily. config.clear_cached_configuration() orig_open = codecs.open
def wrap_open(contents): def open_wrapper(path, mode, encoding): return NewStringIO(contents) return open_wrapper
def build_directory(self, configuration): """Returns the path to the build directory for the configuration.""" if configuration: flags = ["--configuration", self._FLAGS_FROM_CONFIGURATIONS[configuration]] configuration = "" else: configuration = "" flags = ["--top-level"]
def wrap_open(contents): def open_wrapper(path, mode, encoding): return NewStringIO(contents) return open_wrapper
try: orig_exists = os.path.exists os.path.exists = lambda p: True codecs.open = wrap_open(contents)
if not self._build_directories.get(configuration): args = ["perl", self._script_path("webkit-build-directory")] + flags self._build_directories[configuration] = ( self._executive.run_command(args).rstrip())
def open_wrapper(path, mode, encoding): return NewStringIO(contents)
e = MockExecutive(output='foo') c = config.Config(e) self.assertEqual(c.default_configuration(), expected) finally: os.path.exists = orig_exists codecs.open = orig_open
return self._build_directories[configuration]
def open_wrapper(path, mode, encoding): return NewStringIO(contents)
def test_build_directory_toplevel(self): e = MockExecutive(output="toplevel") c = config.Config(e) self.assertEqual(c.build_directory(None), 'toplevel')
def build_dumprendertree(self, configuration): """Builds DRT in the given configuration.
def test_build_directory_toplevel(self): e = MockExecutive(output="toplevel") c = config.Config(e) self.assertEqual(c.build_directory(None), 'toplevel')
self.assertEqual(c.build_directory(None), 'toplevel')
Returns True if the build was successful and up-to-date.""" flag = self._FLAGS_FROM_CONFIGURATIONS[configuration] exit_code = self._executive.run_command([ self._script_path("build-dumprendertree"), flag], return_exit_code=True) if exit_code != 0: _log.error("Failed to build DumpRenderTree") return False return True
def test_build_directory_toplevel(self): e = MockExecutive(output="toplevel") c = config.Config(e) self.assertEqual(c.build_directory(None), 'toplevel')
def test_build_directory__release(self): e = MockExecutive(output="release") c = config.Config(e) self.assertEqual(c.build_directory('Release'), 'release')
def default_configuration(self): """Returns the default configuration for the user.
def test_build_directory__release(self): e = MockExecutive(output="release") c = config.Config(e) self.assertEqual(c.build_directory('Release'), 'release')
def test_build_directory__debug(self): e = MockExecutive(output="debug") c = config.Config(e) self.assertEqual(c.build_directory('Debug'), 'debug')
Returns the value set by 'set-webkit-configuration', or "Release" if that has not been set. This mirrors the logic in webkitdirs.pm.""" if not self._default_configuration: self._default_configuration = self._determine_configuration() if not self._default_configuration: self._default_configuration = 'Release' if self._d...
def test_build_directory__debug(self): e = MockExecutive(output="debug") c = config.Config(e) self.assertEqual(c.build_directory('Debug'), 'debug')
def test_build_directory__unknown(self): e = MockExecutive(output="unknown") c = config.Config(e) self.assertRaises(KeyError, c.build_directory, 'Unknown')
def path_from_webkit_base(self, *comps): return os.path.join(self.webkit_base_dir(), *comps)
def test_build_directory__unknown(self): e = MockExecutive(output="unknown") c = config.Config(e) self.assertRaises(KeyError, c.build_directory, 'Unknown')
def test_build_dumprendertree__success(self): e = MockExecutive(exit_code=0) c = config.Config(e) self.assertTrue(c.build_dumprendertree("Debug")) self.assertTrue(c.build_dumprendertree("Release")) self.assertRaises(KeyError, c.build_dumprendertree, "Unknown")
def webkit_base_dir(self): """Returns the absolute path to the top of the WebKit tree.
def test_build_dumprendertree__success(self): e = MockExecutive(exit_code=0) c = config.Config(e) self.assertTrue(c.build_dumprendertree("Debug")) self.assertTrue(c.build_dumprendertree("Release")) self.assertRaises(KeyError, c.build_dumprendertree, "Unknown")
def test_build_dumprendertree__failure(self): e = MockExecutive(exit_code=-1) c = config.Config(e)
Raises an AssertionError if the top dir can't be determined.""" if not self._webkit_base_dir: self._webkit_base_dir = scm.find_checkout_root() assert self._webkit_base_dir, "Could not determine the top of the WebKit checkout" return self._webkit_base_dir
def test_build_dumprendertree__failure(self): e = MockExecutive(exit_code=-1) c = config.Config(e)
oc = outputcapture.OutputCapture() oc.capture_output() self.assertFalse(c.build_dumprendertree('Debug')) (out, err) = oc.restore_output()
def _script_path(self, script_name): return os.path.join(self.webkit_base_dir(), "WebKitTools", "Scripts", script_name)
def test_build_dumprendertree__failure(self): e = MockExecutive(exit_code=-1) c = config.Config(e)
oc.capture_output() self.assertFalse(c.build_dumprendertree('Release')) oc.restore_output()
def _determine_configuration(self): global _determined_configuration if _determined_configuration == -1: contents = self._read_configuration() if contents == "Deployment": contents = "Release" if contents == "Development": contents = "Debug" _determined_configuration = contents return _determined_configuration
def test_build_dumprendertree__failure(self): e = MockExecutive(exit_code=-1) c = config.Config(e)
def test_default_configuration__release(self): self.assertConfiguration('Release', 'Release')
def _read_configuration(self): configuration_path = os.path.join(self.build_directory(None), "Configuration") if not os.path.exists(configuration_path): return None
def test_default_configuration__release(self): self.assertConfiguration('Release', 'Release')
def test_default_configuration__debug(self): self.assertConfiguration('Debug', 'Debug') def test_default_configuration__deployment(self): self.assertConfiguration('Deployment', 'Release') def test_default_configuration__development(self): self.assertConfiguration('Development', 'Debug') def test_default_configuratio...
with codecs.open(configuration_path, "r", "utf-8") as fh: return fh.read().rstrip()
def test_default_configuration__debug(self): self.assertConfiguration('Debug', 'Debug')
args.extend(["--ignore-tests", "compositing/iframes"])
args.extend(["--ignore-tests", "compositing"])
def run(self, state): if not self._options.test: return
def test_post_diff(self): expected_stderr = "Obsoleting 2 old patches on bug 42\n"
def test_post(self): expected_stderr = "Running check-webkit-style\nObsoleting 2 old patches on bug 42\n"
def test_post_diff(self): expected_stderr = "Obsoleting 2 old patches on bug 42\n" self.assert_execute_outputs(Post(), [42], expected_stderr=expected_stderr)
def test_prepare_diff(self):
def test_prepare(self):
def test_prepare_diff(self): self.assert_execute_outputs(Prepare(), [])
def test_submit_patch(self): expected_stderr = "Obsoleting 2 old patches on bug 42\n"
def test_upload(self): expected_stderr = "Running check-webkit-style\nObsoleting 2 old patches on bug 42\n"
def test_submit_patch(self): expected_stderr = "Obsoleting 2 old patches on bug 42\n" self.assert_execute_outputs(Upload(), [42], expected_stderr=expected_stderr)
wdiff = wdiff.replace(_WDIFF_DEL, '<span class=del>') wdiff = wdiff.replace(_WDIFF_ADD, '<span class=add>') wdiff = wdiff.replace(_WDIFF_END, '</span>')
wdiff = wdiff.replace(self._WDIFF_DEL, '<span class=del>') wdiff = wdiff.replace(self._WDIFF_ADD, '<span class=add>') wdiff = wdiff.replace(self._WDIFF_END, '</span>')
def _format_wdiff_output_as_html(self, wdiff): wdiff = cgi.escape(wdiff) wdiff = wdiff.replace(_WDIFF_DEL, '<span class=del>') wdiff = wdiff.replace(_WDIFF_ADD, '<span class=add>') wdiff = wdiff.replace(_WDIFF_END, '</span>') html = '<head><style>.del { background: #faa; } ' html += '.add { background: #afa; }</style><...
"--start-delete=%s" % _WDIFF_DEL, "--end-delete=%s" % _WDIFF_END, "--start-insert=%s" % _WDIFF_ADD, "--end-insert=%s" % _WDIFF_END,
"--start-delete=%s" % self._WDIFF_DEL, "--end-delete=%s" % self._WDIFF_END, "--start-insert=%s" % self._WDIFF_ADD, "--end-insert=%s" % self._WDIFF_END,
def _wdiff_command(self): executable = self._path_to_wdiff() return [executable, "--start-delete=%s" % _WDIFF_DEL, "--end-delete=%s" % _WDIFF_END, "--start-insert=%s" % _WDIFF_ADD, "--end-insert=%s" % _WDIFF_END, actual_filename, expected_filename]
MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/run-webkit-tests', '--no-launch-safari', '--exit-after-n-failures=1', '--ignore-tests', 'compositing/iframes', '--quiet']
MOCK run_and_throw_if_fail: ['WebKitTools/Scripts/run-webkit-tests', '--no-launch-safari', '--exit-after-n-failures=1', '--ignore-tests', 'compositing', '--quiet']
def test_runtests_leopard_commit_queue_hack(self): mock_options = Mock() mock_options.non_interactive = True step = RunTests(MockTool(log_executive=True), mock_options) # FIXME: We shouldn't use a real port-object here, but there is too much to mock at the moment. mock_port = WebKitPort() mock_port.name = lambda: "Mac"...
action is to wait for 60secs, and can be changed by changing kWaitForActionMaxMsec in ui_test.cc.
action is to wait for kWaitForActionMaxMsec, as set in ui_test.cc
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
Deaults to 0.25 secs.
Defaults to 0.25 secs.
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
print path, "OK:", metadata["License File"] print
def ScanThirdPartyDirs(third_party_dirs): """Scan a list of directories and report on any problems we find.""" errors = [] for path in sorted(third_party_dirs): try: metadata = ParseDir(path) except LicenseError, e: errors.append((path, e.args[0])) continue print path, "OK:", metadata["License File"] print for path, ...
command.extend(['--outputHeadersDir', hdir])
def main(args): sections = SplitArgsIntoSections(args[1:]) assert len(sections) == 3, sections (base, inputs, options) = sections assert len(base) == 3, base (input, cppdir, hdir) = base assert len(inputs) > 1, inputs generateBindings = inputs[0] perlModules = inputs[1:] includeDirs = [] for perlModule in perlModule...
register_cygwin=None,
register_cygwin=True,
def __init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT, root=None, use_tls=False, register_cygwin=None, pidfile=None): """Args: output_dir: the absolute path to the layout test result directory """ http_server.Lighttpd.__init__(self, port_obj, output_dir, port=_DEFAULT_WS_PORT, root=root, register_cygwin=regist...
self._port.baseline_path(platform), expected_filename)
self._rebaseline_port.baseline_path(), expected_filename)
def _extract_and_add_new_baselines(self, archive_file): """Extract new baselines from archive and add them to SVN repository.
def TryKillingOldServer(port): for protocol in ["http", "https"]: try: urllib2.urlopen("%s://localhost:%d/kill" % (protocol, port)).read() print "Killed old server instance on port %d (via %s)" % (port, protocol) except urllib2.URLError: pass
def TryKillingOldServer(port): # Note that an HTTP /kill request to the FTP server has the effect of # killing it. for protocol in ["http", "https"]: try: urllib2.urlopen("%s://localhost:%d/kill" % (protocol, port)).read() print "Killed old server instance on port %d (via %s)" % (port, protocol) except urllib2.URLError...
TryKillingOldServer(port)
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port # Try to free up the port if there's an orphaned old instance. TryKillingOldServer(port) if options.server_type == SERVER_HTTP: if opt...
return self.SimpleTest("chrome", "remoting_unittests")
return self.SimpleTest("chrome", "remoting_unittests", cmd_args=[ "--ui-test-timeout=240000", "--ui-test-action-timeout=120000", "--ui-test-action-max-timeout=280000"])
def TestRemoting(self): return self.SimpleTest("chrome", "remoting_unittests")
os.putenv("LD_LIBRARY_PATH", self._options.build_dir)
if (os.getenv("LD_LIBRARY_PATH")): os.putenv("LD_LIBRARY_PATH", "%s:%s" % (os.getenv("LD_LIBRARY_PATH"), self._options.build_dir)) else: os.putenv("LD_LIBRARY_PATH", self._options.build_dir)
def SimpleTest(self, module, name, heapcheck_test_args=None, cmd_args=None): '''Builds the command line and runs the specified test.
self._options.upload_incremental_results)
not self._options.upload_full_results)
def _write_json_files(self, unexpected_results, result_summary, individual_test_timings): """Writes the results of the test run as JSON files into the results dir.
if self._options.upload_incremental_results:
if self._options.upload_full_results: json_files.append("results.json") else:
def _upload_json_files(self): if not self._options.test_results_server: return
else: json_files.append("results.json")
def _upload_json_files(self): if not self._options.test_results_server: return
optparse.make_option("--upload-incremental-results",
optparse.make_option("--upload-full-results",
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which # FIXME: actually uses them. configuration_options should move # FIXME: to WebKitPort and be shared across all scripts. c...
help="If true, upload incremental json results to server."),
help="If true, upload full json results to server."),
def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which # FIXME: actually uses them. configuration_options should move # FIXME: to WebKitPort and be shared across all scripts. c...
return int(os.popen2("sysctl -n hw.ncpu")[1].read())
cmd = ['/usr/sbin/sysctl', '-n', 'hw.ncpu'] return int(subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout.read())
def get_num_cores(): """Returns the number of cores on the machine. For hyperthreaded machines, this will be double the number of actual processors.""" return int(os.popen2("sysctl -n hw.ncpu")[1].read())
subprocess.call([editor] + files)
args = shlex.split(editor) subprocess.call(args + files)
def edit(self, files): editor = os.environ.get("EDITOR") or "vi" subprocess.call([editor] + files)
self._indirect_analyze_results_file = ""
def __init__(self): BaseTool.__init__(self) self.RegisterOptionParserHook(ValgrindTool.ExtendOptionParser) self._indirect_analyze_results_file = ""
def GetAnalyzeResultsIndirect(self): assert self._indirect_analyze_results_file != "" f = open(self._indirect_analyze_results_file) if f: if len([True for l in f.readlines() if "FAIL" in l]) > 0: logging.error("There were some Valgrind reports in the tests!") print "-----------------------------------------------------...
def GetAnalyzeResultsIndirect(self): assert self._indirect_analyze_results_file != "" f = open(self._indirect_analyze_results_file) if f: if len([True for l in f.readlines() if "FAIL" in l]) > 0: logging.error("There were some Valgrind reports in the tests!") print "-----------------------------------------------------...
self._indirect_analyze_results_file = tempfile.mkstemp( dir=self.TMP_DIR, prefix="valgrind_analyze.", text=True)[1] analyze_script = os.path.join(self._source_dir, 'tools', 'valgrind', self.ToolName() + '_analyze.py')
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ ...
f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n')
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ ...
f.write("EXITCODE=$?\n") logs_list = logfiles.replace("%p", "$$.*") f.write("python %s %s || echo FAIL >>%s\n" \ % (analyze_script, logs_list, self._indirect_analyze_results_file)) f.write("rm %s\n" % logs_list) f.write("exit $EXITCODE\n")
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ ...
if self._options.indirect: return self.GetAnalyzeResultsIndirect() filenames = glob.glob(self.TMP_DIR + "/memcheck.*") use_gdb = common.IsMac() analyzer = memcheck_analyze.MemcheckAnalyze(self._source_dir, filenames, self._options.show_all_leaks, use_gdb=use_gdb) ret = analyzer.Report(check_sanity)
ret = self.GetAnalyzeResults(check_sanity)
def Analyze(self, check_sanity=False): if self._options.indirect: return self.GetAnalyzeResultsIndirect() # Glob all the files in the "valgrind.tmp" directory filenames = glob.glob(self.TMP_DIR + "/memcheck.*")
def Analyze(self, check_sanity=False): filenames = glob.glob(self.TMP_DIR + "/tsan.*") use_gdb = common.IsMac() analyzer = tsan_analyze.TsanAnalyze(self._source_dir, filenames, use_gdb=use_gdb) ret = analyzer.Report(check_sanity) if ret != 0: logging.info("Please see http://dev.chromium.org/developers/how-tos/" "using-...
def Analyze(self, check_sanity=False): filenames = glob.glob(self.TMP_DIR + "/tsan.*") use_gdb = common.IsMac() analyzer = tsan_analyze.TsanAnalyze(self._source_dir, filenames, use_gdb=use_gdb) ret = analyzer.Report(check_sanity) if ret != 0: logging.info("Please see http://dev.chromium.org/developers/how-tos/" "using-...
def Analyze(self, check_sanity=False): if self._options.indirect: return ValgrindTool.GetAnalyzeResultsIndirect(self) return ThreadSanitizerBase.Analyze(self, check_sanity)
def __init__(self): ValgrindTool.__init__(self) ThreadSanitizerBase.__init__(self)