bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
code = """ typedef %(func_name)s::Result Result;
|
code = """ typedef %(func_name)s::Result Result;
| 475,300
|
def WriteValidationCode(self, file): """Writes the validation code for an argument.""" pass
|
def WriteValidationCode(self, file, func): """Writes the validation code for an argument.""" pass
| 475,301
|
def WriteClientSideValidationCode(self, file): """Writes the validation code for an argument.""" pass
|
def WriteClientSideValidationCode(self, file, func): """Writes the validation code for an argument.""" pass
| 475,302
|
def WriteValidationCode(self, file): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
|
def WriteValidationCode(self, file, func): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
| 475,303
|
def WriteValidationCode(self, file): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
|
def WriteValidationCode(self, file): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE, \"gl%s: %s < 0\");\n" % (func.original_name, self.name)) file.Write(" return error::kNoError;\n") file.Write(" }\n")
| 475,304
|
def WriteClientSideValidationCode(self, file): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return;\n") file.Write(" }\n")
|
def WriteClientSideValidationCode(self, file, func): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return;\n") file.Write(" }\n")
| 475,305
|
def WriteClientSideValidationCode(self, file): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return;\n") file.Write(" }\n")
|
def WriteClientSideValidationCode(self, file): """overridden from Argument.""" file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE, \"gl%s: %s < 0\");\n" % (func.original_name, self.name)) file.Write(" return;\n") file.Write(" }\n")
| 475,306
|
def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.local_type, self.name)) file.Write(" SetGLError(%s);\n" % self.gl_error) file.Write(" return error::kNoError;\n") file.Write(" }\n")
|
def WriteValidationCode(self, file, func): file.Write(" if (!Validate%s(%s)) {\n" % (self.local_type, self.name)) file.Write(" SetGLError(%s);\n" % self.gl_error) file.Write(" return error::kNoError;\n") file.Write(" }\n")
| 475,307
|
def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.local_type, self.name)) file.Write(" SetGLError(%s);\n" % self.gl_error) file.Write(" return error::kNoError;\n") file.Write(" }\n")
|
def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.local_type, self.name)) file.Write(" SetGLError(%s, \"gl%s: %s %s\");\n" % (self.gl_error, func.original_name, self.name, self.gl_error)) file.Write(" return error::kNoError;\n") file.Write(" }\n")
| 475,308
|
def WriteValidationCode(self, file): """Overridden from Argument.""" file.Write(" if (%s == NULL) {\n" % self.name) file.Write(" return error::kOutOfBounds;\n") file.Write(" }\n")
|
def WriteValidationCode(self, file, func): """Overridden from Argument.""" file.Write(" if (%s == NULL) {\n" % self.name) file.Write(" return error::kOutOfBounds;\n") file.Write(" }\n")
| 475,309
|
def WriteValidationCode(self, file): """Overridden from Argument.""" file.Write(" if (%s == NULL) {\n" % self.name) file.Write(" return error::kOutOfBounds;\n") file.Write(" }\n")
|
def WriteValidationCode(self, file, func): """Overridden from Argument.""" file.Write(" if (%s == NULL) {\n" % self.name) file.Write(" return error::kOutOfBounds;\n") file.Write(" }\n")
| 475,310
|
def WriteHandlerValidation(self, file): """Writes validation code for the function.""" for arg in self.GetOriginalArgs(): arg.WriteValidationCode(file) self.WriteValidationCode(file)
|
def WriteHandlerValidation(self, file): """Writes validation code for the function.""" for arg in self.GetOriginalArgs(): arg.WriteValidationCode(file, self) self.WriteValidationCode(file)
| 475,311
|
def git_fetch_id(): """ Fetch the GIT identifier for the local tree. Errors are swallowed. """ try: p = subprocess.Popen(['git', 'log', '-1'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32')) except OSError: # 'git' is apparently either not installed or not executable. return None id = None if p: git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M) m = git_re.search(p.stdout.read()) if m: id = m.group(2) return id
|
def git_fetch_id(): """ Fetch the GIT identifier for the local tree. Errors are swallowed. """ try: proc = subprocess.Popen(['git', 'log', '-999'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32')) for line in proc.stdout: match = git_re.search(line) if match: id = match.group(2) if id: proc.stdout.close() return id except OSError: # 'git' is apparently either not installed or not executable. return None id = None if p: git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M) m = git_re.search(p.stdout.read()) if m: id = m.group(2) return id
| 475,312
|
def git_fetch_id(): """ Fetch the GIT identifier for the local tree. Errors are swallowed. """ try: p = subprocess.Popen(['git', 'log', '-1'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32')) except OSError: # 'git' is apparently either not installed or not executable. return None id = None if p: git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M) m = git_re.search(p.stdout.read()) if m: id = m.group(2) return id
|
def git_fetch_id(): """ Fetch the GIT identifier for the local tree. Errors are swallowed. """ try: p = subprocess.Popen(['git', 'log', '-1'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32')) except OSError: # 'git' is apparently either not installed or not executable. pass return None
| 475,313
|
def setUp(self): self._to_import = ['ALL']
|
def setUp(self): self._to_import = ['ALL']
| 475,314
|
def tearDown(self): pyauto.PyUITest.tearDown(self) # Re-set the path to its state before the test. if self.IsMac(): if self._old_path: os.environ['DYLD_FALLBACK_LIBRARY_PATH'] = self._old_path else: os.environ.pop('DYLD_FALLBACK_LIBRARY_PATH') # Delete any replacers to restore the original profiles. if self._safari_replacer: del self._safari_replacer if self._firefox_replacer: del self._firefox_replacer
|
def tearDown(self): pyauto.PyUITest.tearDown(self) # Re-set the path to its state before the test.# Delete any replacers to restore the original profiles. if self._safari_replacer: del self._safari_replacer if self._firefox_replacer: del self._firefox_replacer
| 475,315
|
def testFirefoxImportFromPrefs(self): """Verify importing Firefox data through preferences.""" self._SwapFirefoxProfile() self.ImportSettings('Mozilla Firefox', False, ['ALL']) self._CheckDefaults(bookmarks=True, history=True, passwords=True, home_page=False, search_engines=True)
|
def testFirefoxImportFromPrefs(self): """Verify importing Firefox data through preferences.""" self._SwapFirefoxProfile() self.ImportSettings('Mozilla Firefox', False, self._to_import) self._CheckDefaults(bookmarks=True, history=True, passwords=True, home_page=False, search_engines=True)
| 475,316
|
def testFirefoxFirstRun(self): """Verify importing from Firefox on the first run.
|
def testFirefoxFirstRun(self): """Verify importing from Firefox on the first run.
| 475,317
|
def testImportFirefoxDataTwice(self): """Verify importing Firefox data twice.
|
def testImportFirefoxDataTwice(self): """Verify importing Firefox data twice.
| 475,318
|
def testImportFirefoxDataTwice(self): """Verify importing Firefox data twice.
|
def testImportFirefoxDataTwice(self): """Verify importing Firefox data twice.
| 475,319
|
def testImportFromFirefoxAndSafari(self): """Verify importing from Firefox and then Safari.""" # This test is for Mac only. if not self.IsMac(): return
|
def testImportFromFirefoxAndSafari(self): """Verify importing from Firefox and then Safari.""" # This test is for Mac only. if not self.IsMac(): return
| 475,320
|
def testSafariImportFromPrefs(self): """Verify importing Safari data through preferences.""" # This test is Mac only. if not self.IsMac(): return self._SwapSafariProfile() self.ImportSettings('Safari', False, ['ALL']) self._CheckDefaults(bookmarks=True, history=True, passwords=False, home_page=False, search_engines=True)
|
def testSafariImportFromPrefs(self): """Verify importing Safari data through preferences.""" # This test is Mac only. if not self.IsMac(): return self._SwapSafariProfile() self.ImportSettings('Safari', False, self._to_import) self._CheckDefaults(bookmarks=True, history=True, passwords=False, home_page=False, search_engines=True)
| 475,321
|
def testSafariFirstRun(self): """Verify importing Safari data on the first run.""" # This test is Mac only. if not self.IsMac(): return self._SwapSafariProfile() self.ImportSettings('Safari', False, ['ALL']) self._CheckDefaults(bookmarks=True, history=True, passwords=False, home_page=False, search_engines=False)
|
def testSafariFirstRun(self): """Verify importing Safari data on the first run.""" # This test is Mac only. if not self.IsMac(): return self._SwapSafariProfile() self.ImportSettings('Safari', False, self._to_import) self._CheckDefaults(bookmarks=True, history=True, passwords=False, home_page=False, search_engines=False)
| 475,322
|
def testImportSafariDataTwice(self): """Verify importing Safari data twice.
|
def testImportSafariDataTwice(self): """Verify importing Safari data twice.
| 475,323
|
def testImportSafariDataTwice(self): """Verify importing Safari data twice.
|
def testImportSafariDataTwice(self): """Verify importing Safari data twice.
| 475,324
|
def gatherFrames(node, source_dir): frames = [] for frame in node.getElementsByTagName("frame"): frame_dict = { INSTRUCTION_POINTER : getTextOf(frame, INSTRUCTION_POINTER), OBJECT_FILE : getTextOf(frame, OBJECT_FILE), FUNCTION_NAME : getTextOf(frame, FUNCTION_NAME), SRC_FILE_DIR : removeCommonRoot( source_dir, getTextOf(frame, SRC_FILE_DIR)), SRC_FILE_NAME : getTextOf(frame, SRC_FILE_NAME), SRC_LINE : getTextOf(frame, SRC_LINE) } frames += [frame_dict] if frame_dict[FUNCTION_NAME] in _TOP_OF_STACK_POINTS: break global TheAddressTable if TheAddressTable != None and frame_dict[SRC_LINE] == "": # Try using gdb TheAddressTable.Add(frame_dict[OBJECT_FILE], frame_dict[INSTRUCTION_POINTER]) return frames
|
def gatherFrames(node, source_dir): frames = [] for frame in node.getElementsByTagName("frame"): frame_dict = { INSTRUCTION_POINTER : getTextOf(frame, INSTRUCTION_POINTER), OBJECT_FILE : getTextOf(frame, OBJECT_FILE), FUNCTION_NAME : getTextOf(frame, FUNCTION_NAME), SRC_FILE_DIR : removeCommonRoot( source_dir, getTextOf(frame, SRC_FILE_DIR)), SRC_FILE_NAME : getTextOf(frame, SRC_FILE_NAME), SRC_LINE : getTextOf(frame, SRC_LINE) } frames += [frame_dict] if frame_dict[FUNCTION_NAME] in _TOP_OF_STACK_POINTS: break global TheAddressTable if TheAddressTable != None and frame_dict[SRC_LINE] == "": # Try using gdb TheAddressTable.Add(frame_dict[OBJECT_FILE], frame_dict[INSTRUCTION_POINTER]) return frames
| 475,325
|
def find_and_truncate(f): f.seek(0) while True: line = f.readline() if line == "": return False if '</valgrindoutput>' in line: # valgrind often has garbage after </valgrindoutput> upon crash f.truncate() return True
|
def find_and_truncate(f): f.seek(0) while True: line = f.readline() if line == "": return False if '</valgrindoutput>' in line: # valgrind often has garbage after </valgrindoutput> upon crash f.truncate() return True
| 475,326
|
def __init__(self, source_dir, files, show_all_leaks=False, use_gdb=False): '''Reads in a set of files.
|
def __init__(self, source_dir, files, show_all_leaks=False, use_gdb=False): '''Reads in a set of files.
| 475,327
|
def Report(self, check_sanity=False): if self._parse_failed: logging.error("FAIL! Couldn't parse Valgrind output file") return -2
|
def Report(self, check_sanity=False): if self._parse_failed: logging.error("FAIL! Couldn't parse Valgrind output file") return -2
| 475,328
|
def Report(self, check_sanity=False): if self._parse_failed: logging.error("FAIL! Couldn't parse Valgrind output file") return -2
|
def Report(self, check_sanity=False): if self._parse_failed: logging.error("FAIL! Couldn't parse Valgrind output file") return -2
| 475,329
|
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 be correct. However, when run from buildbot, the current # directory is .../build. Accommodate. # On Mac source files are compiled with abs paths so this isn't # a problem. # This is a bit of a hack. The best answer is to require this # script be run in a specific directory for all cases (from # Makefile or from buildbot). if start_dir.endswith('chrome'): print 'coverage_posix.py: doing a "cd .." to accomodate Linux/make PWD' os.chdir('..') elif self.IsMac(): pass else: # windows 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 be correct. However, when run from buildbot, the current # directory is .../build. Accommodate. # On Mac source files are compiled with abs paths so this isn't # a problem. # This is a bit of a hack. The best answer is to require this # script be run in a specific directory for all cases (from # Makefile or from buildbot). if start_dir.endswith('chrome'): print 'coverage_posix.py: doing a "cd .." to accomodate Linux/make PWD' os.chdir('..') elif self.IsMac(): pass else: # windows if start_dir.endswith('build'): print 'coverage_posix.py: doing a "cd src" to accomodate buildbot PWD' os.chdir('src')
| 475,330
|
def CheckChange(input_api, output_api): """Checks that the user didn't paste 'Suppression:' into the file""" keyword = 'Suppression:' for f, line_num, line in input_api.RightHandSideLines(lambda x: x.LocalPath().endswith('.txt')): if keyword in line: text = '"%s" must not be included; %s line %s' % ( keyword, f.LocalPath(), line_num) return [output_api.PresubmitError(text)] return []
|
def CheckChange(input_api, output_api): """Checks the memcheck suppressions files for bad data.""" errors = [] skip_next_line = False func_re = input_api.re.compile('[a-z_.]+\(.+\)$') for f, line_num, line in input_api.RightHandSideLines(lambda x: x.LocalPath().endswith('.txt')): if keyword in line: text = '"%s" must not be included; %s line %s' % ( keyword, f.LocalPath(), line_num) return [output_api.PresubmitError(text)] return []
| 475,331
|
def CheckChange(input_api, output_api): """Checks that the user didn't paste 'Suppression:' into the file""" keyword = 'Suppression:' for f, line_num, line in input_api.RightHandSideLines(lambda x: x.LocalPath().endswith('.txt')): if keyword in line: text = '"%s" must not be included; %s line %s' % ( keyword, f.LocalPath(), line_num) return [output_api.PresubmitError(text)] return []
|
def CheckChange(input_api, output_api): """Checks that the user didn't paste 'Suppression:' into the file""" keyword = 'Suppression:' for f, line_num, line in input_api.RightHandSideLines(lambda x: x.LocalPath().endswith('.txt')): line = line.lstrip() if line.startswith(' continue if skip_next_line: skip_next_line = False continue if (line.startswith('fun:') or line.startswith('obj:') or line.startswith('Memcheck:') or line == '}' or line == '...'): continue if func_re.match(line): continue if line == '{': skip_next_line = True continue errors.append('"%s" is probably wrong: %s line %s' % (line, f.LocalPath(), line_num)) if errors: return [output_api.PresubmitError('\n'.join(errors))] return []
| 475,332
|
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
| 475,333
|
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
| 475,334
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,335
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,336
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,337
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,338
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,339
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,340
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,341
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,342
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,343
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,344
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,345
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,346
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,347
|
code = """ typedef %(func_name)s::Result Result;
|
code = """ typedef %(func_name)s::Result Result;
| 475,348
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,349
|
typedef %(name)s::Result Result;
|
typedef %(name)s::Result Result;
| 475,350
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
| 475,351
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
| 475,352
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
| 475,353
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
|
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
| 475,354
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,355
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,356
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,357
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,358
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,359
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,360
|
def _ParseArgs(self): parser = optparse.OptionParser() parser.add_option( '-d', '--outdir', type='string', default=None, help='Directory in which to setup. This is typically the directory ' 'where the binaries would go when compiled from source.') parser.add_option( '-p', '--platform', type='string', default=pyauto_utils.GetCurrentPlatform(), help='Platform. Valid options: win, mac, linux32, linux64. ' 'Default: current platform (%s)' % pyauto_utils.GetCurrentPlatform()) self._options, self._args = parser.parse_args() if not self._options.outdir: print >>sys.stderr, 'Need output directory: -d/--outdir' sys.exit(1) if not self._args: print >>sys.stderr, 'Need download url' sys.exit(2) self._outdir = self._options.outdir self._url = self._args[0]
|
def _ParseArgs(self): parser = optparse.OptionParser() parser.add_option( '-d', '--outdir', type='string', default=None, help='Directory in which to setup. This is typically the directory ' 'where the binaries would go when compiled from source.') parser.add_option( '-p', '--platform', type='string', default=pyauto_utils.GetCurrentPlatform(), help='Platform. Valid options: win, mac, linux32, linux64. ' 'Default: current platform (%s)' % pyauto_utils.GetCurrentPlatform()) self._options, self._args = parser.parse_args() if not self._options.outdir: print >>sys.stderr, 'Need output directory: -d/--outdir' sys.exit(1) if not self._args: print >>sys.stderr, 'Need download url' sys.exit(2) self._outdir = self._options.outdir self._url = self._args[0]
| 475,361
|
def Run(self): self._ParseArgs() if not os.path.isdir(self._outdir): os.makedirs(self._outdir)
|
def Run(self): self._ParseArgs() if not os.path.isdir(self._outdir): os.makedirs(self._outdir)
| 475,362
|
def main(): if sys.platform == 'cygwin': return( 'ERROR: you are running from cygwin python, which is not\n' ' supported by "run_webkit_test.py". You should use python\n' ' for Windows (2.5+) to launch this script. A python for\n' ' Windows can be found at your depot_tools folder:\n' ' [DEPOT_TOOLS_PATH]/python ' + '"' + sys.argv[0] + '" ' + ' '.join(sys.argv[1:])) cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[0])))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
|
def main(): cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[0])))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
| 475,363
|
def main(): if sys.platform == 'cygwin': return( 'ERROR: you are running from cygwin python, which is not\n' ' supported by "run_webkit_test.py". You should use python\n' ' for Windows (2.5+) to launch this script. A python for\n' ' Windows can be found at your depot_tools folder:\n' ' [DEPOT_TOOLS_PATH]/python ' + '"' + sys.argv[0] + '" ' + ' '.join(sys.argv[1:])) cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[0])))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
|
def main(): if sys.platform == 'cygwin': return( 'ERROR: you are running from cygwin python, which is not\n' ' supported by "run_webkit_test.py". You should use python\n' ' for Windows (2.5+) to launch this script. A python for\n' ' Windows can be found at your depot_tools folder:\n' ' [DEPOT_TOOLS_PATH]/python ' + '"' + sys.argv[0] + '" ' + ' '.join(sys.argv[1:])) cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(src_dir))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
| 475,364
|
def WritePepperGLES2Implementation(self, filename): """Writes the Pepper OpenGLES interface implementation."""
|
def WritePepperGLES2Implementation(self, filename): """Writes the Pepper OpenGLES interface implementation."""
| 475,365
|
def testDownloadDangerousFiles(self): """Verify that we can download and save dangerous files.""" test_dir = os.path.abspath('.') # This file is a .py file which is "dangerous" file_path = os.path.join(test_dir, 'downloads.py') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'downloads.py') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
|
def testDownloadDangerousFiles(self): """Verify that we can download and save dangerous files.""" test_dir = os.path.abspath('.') # This file is a .py file which is "dangerous" file_path = os.path.join(test_dir, 'downloads.py') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'downloads.py') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
| 475,366
|
def testDownloadDangerousFiles(self): """Verify that we can download and save dangerous files.""" test_dir = os.path.abspath('.') # This file is a .py file which is "dangerous" file_path = os.path.join(test_dir, 'downloads.py') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'downloads.py') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
|
def testDownloadDangerousFiles(self): """Verify that we can download and save dangerous files.""" test_dir = os.path.abspath('.') # This file is a .py file which is "dangerous" file_path = os.path.join(test_dir, os.path.basename(file_path)) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
| 475,367
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output 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?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
| 475,368
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
| 475,369
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
| 475,370
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
| 475,371
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
|
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not names: raise Exception("RenderPage called with empty names param") generator_url = "file:" + urllib.pathname2url(_generator_html) generator_url += "?" + ",".join(names) # Start with a fresh copy of page shell for each file. # Save the current contents so that we can look for changes later. originals = {} for name in names: input_file = _base_dir + "/" + name + ".html" if (os.path.isfile(input_file)): originals[name] = open(input_file, 'rb').read() os.remove(input_file) else: originals[name] = "" shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen( [test_shell, "--layout-tests", "--time-out-ms=30000", generator_url], stdout=PIPE) # The remaining output will be the content of the generated pages. output = p.stdout.read() # Parse out just the JSON part. begin = output.find(_expected_output_preamble) end = output.rfind(_expected_output_postamble) if (begin < 0 or end < 0): raise Exception ("test_shell returned invalid output:\n\n" + output) begin += len(_expected_output_preamble) try: output_parsed = json.loads(output[begin:end]) except ValueError, msg: raise Exception("Could not parse test_shell output as JSON. Error: " + msg + "\n\nOutput was:\n" + output) changed_files = [] for name in names: result = output_parsed[name].encode("utf8") + '\n' # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Remove page_shell input_file = _base_dir + "/" + name + ".html" os.remove(input_file) # Write output open(input_file, 'wb').write(result) if (originals[name] and result != originals[name]): changed_files.append(input_file) return changed_files
| 475,372
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
| 475,373
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
| 475,374
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
| 475,375
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
|
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.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
| 475,376
|
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 (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = RenderPages(page_names, test_shell) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log") if (os.path.isfile(debug_log)): os.remove(debug_log) return os.EX_OK
|
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 (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log") if (os.path.isfile(debug_log)): os.remove(debug_log) return os.EX_OK
| 475,377
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
| 475,378
|
def ReadReportsFromFile(filename): """ Returns a list of (report_hash, report) and the URL of the report on the waterfall. """ input_file = file(filename, 'r') # reports is a list of (error hash, report) pairs. reports = [] in_suppression = False cur_supp = [] # This stores the last error hash found while reading the file. last_hash = "" for line in input_file: line = line.strip() line = line.replace("</span><span class=\"stdout\">", "") line = line.replace("</span><span class=\"stderr\">", "") line = line.replace("<", "<") line = line.replace(">", ">") if in_suppression: if line == "}": cur_supp += ["}"] reports += [[last_hash, "\n".join(cur_supp)]] in_suppression = False cur_supp = [] last_hash = "" else: cur_supp += [" "*3 + line] elif line == "{": in_suppression = True cur_supp = ["{"] elif line.find("Suppression (error hash=#") == 0: last_hash = line[25:33] # Work around an (fixed) bug in memcheck_analyze.py. # TODO(jochen): delete this after a couple of days. if last_hash[0] == '-': last_hash = line[26:34] # The line at the end of the file is assumed to store the URL of the report. return reports,line
|
def ReadReportsFromFile(filename): """ Returns a list of (report_hash, report) and the URL of the report on the waterfall. """ input_file = file(filename, 'r') # reports is a list of (error hash, report) pairs. reports = [] in_suppression = False cur_supp = [] # This stores the last error hash found while reading the file. last_hash = "" for line in input_file: line = line.strip() line = line.replace("</span><span class=\"stdout\">", "") line = line.replace("</span><span class=\"stderr\">", "") line = line.replace("<", "<") line = line.replace(">", ">") if in_suppression: if line == "}": cur_supp += ["}"] reports += [[last_hash, "\n".join(cur_supp)]] in_suppression = False cur_supp = [] last_hash = "" else: cur_supp += [" "*3 + line] elif line == "{": in_suppression = True cur_supp = ["{"] elif line.find("Suppression (error hash=#") == 0: last_hash = line[25:33] # Work around an (fixed) bug in memcheck_analyze.py. # TODO(jochen): delete this after a couple of days. if last_hash[0] == '-': last_hash = line[26:34] # The line at the end of the file is assumed to store the URL of the report. return reports,line
| 475,379
|
def __init__(self, methodName='runTest'): super(NotificationsTest, self).__init__(methodName) self.NO_SUCH_URL = 'http://no_such_url_exists/' self.NO_SUCH_URL2 = 'http://no_such_url_exists2/' self.NO_SUCH_URL3 = 'http://no_such_url_exists3/' # Content settings for default notification permission. self.ALLOW_ALL_SETTING = 1 self.DENY_ALL_SETTING = 2 self.ASK_SETTING = 3
|
def __init__(self, methodName='runTest'): super(NotificationsTest, self).__init__(methodName) self.NO_SUCH_URL = 'http://no_such_url_exists/' # Content settings for default notification permission. self.ALLOW_ALL_SETTING = 1 self.DENY_ALL_SETTING = 2 self.ASK_SETTING = 3
| 475,380
|
def testNotificationOrderAfterClosingOne(self): """Tests that closing a notification leaves the rest of the notifications in the correct order. """ self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self._CreateHTMLNotification(self.NO_SUCH_URL2) self._CreateHTMLNotification(self.NO_SUCH_URL3) self.assertEquals(3, len(self.GetActiveNotifications())) self.CloseNotification(1) self.assertEquals(2, len(self.GetActiveNotifications())) notifications = self.GetActiveNotifications() self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url']) self.assertEquals(self.NO_SUCH_URL3, notifications[1]['content_url'])
|
def testNotificationOrderAfterClosingOne(self): """Tests that closing a notification leaves the rest of the notifications in the correct order. """ self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateSimpleNotification('', 'Title1', '') self._CreateSimpleNotification('', 'Title2', '') self._CreateSimpleNotification('', 'Title3', '') self.assertEquals(3, len(self.GetActiveNotifications())) self.CloseNotification(1) self.assertEquals(2, len(self.GetActiveNotifications())) notifications = self.GetActiveNotifications() self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url']) self.assertEquals(self.NO_SUCH_URL3, notifications[1]['content_url'])
| 475,381
|
def testNotificationOrderAfterClosingOne(self): """Tests that closing a notification leaves the rest of the notifications in the correct order. """ self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self._CreateHTMLNotification(self.NO_SUCH_URL2) self._CreateHTMLNotification(self.NO_SUCH_URL3) self.assertEquals(3, len(self.GetActiveNotifications())) self.CloseNotification(1) self.assertEquals(2, len(self.GetActiveNotifications())) notifications = self.GetActiveNotifications() self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url']) self.assertEquals(self.NO_SUCH_URL3, notifications[1]['content_url'])
|
def testNotificationOrderAfterClosingOne(self): """Tests that closing a notification leaves the rest of the notifications in the correct order. """ self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self._CreateHTMLNotification(self.NO_SUCH_URL2) self._CreateHTMLNotification(self.NO_SUCH_URL3) self.assertEquals(3, len(self.GetActiveNotifications())) self.CloseNotification(1) self.assertEquals(2, len(self.GetActiveNotifications())) notifications = self.GetActiveNotifications() self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url']) self.assertEquals(self.NO_SUCH_URL3, notifications[1]['content_url'])
| 475,382
|
def _ExtractAndAddNewBaselines(self, archive_file): """Extract new baselines from archive and add them to SVN repository.
|
def _ExtractAndAddNewBaselines(self, archive_file): """Extract new baselines from archive and add them to SVN repository.
| 475,383
|
def _ParseArgs(self): """Parse command line args.""" parser = optparse.OptionParser() parser.add_option( '-v', '--verbose', action='store_true', default=False, help='Make PyAuto verbose.') parser.add_option( '-D', '--wait-for-debugger', action='store_true', default=False, help='Block PyAuto on startup for attaching debugger.') parser.add_option( '', '--ui-test-flags', type='string', default='', help='Flags passed to the UI test suite. Refer ui_test.h for options') parser.add_option( '', '--list-missing-tests', action='store_true', default=False, help='Print a list of tests not included in PYAUTO_TESTS, and exit') parser.add_option( '', '--repeat', type='int', default=1, help='Number of times to repeat the tests. Useful to determine ' 'flakiness. Defaults to 1.')
|
def _ParseArgs(self): """Parse command line args.""" parser = optparse.OptionParser() parser.add_option( '-v', '--verbose', action='store_true', default=False, help='Make PyAuto verbose.') parser.add_option( '-D', '--wait-for-debugger', action='store_true', default=False, help='Block PyAuto on startup for attaching debugger.') parser.add_option( '', '--chrome-flags', type='string', default='', help='Flags passed to Chrome. This is in addition to the usual flags ' 'like suppressing first-run dialogs, enabling automation. ' 'See chrome/common/chrome_switches.cc for the list of flags ' 'chrome understands.') parser.add_option( '', '--list-missing-tests', action='store_true', default=False, help='Print a list of tests not included in PYAUTO_TESTS, and exit') parser.add_option( '', '--repeat', type='int', default=1, help='Number of times to repeat the tests. Useful to determine ' 'flakiness. Defaults to 1.')
| 475,384
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
| 475,385
|
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, error in sorted(errors): print path + ": " + error
|
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 for path, error in sorted(errors): print path + ": " + error
| 475,386
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
| 475,387
|
def InitFunction(self, func): """Add or adjust anything type specific for this function.""" if func.GetInfo('needs_size'): func.AddCmdArg(DataSizeArgument('data_size'))
|
def InitFunction(self, func): """Add or adjust anything type specific for this function.""" if func.GetInfo('needs_size') and not func.name.endswith('Bucket'): func.AddCmdArg(DataSizeArgument('data_size'))
| 475,388
|
def GetBucketVersion(self): """Overridden from Argument.""" if self.type == "const char*": return InputStringBucketArgument(self.name, self.type) return self
|
def GetBucketVersion(self): """Overridden from Argument.""" if self.type == "const char*": return InputStringBucketArgument(self.name, self.type) return self
| 475,389
|
def InitFunction(self): """Overridden from Function""" pass
|
def InitFunction(self): """Overridden from Function""" pass
| 475,390
|
def WriteServiceImplementation(self, file): """Overridden from Function""" pass
|
def WriteServiceImplementation(self, file): """Overridden from Function""" pass
| 475,391
|
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.path.realpath( os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src'))
| 475,392
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) target_dir = tempfile.mkdtemp() try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 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', 'src/webkit/tools/test/reference_build', ) for dir in nonessential_dirs: path = os.path.join(target_dir, dir) try: print 'removing %s...' % dir shutil.rmtree(path) except OSError, e: print 'error while trying to remove %s, skipping' % dir 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 0
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 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', 'src/webkit/tools/test/reference_build', ) for dir in nonessential_dirs: path = os.path.join(target_dir, dir) try: print 'removing %s...' % dir shutil.rmtree(path) except OSError, e: print 'error while trying to remove %s, skipping' % dir 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 0
| 475,393
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) target_dir = tempfile.mkdtemp() try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 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', 'src/webkit/tools/test/reference_build', ) for dir in nonessential_dirs: path = os.path.join(target_dir, dir) try: print 'removing %s...' % dir shutil.rmtree(path) except OSError, e: print 'error while trying to remove %s, skipping' % dir 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 0
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) target_dir = tempfile.mkdtemp() def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True 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', 'src/webkit/tools/test/reference_build', ) for dir in nonessential_dirs: path = os.path.join(target_dir, dir) try: print 'removing %s...' % dir shutil.rmtree(path) except OSError, e: print 'error while trying to remove %s, skipping' % dir 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 0
| 475,394
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) target_dir = tempfile.mkdtemp() try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 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', 'src/webkit/tools/test/reference_build', ) for dir in nonessential_dirs: path = os.path.join(target_dir, dir) try: print 'removing %s...' % dir shutil.rmtree(path) except OSError, e: print 'error while trying to remove %s, skipping' % dir 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 0
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) target_dir = tempfile.mkdtemp() try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 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 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 0
| 475,395
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) target_dir = tempfile.mkdtemp() try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 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', 'src/webkit/tools/test/reference_build', ) for dir in nonessential_dirs: path = os.path.join(target_dir, dir) try: print 'removing %s...' % dir shutil.rmtree(path) except OSError, e: print 'error while trying to remove %s, skipping' % dir 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 0
|
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 extension).' return 1 output_fullname = args[0] + '.tar.bz2' output_basename = os.path.basename(args[0]) target_dir = tempfile.mkdtemp() try: if RunCommand(['gclient', 'export', target_dir]) != 0: print 'gclient failed' return 1 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', 'src/webkit/tools/test/reference_build', ) for dir in nonessential_dirs: path = os.path.join(target_dir, dir) try: print 'removing %s...' % dir shutil.rmtree(path) except OSError, e: print 'error while trying to remove %s, skipping' % dir return False with contextlib.closing(tarfile.open(output_fullname, 'w:bz2')) as archive: archive.add(GetSourceDirectory(), arcname=output_basename, exclude=ShouldExcludePath) return 0
| 475,396
|
def ustring_to_string(ptr, length=None): """Convert a pointer to UTF-16 data into a Python Unicode string. ptr and length are both gdb.Value objects. If length is unspecified, will guess at the length.""" extra = '' if length is None: # Try to guess at the length. for i in xrange(0, 2048): if int((ptr + i).dereference()) == 0: length = i break if length is None: length = 256 extra = u' (no trailing NUL found)' else: length = int(length) char_vals = [int((ptr + i).dereference()) for i in xrange(length)] string = struct.pack('H' * length, *char_vals).decode('utf-16', 'replace') return string + extra
|
def ustring_to_string(ptr, length=None): """Convert a pointer to UTF-16 data into a Python Unicode string. ptr and length are both gdb.Value objects. If length is unspecified, will guess at the length.""" extra = '' if length is None: # Try to guess at the length. for i in xrange(0, 2048): if int((ptr + i).dereference()) == 0: length = i break if length is None: length = 256 extra = u' (no trailing NUL found)' else: length = int(length) char_vals = [int((ptr + i).dereference()) for i in xrange(length)] string = struct.pack('H' * length, *char_vals).decode('utf-16', 'replace') return string + extra
| 475,397
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
| 475,398
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
| 475,399
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.