rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
check_cg() | check_cgc(CGC) | def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
main(input) | main(input, CGC) | def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
cur_report_errors.add("This error was already printed " "in some other test, see 'hash= | cur_report_errors.add("This error was already printed in " "some other test, see 'hash= | def Report(self, files, check_sanity=False): '''Reads in a set of files and prints Memcheck report. |
ncores = int(os.popen2("sysctl -n hw.ncpu")[1].read()) | ncores = int(executive.run_command(["sysctl", "-n", "hw.ncpu"])) | def num_cores(self): ncores = int(os.popen2("sysctl -n hw.ncpu")[1].read()) # FIXME: new-run-webkit-tests is unstable running more than four # threads in parallel. # See https://bugs.webkit.org/show_bug.cgi?id=36622 if ncores > 4: ncores = 4 return ncores |
return os.path.splitext(basename)[0] | while 1: new_basename = os.path.splitext(basename)[0] if basename == new_basename: break else: basename = new_basename return basename | def ExtractModuleName(infile_path): """Infers the module name from the input file path. The input filename is supposed to be in the form "ModuleName.sigs". This function splits the filename from the extention on that basename of the path and returns that as the module name. Args: infile_path: String holding the path ... |
for root, directories, files in os.walk(path): | for root, directories, files in sorted_walk(path): | def _locateManifestsFromPath(self, path): """ Returns a list of paths to sample extension manifest.json files. |
for root, dirs, files in os.walk(extension_dir_path): | for root, dirs, files in sorted_walk(extension_dir_path): | def _parse_api_calls(self, api_methods): """ Returns a list of Chrome extension API calls the sample makes. |
for root, directories, files in os.walk(base_path): | for root, directories, files in sorted_walk(base_path): | def _parse_source_files(self): """ Returns a list of paths to source files present in the extenion. |
for root, dirs, files in os.walk(sample_path): | for root, dirs, files in sorted_walk(sample_path): | def write_zip(self): """ Writes a zip file containing all of the files in this Sample's dir.""" sample_path = os.path.realpath(os.path.dirname(self._manifest_path)) sample_dirname = os.path.basename(sample_path) sample_parentpath = os.path.dirname(sample_path) |
for i in range(0, 5): | for i in range(5): | def find_o3d_root(): path = os.path.abspath(sys.path[0]) for i in range(0, 5): path = os.path.dirname(path) if (os.path.isdir(os.path.join(path, 'o3d')) and os.path.isdir(os.path.join(path, 'third_party'))): return path return '' |
exes = [ os.path.join(cg_root, 'linux', 'bin', 'cgc'), os.path.join(cg_root, 'linux', 'bin64', 'cgc'), os.path.join(cg_root, 'mac', 'bin', 'cgc'), os.path.join(cg_root, 'win', 'bin', 'cgc.exe') ] for exe in exes: | exe_paths = ['linux/bin/cgc', 'linux/bin64/cgc', 'mac/bin/cgc', 'win/bin/cgc.exe'] for exe_path in exe_paths: | def default_cgc(): paths = [ '/usr/bin/cgc', 'C:/Program Files/NVIDIA Corporation/Cg/bin/cgc.exe', 'C:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cgc.exe' ] for path in paths: if os.path.exists(path): return path script_path = os.path.abspath(sys.path[0]) # Try again looking in the current working directory to match... |
subprocess.call([exe, '-v'], stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w')) return exe | exe = os.path.join(cg_root, exe_path) return_code = subprocess.call([exe, '-v'], stdout=open(os.devnull, 'w'), stderr=open(os.devnull, 'w')) if return_code == 0 or return_code == 1: return exe | def default_cgc(): paths = [ '/usr/bin/cgc', 'C:/Program Files/NVIDIA Corporation/Cg/bin/cgc.exe', 'C:/Program Files (x86)/NVIDIA Corporation/Cg/bin/cgc.exe' ] for path in paths: if os.path.exists(path): return path script_path = os.path.abspath(sys.path[0]) # Try again looking in the current working directory to match... |
def check_cgc(CGC): if not os.path.exists(CGC): print >>sys.stderr, CGC+' is not found, use --cgc option to specify its' | def check_cgc(cgc_path): if not os.path.exists(cgc_path): print >>sys.stderr, (cgc_path + ' is not found, use --cgc option to specify its') | def check_cgc(CGC): if not os.path.exists(CGC): print >>sys.stderr, CGC+' is not found, use --cgc option to specify its' print >>sys.stderr, 'location. You may need to install nvidia cg toolkit.' sys.exit(1) |
def cg_to_glsl(cg_shader, CGC): | def cg_to_glsl(cg_shader, cgc_path): | def cg_to_glsl(cg_shader, CGC): cg_shader = cg_rename_attributes(cg_shader) vertex_entry = re.search(r'#o3d\s+VertexShaderEntryPoint\s+(\w+)', cg_shader).group(1) p = subprocess.Popen([CGC]+('-profile glslv -entry %s' % vertex_entry).split(' '), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) gl... |
p = subprocess.Popen([CGC]+('-profile glslv -entry %s' % | p = subprocess.Popen([cgc_path]+('-profile glslv -entry %s' % | def cg_to_glsl(cg_shader, CGC): cg_shader = cg_rename_attributes(cg_shader) vertex_entry = re.search(r'#o3d\s+VertexShaderEntryPoint\s+(\w+)', cg_shader).group(1) p = subprocess.Popen([CGC]+('-profile glslv -entry %s' % vertex_entry).split(' '), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) gl... |
p = subprocess.Popen([CGC]+('-profile glslf -entry %s' % | p = subprocess.Popen([cgc_path]+('-profile glslf -entry %s' % | def cg_to_glsl(cg_shader, CGC): cg_shader = cg_rename_attributes(cg_shader) vertex_entry = re.search(r'#o3d\s+VertexShaderEntryPoint\s+(\w+)', cg_shader).group(1) p = subprocess.Popen([CGC]+('-profile glslv -entry %s' % vertex_entry).split(' '), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) gl... |
def main(cg_shader, CGC): | def main(cg_shader, cgc_path): | def main(cg_shader, CGC): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) | glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, cgc_path) | def main(cg_shader, CGC): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
CGC = default_cgc() | cgc_path = default_cgc() | def main(cg_shader, CGC): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
cmdline_parser.add_option('--cgc', dest='CGC', default=CGC, | cmdline_parser.add_option('--cgc', dest='cgc_path', default=cgc_path, | def main(cg_shader, CGC): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
CGC = options.CGC check_cgc(CGC) | cgc_path = options.cgc_path check_cgc(cgc_path) | def main(cg_shader, CGC): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
main(input, CGC) | main(input, cgc_path) | def main(cg_shader, CGC): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
path = os.path.join(options.results_directory, 'LayoutTests') if os.path.exists(path): shutil.rmtree(path) | meter.update("Clobbering old results in %s" % options.results_directory) layout_tests_dir = path_utils.layout_tests_dir() possible_dirs = os.listdir(layout_tests_dir) for dirname in possible_dirs: if os.path.isdir(os.path.join(layout_tests_dir, dirname)): shutil.rmtree(os.path.join(options.results_directory, dirname), ... | def main(options, args): """Run the tests. Will call sys.exit when complete. Args: options: a dictionary of command line options args: a list of sub directories or files to test """ if options.sources: options.verbose = True # Set up our logging format. meter = metered_stream.MeteredStream(options.verbose, sys.stde... |
if (options and (not hasattr(options, 'configuration') or options.configuration is None)): | if (options and not hasattr(options, 'configuration')): | def __init__(self, **kwargs): if 'options' in kwargs: options = kwargs['options'] if (options and (not hasattr(options, 'configuration') or options.configuration is None)): options.configuration = 'Release' base.Port.__init__(self, **kwargs) self._chromium_base_dir = None |
pid = int(f.read().strip()) | pid = int(file.read().strip()) | def stop(self, force=False): if not force and not self.is_running(): return |
log_fmt = ('%(asctime)s %(filename)s:%(lineno)-4d %(levelname)s ' '%(message)s') | log_fmt = ('%(asctime)s %(process)d %(filename)s:%(lineno)-4d %(levelname)s' '%(message)s') | def _configure_logging(stream, verbose): log_fmt = '%(message)s' log_datefmt = '%y%m%d %H:%M:%S' log_level = logging.INFO if verbose: log_fmt = ('%(asctime)s %(filename)s:%(lineno)-4d %(levelname)s ' '%(message)s') log_level = logging.DEBUG root = logging.getLogger() handler = logging.StreamHandler(stream) handler.set... |
def SetupHtmlDirectory(html_directory, clean_html_directory): | def SetupHtmlDirectory(html_directory): | def SetupHtmlDirectory(html_directory, clean_html_directory): """Setup the directory to store html results. All html related files are stored in the "rebaseline_html" subdirectory. Args: html_directory: parent directory that stores the rebaselining results. If None, a temp directory is created. clean_html_directory: ... |
clean_html_directory: if True, all existing files in the html directory are removed before rebaselining. | def SetupHtmlDirectory(html_directory, clean_html_directory): """Setup the directory to store html results. All html related files are stored in the "rebaseline_html" subdirectory. Args: html_directory: parent directory that stores the rebaselining results. If None, a temp directory is created. clean_html_directory: ... | |
if clean_html_directory and os.path.exists(html_directory): | if os.path.exists(html_directory): | def SetupHtmlDirectory(html_directory, clean_html_directory): """Setup the directory to store html results. All html related files are stored in the "rebaseline_html" subdirectory. Args: html_directory: parent directory that stores the rebaselining results. If None, a temp directory is created. clean_html_directory: ... |
archive_url = ('%s%s/%s.zip' % (url_base, latest_revision, self._options.archive_name)) | archive_url = ('%s%s/layout-test-results.zip' % (url_base, latest_revision)) | def _GetArchiveUrl(self): """Generate the url to download latest layout test archive. |
archive_test_name = '%s/%s-actual%s' % (self._options.archive_name, test_basename, suffix) | archive_test_name = 'layout-test-results/%s-actual%s' % (test_basename, suffix) | def _ExtractAndAddNewBaselines(self, archive_file): """Extract new baselines from archive and add them to SVN repository. |
if self._options.no_html_results: return | def _CreateHtmlBaselineFiles(self, baseline_fullpath): """Create baseline files (old, new and diff) in html directory. | |
self._browser_path = options.browser_path | def __init__(self, options, platforms, rebaselining_tests): self._html_directory = options.html_directory self._browser_path = options.browser_path self._platforms = platforms self._rebaselining_tests = rebaselining_tests self._html_file = os.path.join(options.html_directory, 'rebaseline.html') | |
if self._browser_path: RunShell([self._browser_path, html_uri], False) else: webbrowser.open(html_uri, 1) | webbrowser.open(html_uri, 1) | def ShowHtml(self): """Launch the rebaselining html in brwoser.""" |
option_parser.add_option('-t', '--archive_name', default='layout-test-results', help='Layout test result archive name.') | def main(): """Main function to produce new baselines.""" option_parser = optparse.OptionParser() option_parser.add_option('-v', '--verbose', action='store_true', default=False, help='include debug-level logging.') option_parser.add_option('-p', '--platforms', default='mac,win,win-xp,win-vista,linux', help=('Comma de... | |
option_parser.add_option('-o', '--no_html_results', action='store_true', default=False, help=('If specified, do not generate html that ' 'compares the rebaselining results.')) | def main(): """Main function to produce new baselines.""" option_parser = optparse.OptionParser() option_parser.add_option('-v', '--verbose', action='store_true', default=False, help='include debug-level logging.') option_parser.add_option('-p', '--platforms', default='mac,win,win-xp,win-vista,linux', help=('Comma de... | |
option_parser.add_option('-c', '--clean_html_directory', action='store_true', default=False, help=('If specified, delete all existing files in ' 'the html directory before rebaselining.')) option_parser.add_option('-e', '--browser_path', default='', help=('The browser path that you would like to ' 'use to launch the r... | def main(): """Main function to produce new baselines.""" option_parser = optparse.OptionParser() option_parser.add_option('-v', '--verbose', action='store_true', default=False, help='include debug-level logging.') option_parser.add_option('-p', '--platforms', default='mac,win,win-xp,win-vista,linux', help=('Comma de... | |
if not options.no_html_results: options.html_directory = SetupHtmlDirectory(options.html_directory, options.clean_html_directory) | options.html_directory = SetupHtmlDirectory(options.html_directory) | def main(): """Main function to produce new baselines.""" option_parser = optparse.OptionParser() option_parser.add_option('-v', '--verbose', action='store_true', default=False, help='include debug-level logging.') option_parser.add_option('-p', '--platforms', default='mac,win,win-xp,win-vista,linux', help=('Comma de... |
if not options.no_html_results: logging.info('') LogDashedString('Rebaselining result comparison started', None) html_generator = HtmlGenerator(options, rebaseline_platforms, rebaselining_tests) html_generator.GenerateHtml() html_generator.ShowHtml() LogDashedString('Rebaselining result comparison done', None) | logging.info('') LogDashedString('Rebaselining result comparison started', None) html_generator = HtmlGenerator(options, rebaseline_platforms, rebaselining_tests) html_generator.GenerateHtml() html_generator.ShowHtml() LogDashedString('Rebaselining result comparison done', None) | def main(): """Main function to produce new baselines.""" option_parser = optparse.OptionParser() option_parser.add_option('-v', '--verbose', action='store_true', default=False, help='include debug-level logging.') option_parser.add_option('-p', '--platforms', default='mac,win,win-xp,win-vista,linux', help=('Comma de... |
options.child_processes = str(port_obj.default_child_processes()) | options.child_processes = os.environ.get("WEBKIT_TEST_CHILD_PROCESSES", str(port_obj.default_child_processes())) | def _set_up_derived_options(port_obj, options): """Sets the options values that depend on other options values.""" if not options.child_processes: # FIXME: Investigate perf/flakiness impact of using cpu_count + 1. options.child_processes = str(port_obj.default_child_processes()) if not options.configuration: options.... |
Committer("Jeremy Orlow", "jorlow@chromium.org"), | def __init__(self, name, email_or_emails): Committer.__init__(self, name, email_or_emails) self.can_review = True | |
def RunCommand(argv): """Runs the command with given argv and returns exit code.""" try: proc = subprocess.Popen(argv, stdout=None) except OSError: return 1 output = proc.communicate()[0] return proc.returncode | NONESSENTIAL_DIRS = ( 'chrome/test/data', 'chrome/tools/test/reference_build', 'gears/binaries', 'net/data/cache_tests', 'o3d/documentation', 'o3d/samples', 'third_party/lighttpd', 'third_party/WebKit/LayoutTests', 'webkit/data/layout_tests', 'webkit/tools/test/reference_build', ) def GetSourceDirectory(): return os.p... | def RunCommand(argv): """Runs the command with given argv and returns exit code.""" try: proc = subprocess.Popen(argv, stdout=None) except OSError: return 1 output = proc.communicate()[0] return proc.returncode |
target_dir = tempfile.mkdtemp() | def main(argv): parser = optparse.OptionParser() parser.add_option("--remove-nonessential-files", dest="remove_nonessential_files", action="store_true", default=False) options, args = parser.parse_args(argv) if len(args) != 1: print 'You must provide only one argument: output file name' print '(without .tar.bz2 exten... | |
try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 | def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True | def main(argv): parser = optparse.OptionParser() parser.add_option("--remove-nonessential-files", dest="remove_nonessential_files", action="store_true", default=False) options, args = parser.parse_args(argv) if len(args) != 1: print 'You must provide only one argument: output file name' print '(without .tar.bz2 exten... |
if options.remove_nonessential_files: nonessential_dirs = ( 'src/chrome/test/data', 'src/chrome/tools/test/reference_build', 'src/gears/binaries', 'src/net/data/cache_tests', 'src/o3d/documentation', 'src/o3d/samples', 'src/third_party/lighttpd', 'src/third_party/WebKit/LayoutTests', 'src/webkit/data/layout_tests', 'sr... | if not options.remove_nonessential_files: return False for nonessential_dir in NONESSENTIAL_DIRS: if path.startswith(os.path.join(GetSourceDirectory(), nonessential_dir)): return True | def main(argv): parser = optparse.OptionParser() parser.add_option("--remove-nonessential-files", dest="remove_nonessential_files", action="store_true", default=False) options, args = parser.parse_args(argv) if len(args) != 1: print 'You must provide only one argument: output file name' print '(without .tar.bz2 exten... |
with contextlib.closing(tarfile.open(output_fullname, 'w:bz2')) as archive: archive.add(os.path.join(target_dir, 'src'), arcname=output_basename) finally: shutil.rmtree(target_dir) | return False with contextlib.closing(tarfile.open(output_fullname, 'w:bz2')) as archive: archive.add(GetSourceDirectory(), arcname=output_basename, exclude=ShouldExcludePath) | def main(argv): parser = optparse.OptionParser() parser.add_option("--remove-nonessential-files", dest="remove_nonessential_files", action="store_true", default=False) options, args = parser.parse_args(argv) if len(args) != 1: print 'You must provide only one argument: output file name' print '(without .tar.bz2 exten... |
base = os.path.join(self.path_from_webkit_base(), 'WebKit', 'chromium') | base = os.path.join(self.path_from_webkit_base()) | def _build_path(self, *comps): if self._options.use_drt: base = os.path.join(self.path_from_webkit_base(), 'WebKit', 'chromium') else: base = self.path_from_chromium_base() if os.path.exists(os.path.join(base, 'sconsbuild')): return os.path.join(base, 'sconsbuild', *comps) else: return os.path.join(base, 'out', *comps) |
base = os.path.join(self.path_from_webkit_base()) | base = os.path.join(self.path_from_webkit_base(), 'WebKit', 'chromium') | def _build_path(self, *comps): if self._options.use_drt: base = os.path.join(self.path_from_webkit_base()) else: base = self.path_from_chromium_base() if os.path.exists(os.path.join(base, 'sconsbuild')): return os.path.join(base, 'sconsbuild', *comps) else: return os.path.join(base, 'out', *comps) |
def RenderPage(name, test_shell): | def RenderPages(names, test_shell): | 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 + "/" + ... |
Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html | Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html | 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 + "/" + ... |
if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() | if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(inp... | 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 + "/" + ... |
shutil.copy(_page_shell_html, input_file) p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith(" raise Exception("test... | open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files | 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 + "/" + ... |
search_locations.append(chrome_dir + "/Release/test_shell.exe") | def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.geten... | |
search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") | def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.geten... | |
search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") | def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.geten... | |
modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) | modified_files = RenderPages(page_names, test_shell) | def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if ... |
"""Restore logging to its original state. | """Assert there are no remaining log messages, and reset logging. | def tearDown(self): """Restore logging to its original state. |
This should normally be called in the tearDown() method of a unittest.TestCase. See the docstring of this class for more details. | This method asserts that there are no more messages in the array of log messages, and then restores logging to its original state. This method should normally be called in the tearDown() method of a unittest.TestCase. See the docstring of this class for more details. | def tearDown(self): """Restore logging to its original state. |
"""Assert that the given messages match the logged messages. | """Assert the current array of log messages, and clear its contents. | def assertMessages(self, messages): """Assert that the given messages match the logged messages. |
if self._options.use_drt: driver_args.append('--test-shell') if self._image_path: driver_args.append('--pixel-tests' % image_path) else: if self._image_path: driver_args.append('--pixel-tests') | if self._image_path: driver_args.append('--pixel-tests') | def _driver_args(self): driver_args = [] |
results.extend(CheckTreeIsOpen( | results.extend(input_api.canned_checks.CheckTreeIsOpen( | def CheckChangeOnCommit(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) # TODO(thestig) temporarily disabled, doesn't work in third_party/ #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( # input_api, output_api, sources)) # Make sure the tree is 'open'. ... |
'http://chromium-status.appspot.com/status', '0', 'http://chromium-status.appspot.com/current?format=raw')) results.extend(CheckTryJobExecution(input_api, output_api)) | 'http://chromium-status.appspot.com/current?format=raw', '.*closed.*')) results.extend(input_api.canned_checks.CheckRietveldTryJobExecution(input_api, output_api, 'http://codereview.chromium.org', ('win', 'linux', 'mac'), 'tryserver@chromium.org')) | def CheckChangeOnCommit(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) # TODO(thestig) temporarily disabled, doesn't work in third_party/ #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( # input_api, output_api, sources)) # Make sure the tree is 'open'. ... |
results.extend(CheckPendingBuilds( | results.extend(input_api.canned_checks.CheckBuildbotPendingBuilds( | def CheckChangeOnCommit(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) # TODO(thestig) temporarily disabled, doesn't work in third_party/ #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( # input_api, output_api, sources)) # Make sure the tree is 'open'. ... |
'http://build.chromium.org/buildbot/waterfall/json/builders', | 'http://build.chromium.org/buildbot/waterfall/json/builders?filter=1', | def CheckChangeOnCommit(input_api, output_api): results = [] results.extend(_CommonChecks(input_api, output_api)) # TODO(thestig) temporarily disabled, doesn't work in third_party/ #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( # input_api, output_api, sources)) # Make sure the tree is 'open'. ... |
def CheckTryJobExecution(input_api, output_api): outputs = [] if not input_api.change.issue or not input_api.change.patchset: return outputs url = "http://codereview.chromium.org/%d/get_build_results/%d" % ( input_api.change.issue, input_api.change.patchset) PLATFORMS = ('win', 'linux', 'mac') try: connection = input_a... | def CheckTryJobExecution(input_api, output_api): outputs = [] if not input_api.change.issue or not input_api.change.patchset: return outputs url = "http://codereview.chromium.org/%d/get_build_results/%d" % ( input_api.change.issue, input_api.change.patchset) PLATFORMS = ('win', 'linux', 'mac') try: connection = input_a... | |
self.WaitForNotificationCount(1) self._CreateHTMLNotification(self.NO_SUCH_URL2, 'chat') | def testNotificationReplacement(self): """Test that we can replace a notification using the replaceId.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL, 'chat') self.WaitForNotificationCount(1) self._CreateHTMLNotification(self.NO_SUCH_URL2, 'chat') notific... | |
self.assertEquals(self.NO_SUCH_URL2, notifications[0]['content_url']) | self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url']) | def testNotificationReplacement(self): """Test that we can replace a notification using the replaceId.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL, 'chat') self.WaitForNotificationCount(1) self._CreateHTMLNotification(self.NO_SUCH_URL2, 'chat') notific... |
return [''.join(report_lines) for report_lines in self.reports] | return [''.join(map(str, report_lines)) for report_lines in self.reports] | def GetReports(self, files): '''Extracts reports from a set of files. |
return webkit.WebKitDriver(self, image_path, options, exectuive=self._executive) return ChromiumDriver(self, image_path, options, exectuive=self._executive) | return webkit.WebKitDriver(self, image_path, options, executive=self._executive) return ChromiumDriver(self, image_path, options, executive=self._executive) | def create_driver(self, image_path, options): """Starts a new Driver and returns a handle to it.""" if self._options.use_drt: return webkit.WebKitDriver(self, image_path, options, exectuive=self._executive) return ChromiumDriver(self, image_path, options, exectuive=self._executive) |
def test_exists__true(self): fs = FileSystem() self.assertTrue(fs.exists(self._this_file)) | Unless otherwise noted, all paths are allowed to be either absolute or relative.""" | def test_exists__true(self): fs = FileSystem() self.assertTrue(fs.exists(self._this_file)) |
def test_exists__false(self): fs = FileSystem() self.assertFalse(fs.exists(self._missing_file)) | def exists(self, path): """Return whether the path exists in the filesystem.""" return os.path.exists(path) | def test_exists__false(self): fs = FileSystem() self.assertFalse(fs.exists(self._missing_file)) |
def test_isdir__true(self): fs = FileSystem() self.assertTrue(fs.isdir(self._this_dir)) | def isdir(self, path): """Return whether the path refers to a directory.""" return os.path.isdir(path) | def test_isdir__true(self): fs = FileSystem() self.assertTrue(fs.isdir(self._this_dir)) |
def test_isdir__false(self): fs = FileSystem() self.assertFalse(fs.isdir(self._this_file)) | def join(self, *comps): """Return the path formed by joining the components.""" return os.path.join(*comps) | def test_isdir__false(self): fs = FileSystem() self.assertFalse(fs.isdir(self._this_file)) |
def test_join(self): fs = FileSystem() self.assertEqual(fs.join('foo', 'bar'), os.path.join('foo', 'bar')) | def listdir(self, path): """Return the contents of the directory pointed to by path.""" return os.listdir(path) | def test_join(self): fs = FileSystem() self.assertEqual(fs.join('foo', 'bar'), os.path.join('foo', 'bar')) |
def test_listdir(self): fs = FileSystem() with fs.mkdtemp(prefix='filesystem_unittest_') as d: self.assertEqual(fs.listdir(d), []) new_file = os.path.join(d, 'foo') fs.write_text_file(new_file, u'foo') self.assertEqual(fs.listdir(d), ['foo']) os.remove(new_file) | def mkdtemp(self, **kwargs): """Create and return a uniquely named directory. | def test_listdir(self): fs = FileSystem() with fs.mkdtemp(prefix='filesystem_unittest_') as d: self.assertEqual(fs.listdir(d), []) new_file = os.path.join(d, 'foo') fs.write_text_file(new_file, u'foo') self.assertEqual(fs.listdir(d), ['foo']) os.remove(new_file) |
def test_maybe_make_directory__success(self): fs = FileSystem() | This is like tempfile.mkdtemp, but if used in a with statement the directory will self-delete at the end of the block (if the directory is empty; non-empty directories raise errors). The directory can be safely deleted inside the block as well, if so desired.""" class TemporaryDirectory(object): def __init__(self, **kw... | def test_maybe_make_directory__success(self): fs = FileSystem() |
with fs.mkdtemp(prefix='filesystem_unittest_') as base_path: sub_path = os.path.join(base_path, "newdir") self.assertFalse(os.path.exists(sub_path)) self.assertFalse(fs.isdir(sub_path)) | def __enter__(self): self._directory_path = tempfile.mkdtemp(**self._kwargs) return self._directory_path | def test_maybe_make_directory__success(self): fs = FileSystem() |
fs.maybe_make_directory(sub_path) self.assertTrue(os.path.exists(sub_path)) self.assertTrue(fs.isdir(sub_path)) | def __exit__(self, type, value, traceback): | def test_maybe_make_directory__success(self): fs = FileSystem() |
fs.maybe_make_directory(sub_path) self.assertTrue(os.path.exists(sub_path)) self.assertTrue(fs.isdir(sub_path)) | if os.path.exists(self._directory_path): os.rmdir(self._directory_path) | def test_maybe_make_directory__success(self): fs = FileSystem() |
os.rmdir(sub_path) | return TemporaryDirectory(**kwargs) | def test_maybe_make_directory__success(self): fs = FileSystem() |
self.assertFalse(os.path.exists(base_path)) self.assertFalse(fs.isdir(base_path)) | def maybe_make_directory(self, *path): """Create the specified directory if it doesn't already exist.""" try: os.makedirs(os.path.join(*path)) except OSError, e: if e.errno != errno.EEXIST: raise | def test_maybe_make_directory__success(self): fs = FileSystem() |
def test_maybe_make_directory__failure(self): if sys.platform in ('win32', 'cygwin'): return | def read_binary_file(self, path): """Return the contents of the file at the given path as a byte string.""" with file(path, 'rb') as f: return f.read() | def test_maybe_make_directory__failure(self): # FIXME: os.chmod() doesn't work on Windows to set directories # as readonly, so we skip this test for now. if sys.platform in ('win32', 'cygwin'): return |
fs = FileSystem() with fs.mkdtemp(prefix='filesystem_unittest_') as d: os.chmod(d, stat.S_IRUSR) | def read_text_file(self, path): """Return the contents of the file at the given path as a Unicode string. | def test_maybe_make_directory__failure(self): # FIXME: os.chmod() doesn't work on Windows to set directories # as readonly, so we skip this test for now. if sys.platform in ('win32', 'cygwin'): return |
sub_dir = fs.join(d, 'subdir') self.assertRaises(OSError, fs.maybe_make_directory, sub_dir) | The file is read assuming it is a UTF-8 encoded file with no BOM.""" with codecs.open(path, 'r', 'utf8') as f: return f.read() | def test_maybe_make_directory__failure(self): # FIXME: os.chmod() doesn't work on Windows to set directories # as readonly, so we skip this test for now. if sys.platform in ('win32', 'cygwin'): return |
if os.path.exists(sub_dir): os.rmdir(sub_dir) | def write_binary_file(self, path, contents): """Write the contents to the file at the given location.""" with file(path, 'wb') as f: f.write(contents) | def test_maybe_make_directory__failure(self): # FIXME: os.chmod() doesn't work on Windows to set directories # as readonly, so we skip this test for now. if sys.platform in ('win32', 'cygwin'): return |
def test_read_and_write_file(self): fs = FileSystem() text_path = None binary_path = None | def write_text_file(self, path, contents): """Write the contents to the file at the given location. | def test_read_and_write_file(self): fs = FileSystem() text_path = None binary_path = None |
unicode_text_string = u'Ūnĭcōde̽' hex_equivalent = '\xC5\xAA\x6E\xC4\xAD\x63\xC5\x8D\x64\x65\xCC\xBD' try: text_path = tempfile.mktemp(prefix='tree_unittest_') binary_path = tempfile.mktemp(prefix='tree_unittest_') fs.write_text_file(text_path, unicode_text_string) contents = fs.read_binary_file(text_path) self.assertE... | The file is written encoded as UTF-8 with no BOM.""" with codecs.open(path, 'w', 'utf8') as f: f.write(contents) | def test_read_and_write_file(self): fs = FileSystem() text_path = None binary_path = None |
return STUB_FUNCTION_DEFINITION % { 'return_type': signature['return_type'], 'name': signature['name'], 'params': ', '.join(signature['params']), 'return_prefix': return_prefix, 'arg_list': arg_list} | if arg_list != '' and len(arguments) > 1 and arguments[-1] == '...': if return_prefix != '': return VARIADIC_STUB_FUNCTION_DEFINITION % { 'return_type': signature['return_type'], 'name': signature['name'], 'params': ', '.join(signature['params']), 'arg_list': ', '.join(arguments[0:-1]), 'last_named_arg': arguments[-2]... | def StubFunction(cls, signature): """Generates a stub function definition for the given signature. |
def UpdateGClientBranch(webkit_rev): | def UpdateGClientBranch(webkit_rev, magic_gclient_branch): | def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target ... |
current = RunGit(['show-ref', '--hash', MAGIC_GCLIENT_BRANCH]) | current = RunGit(['show-ref', '--hash', magic_gclient_branch]) | def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target ... |
MAGIC_GCLIENT_BRANCH, target], | magic_gclient_branch, target], | def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target ... |
def UpdateCurrentCheckoutIfAppropriate(): | def UpdateCurrentCheckoutIfAppropriate(magic_gclient_branch): | def UpdateCurrentCheckoutIfAppropriate(): """Reset the current gclient branch if that's what we have checked out.""" branch = RunGit(['symbolic-ref', '-q', 'HEAD']) if branch != MAGIC_GCLIENT_BRANCH: print "We have now updated the 'gclient' branch, but third_party/WebKit" print "has some other branch ('%s') checked out... |
if branch != MAGIC_GCLIENT_BRANCH: | if branch != magic_gclient_branch: | def UpdateCurrentCheckoutIfAppropriate(): """Reset the current gclient branch if that's what we have checked out.""" branch = RunGit(['symbolic-ref', '-q', 'HEAD']) if branch != MAGIC_GCLIENT_BRANCH: print "We have now updated the 'gclient' branch, but third_party/WebKit" print "has some other branch ('%s') checked out... |
changed = UpdateGClientBranch(webkit_rev) | magic_gclient_branch = GetGClientBranchName() changed = UpdateGClientBranch(webkit_rev, magic_gclient_branch) | def main(): if not os.path.exists('third_party/WebKit/.git'): if os.path.exists('third_party/WebKit'): print "ERROR: third_party/WebKit appears to not be under git control." else: print "ERROR: third_party/WebKit could not be found." print "Did you run this script from the right directory?" print "See http://code.goog... |
return UpdateCurrentCheckoutIfAppropriate() | return UpdateCurrentCheckoutIfAppropriate(magic_gclient_branch) | def main(): if not os.path.exists('third_party/WebKit/.git'): if os.path.exists('third_party/WebKit'): print "ERROR: third_party/WebKit appears to not be under git control." else: print "ERROR: third_party/WebKit could not be found." print "Did you run this script from the right directory?" print "See http://code.goog... |
''.join(output), self._output_image(), actual_checksum, crash, time.time() - start_time, timeout, ''.join(error)) | ''.join(output), self._output_image_with_retry(), actual_checksum, crash, run_time, timeout, ''.join(error)) | def run_test(self, uri, timeoutms, checksum): output = [] error = [] crash = False timeout = False actual_uri = None actual_checksum = None |
def __init__(self, server_address, request_hander_class, cert_path): | def __init__(self, server_address, request_hander_class, cert_path, ssl_client_auth): | def __init__(self, server_address, request_hander_class, cert_path): s = open(cert_path).read() x509 = tlslite.api.X509() x509.parse(s) self.cert_chain = tlslite.api.X509CertChain([x509]) s = open(cert_path).read() self.private_key = tlslite.api.parsePEMKey(s, private=True) |
sessionCache=self.session_cache) | sessionCache=self.session_cache, reqCert=self.ssl_client_auth) | def handshake(self, tlsConnection): """Creates the SSL connection.""" try: tlsConnection.handshakeServer(certChain=self.cert_chain, privateKey=self.private_key, sessionCache=self.session_cache) tlsConnection.ignoreAbruptClose = True return True except tlslite.api.TLSError, error: print "Handshake failure:", str(error) ... |
server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert) | server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth) | def main(options, args): # redirect output to a log file so it doesn't spam the unit test output logfile = open('testserver.log', 'w') sys.stderr = sys.stdout = 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: ... |
data = eval(raw_data.replace('null', 'None')) | patched_data = raw_data.replace('null', 'None') patched_data = patched_data.replace('false', 'False') patched_data = patched_data.replace('true', 'True') data = eval(patched_data) | def CheckPendingBuilds(input_api, output_api, url, max_pendings, ignored): try: connection = input_api.urllib2.urlopen(url) raw_data = connection.read() connection.close() try: import simplejson data = simplejson.loads(raw_data) except ImportError: # simplejson is much safer. But we should be just fine enough with that... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.