bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def ReadFile(filename): try: file = open(filename, 'r') except IOError, e: print >> sys.stderr, ('I/O Error reading file %s(%s): %s' % (filename, e.errno, e.strerror)) raise e if not file: return None contents = file.read() file.close() return contents
def ReadFile(filename): try: file = open(filename, 'r') except IOError, e: print >> sys.stderr, ('I/O Error reading file %s(%s): %s' % (filename, e.errno, e.strerror)) raise e if not file: return None contents = file.read() file.close() return contents
476,200
def ReadFile(filename): try: file = open(filename, 'r') except IOError, e: print >> sys.stderr, ('I/O Error reading file %s(%s): %s' % (filename, e.errno, e.strerror)) raise e if not file: return None contents = file.read() file.close() return contents
def ReadFile(filename): try: file = open(filename, 'r') except IOError, e: print >> sys.stderr, ('I/O Error reading file %s(%s): %s' % (filename, e.errno, e.strerror)) raise e contents = file.read() file.close() return contents
476,201
def testPDFRunner(self): """Navigate to pdf files and verify that browser doesn't crash""" # bail out if not a branded build properties = self.GetBrowserInfo()['properties'] if properties['branding'] != 'Google Chrome': return pdf_files_path = os.path.join(self.DataDir(), 'pyauto_private', 'pdf') pdf_files = glob.glob(os.path.join(pdf_files_path, '*.pdf')) for pdf_file in pdf_files: url = self.GetFileURLForPath(os.path.join(pdf_files_path, pdf_file)) self.AppendTab(pyauto.GURL(url)) for tab_index in range(1, len(pdf_files) + 1): self.ActivateTab(tab_index) self._PerformPDFAction('fitToHeight', tab_index=tab_index) self._PerformPDFAction('fitToWidth', tab_index=tab_index) # Assert that there is at least 1 browser window. self.assertTrue(self.GetBrowserWindowCount(), 'Browser crashed, no window is open')
def testPDFRunner(self): """Navigate to pdf files and verify that browser doesn't crash""" # bail out if not a branded build properties = self.GetBrowserInfo()['properties'] if properties['branding'] != 'Google Chrome': return pdf_files_path = os.path.join(self.DataDir(), 'plugin', 'pdf') pdf_files = glob.glob(os.path.join(pdf_files_path, '*.pdf')) for pdf_file in pdf_files: url = self.GetFileURLForPath(os.path.join(pdf_files_path, pdf_file)) self.AppendTab(pyauto.GURL(url)) for tab_index in range(1, len(pdf_files) + 1): self.ActivateTab(tab_index) self._PerformPDFAction('fitToHeight', tab_index=tab_index) self._PerformPDFAction('fitToWidth', tab_index=tab_index) # Assert that there is at least 1 browser window. self.assertTrue(self.GetBrowserWindowCount(), 'Browser crashed, no window is open')
476,202
def _parseManifestData(self, manifest_paths, api_manifest): """ Returns metadata about the sample extensions given their manifest paths.
def _parseManifestData(self, manifest_paths, api_manifest): """ Returns metadata about the sample extensions given their manifest paths.
476,203
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)
def __init__(self, server_address, request_hander_class, cert_path, ssl_client_auth): 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)
476,204
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) return False
def handshake(self, tlsConnection): """Creates the SSL connection.""" try: tlsConnection.handshakeServer(certChain=self.cert_chain, privateKey=self.private_key, sessionCache=self.session_cache, reqCert=self.ssl_client_auth) tlsConnection.ignoreAbruptClose = True return True except tlslite.api.TLSError, error: print "Handshake failure:", str(error) return False
476,205
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: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified cert file not found: ' + options.cert + ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None MakeDumpDir(server.data_dir) # means FTP Server else: my_data_dir = MakeDataDir() def line_logger(msg): if (msg.find("kill") >= 0): server.stop = True print 'shutting down server' sys.exit(0) # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer pyftpdlib.ftpserver.logline = line_logger # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
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: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified cert file not found: ' + options.cert + ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None MakeDumpDir(server.data_dir) # means FTP Server else: my_data_dir = MakeDataDir() def line_logger(msg): if (msg.find("kill") >= 0): server.stop = True print 'shutting down server' sys.exit(0) # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer pyftpdlib.ftpserver.logline = line_logger # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
476,206
def EvaluateTemplate(template, env, escape=True): """Expand a template with variables like {{foo}} using a dictionary of expansions.""" for key, val in env.items(): if escape: val = cgi.escape(val) template = template.replace('{{%s}}' % key, val) return template
def EvaluateTemplate(template, env, escape=True): """Expand a template with variables like {{foo}} using a dictionary of expansions.""" for key, val in env.items(): if escape: val = cgi.escape(val) template = template.replace('{{%s}}' % key, val) return template
476,207
def tearDown(self): # Cleanup all files we created in the download dir download_dir = self.GetDownloadDirectory().value() if os.path.isdir(download_dir): for name in os.listdir(download_dir): if name not in self._existing_downloads: pyauto_utils.RemovePath(os.path.join(download_dir, name)) pyauto.PyUITest.tearDown(self)
def tearDown(self): # Cleanup all files we created in the download dir download_dir = self.GetDownloadDirectory().value() if os.path.isdir(download_dir): for name in os.listdir(download_dir): if name not in self._existing_downloads: self.files_to_remove.append(os.path.join(download_dir, name)) pyauto.PyUITest.tearDown(self)
476,208
def testCancelDownload(self): """Verify that we can cancel a download.""" # Create a big file (250 MB) on the fly, so that the download won't finish # before being cancelled. file_path = self._MakeFile(2**28) 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) self.DownloadAndWaitForStart(file_url) self.PerformActionOnDownload(self._GetDownloadId(), 'cancel') os.path.exists(file_path) and os.remove(file_path)
def testCancelDownload(self): """Verify that we can cancel a download.""" # Create a big file (250 MB) on the fly, so that the download won't finish # before being cancelled. file_path = self._MakeFile(2**28) 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) self.DownloadAndWaitForStart(file_url) self.PerformActionOnDownload(self._GetDownloadId(), 'cancel') os.path.exists(file_path) and os.remove(file_path)
476,209
def TryRevision(rev, profile, args): """Downloads revision |rev|, unzips it, and opens it for the user to test. |profile| is the profile to use.""" # Do this in a temp dir so we don't collide with user files. cwd = os.getcwd() tempdir = tempfile.mkdtemp(prefix='bisect_tmp') os.chdir(tempdir) # Download the file. download_url = BUILD_BASE_URL + (BUILD_ARCHIVE_URL % rev) + BUILD_ZIP_NAME try: print 'Fetching ' + download_url urllib.urlretrieve(download_url, BUILD_ZIP_NAME) except Exception, e: print('Could not retrieve the download. Sorry.') sys.exit(-1) # Unzip the file. print 'Unziping ...' UnzipFilenameToDir(BUILD_ZIP_NAME, os.curdir) # Tell the system to open the app. args = ['--user-data-dir=%s' % profile] + args flags = ' '.join(map(pipes.quote, args)) exe = os.path.join(os.getcwd(), BUILD_DIR_NAME, BUILD_EXE_NAME) cmd = '%s %s' % (exe, flags) print 'Running %s' % cmd os.system(cmd) os.chdir(cwd) print 'Cleaning temp dir ...' try: shutil.rmtree(tempdir, True) except Exception, e: pass
def TryRevision(rev, profile, args): """Downloads revision |rev|, unzips it, and opens it for the user to test. |profile| is the profile to use.""" # Do this in a temp dir so we don't collide with user files. cwd = os.getcwd() tempdir = tempfile.mkdtemp(prefix='bisect_tmp') os.chdir(tempdir) # Download the file. download_url = BUILD_BASE_URL + (BUILD_ARCHIVE_URL % rev) + BUILD_ZIP_NAME try: print 'Fetching ' + download_url urllib.urlretrieve(download_url, BUILD_ZIP_NAME, _Reporthook) print except Exception, e: print('Could not retrieve the download. Sorry.') sys.exit(-1) # Unzip the file. print 'Unziping ...' UnzipFilenameToDir(BUILD_ZIP_NAME, os.curdir) # Tell the system to open the app. args = ['--user-data-dir=%s' % profile] + args flags = ' '.join(map(pipes.quote, args)) exe = os.path.join(os.getcwd(), BUILD_DIR_NAME, BUILD_EXE_NAME) cmd = '%s %s' % (exe, flags) print 'Running %s' % cmd os.system(cmd) os.chdir(cwd) print 'Cleaning temp dir ...' try: shutil.rmtree(tempdir, True) except Exception, e: pass
476,210
def CommitEntry(self, entry, cache_guid, commit_session): """Attempt to commit one entry to the user's account.
def CommitEntry(self, entry, cache_guid, commit_session): """Attempt to commit one entry to the user's account.
476,211
def CommitEntry(self, entry, cache_guid, commit_session): """Attempt to commit one entry to the user's account.
defCommitEntry(self,entry,cache_guid,commit_session):"""Attempttocommitoneentrytotheuser'saccount.
476,212
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: data = eval(raw_data.replace('null', 'None')) out = [] for (builder_name, builder) in data.iteritems(): if builder_name in ignored: continue pending_builds_len = len(builder.get('pending_builds', [])) if pending_builds_len > max_pendings: out.append('%s has %d build(s) pending' % (builder_name, pending_builds_len)) if out: return [output_api.PresubmitPromptWarning( 'Build(s) pending. It is suggested to wait that no more than %d ' 'builds are pending.' % max_pendings, long_text='\n'.join(out))] except IOError: # Silently pass. pass return []
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: 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) out = [] for (builder_name, builder) in data.iteritems(): if builder_name in ignored: continue pending_builds_len = len(builder.get('pending_builds', [])) if pending_builds_len > max_pendings: out.append('%s has %d build(s) pending' % (builder_name, pending_builds_len)) if out: return [output_api.PresubmitPromptWarning( 'Build(s) pending. It is suggested to wait that no more than %d ' 'builds are pending.' % max_pendings, long_text='\n'.join(out))] except IOError: # Silently pass. pass return []
476,213
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = json.dumps(server_data) debug('sending server_data: %s' % server_data_json) server_data_len = len(server_data_json) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
476,214
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = json.dumps(server_data) debug('sending server_data: %s' % server_data_json) server_data_len = len(server_data_json) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = json.dumps(server_data) debug('sending server_data: %s' % server_data_json) server_data_len = len(server_data_json) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # First write the data length as an unsigned 4-byte value. This # is _not_ using network byte ordering since the other end of the # pipe is on the same machine. startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
476,215
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
476,216
def CheckChangeOnUpload(input_api, output_api): results = [] # What does this code do? # It loads the default black list (e.g. third_party, experimental, etc) and # add our black list (breakpad, skia and v8 are still not following # google style and are not really living this repository). # See presubmit_support.py InputApi.FilterSourceFile for the (simple) usage. black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDED_PATHS sources = lambda x: input_api.FilterSourceFile(x, black_list=black_list) results.extend(input_api.canned_checks.CheckLongLines( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasNoTabs( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasBugField( input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeHasTestField( input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeSvnEolStyle( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( input_api, output_api)) return results
_LICENSE_HEADER = ( r".*? Copyright \(c\) 20\d\d The Chromium Authors\. All rights reserved\." "\n" r".*? Use of this source code is governed by a BSD-style license that can " "be\n" r".*? found in the LICENSE file\." "\n" ) def _CommonChecks(input_api, output_api): results = [] # What does this code do? # It loads the default black list (e.g. third_party, experimental, etc) and # add our black list (breakpad, skia and v8 are still not following # google style and are not really living this repository). # See presubmit_support.py InputApi.FilterSourceFile for the (simple) usage. black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDED_PATHS sources = lambda x: input_api.FilterSourceFile(x, black_list=black_list) results.extend(input_api.canned_checks.CheckLongLines( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasNoTabs( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasBugField( input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeHasTestField( input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeSvnEolStyle( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( input_api, output_api)) return results
476,217
def CheckChangeOnCommit(input_api, output_api): results = [] black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDED_PATHS sources = lambda x: input_api.FilterSourceFile(x, black_list=black_list) results.extend(input_api.canned_checks.CheckLongLines( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasNoTabs( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasNoStrayWhitespace( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckChangeHasBugField( input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeHasTestField( input_api, output_api)) results.extend(input_api.canned_checks.CheckChangeSvnEolStyle( input_api, output_api, sources)) results.extend(input_api.canned_checks.CheckSvnForCommonMimeTypes( 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'. # TODO(maruel): Run it in a separate thread to parallelize checks? results.extend(CheckTreeIsOpen( input_api, output_api, 'http://chromium-status.appspot.com/status', '0', 'http://chromium-status.appspot.com/current?format=raw')) results.extend(CheckTryJobExecution(input_api, output_api)) # These builders are just too slow. IGNORED_BUILDERS = [ 'Chromium XP', 'Chromium Mac', 'Chromium Mac (valgrind)', 'Chromium Mac UI (valgrind)(1)', 'Chromium Mac UI (valgrind)(2)', 'Chromium Mac UI (valgrind)(3)', 'Chromium Mac (tsan)', 'Webkit Mac (valgrind)', 'Chromium Linux', 'Chromium Linux x64', 'Linux Tests (valgrind)(1)', 'Linux Tests (valgrind)(2)', 'Linux Tests (valgrind)(3)', 'Linux Tests (valgrind)(4)', 'Webkit Linux (valgrind layout)', ] results.extend(CheckPendingBuilds( input_api, output_api, 'http://build.chromium.org/buildbot/waterfall/json/builders', 6, IGNORED_BUILDERS)) return results
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'. # TODO(maruel): Run it in a separate thread to parallelize checks? results.extend(CheckTreeIsOpen( input_api, output_api, 'http://chromium-status.appspot.com/status', '0', 'http://chromium-status.appspot.com/current?format=raw')) results.extend(CheckTryJobExecution(input_api, output_api)) # These builders are just too slow. IGNORED_BUILDERS = [ 'Chromium XP', 'Chromium Mac', 'Chromium Mac (valgrind)', 'Chromium Mac UI (valgrind)(1)', 'Chromium Mac UI (valgrind)(2)', 'Chromium Mac UI (valgrind)(3)', 'Chromium Mac (tsan)', 'Webkit Mac (valgrind)', 'Chromium Linux', 'Chromium Linux x64', 'Linux Tests (valgrind)(1)', 'Linux Tests (valgrind)(2)', 'Linux Tests (valgrind)(3)', 'Linux Tests (valgrind)(4)', 'Webkit Linux (valgrind layout)', ] results.extend(CheckPendingBuilds( input_api, output_api, 'http://build.chromium.org/buildbot/waterfall/json/builders', 6, IGNORED_BUILDERS)) return results
476,218
def __init__(self): BaseTool.__init__(self) self.RegisterOptionParserHook(ValgrindTool.ExtendOptionParser) self._indirect_analyze_results_file = ""
def __init__(self): BaseTool.__init__(self) self.RegisterOptionParserHook(ValgrindTool.ExtendOptionParser) self._indirect_analyze_results_file = ""
476,219
def GetAnalyzeResultsIndirect(self): assert self._indirect_analyze_results_file != "" f = open(self._indirect_analyze_results_file) if f: if len([True for l in f.readlines() if "FAIL" in l]) > 0: logging.error("There were some Valgrind reports in the tests!") print "-------------------------------------------------------------" print "The reports for the individual tests are placed in the output" print "of the tests. Please search for \"FAIL!\" lines in this log." print "-------------------------------------------------------------" return 1 return 0
def GetAnalyzeResultsIndirect(self): assert self._indirect_analyze_results_file != "" f = open(self._indirect_analyze_results_file) if f: if len([True for l in f.readlines() if "FAIL" in l]) > 0: logging.error("There were some Valgrind reports in the tests!") print "-------------------------------------------------------------" print "The reports for the individual tests are placed in the output" print "of the tests. Please search for \"FAIL!\" lines in this log." print "-------------------------------------------------------------" return 1 return 0
476,220
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ # We'll be storing the analyzed results of individual tests # in a temporary text file self._indirect_analyze_results_file = tempfile.mkstemp( dir=self.TMP_DIR, prefix="valgrind_analyze.", text=True)[1]
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ # We'll be storing the analyzed results of individual tests # in a temporary text file self._indirect_analyze_results_file = tempfile.mkstemp( dir=self.TMP_DIR, prefix="valgrind_analyze.", text=True)[1]
476,221
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ # We'll be storing the analyzed results of individual tests # in a temporary text file self._indirect_analyze_results_file = tempfile.mkstemp( dir=self.TMP_DIR, prefix="valgrind_analyze.", text=True)[1]
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser.f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n') Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper.f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n') Build the magic wrapper here. """ # We'll be storing the analyzed results of individual tests # in a temporary text file self._indirect_analyze_results_file = tempfile.mkstemp( dir=self.TMP_DIR, prefix="valgrind_analyze.", text=True)[1]
476,222
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ # We'll be storing the analyzed results of individual tests # in a temporary text file self._indirect_analyze_results_file = tempfile.mkstemp( dir=self.TMP_DIR, prefix="valgrind_analyze.", text=True)[1]
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ # We'll be storing the analyzed results of individual tests # in a temporary text file self._indirect_analyze_results_file = tempfile.mkstemp( dir=self.TMP_DIR, prefix="valgrind_analyze.", text=True)[1]
476,223
def Analyze(self, check_sanity=False): if self._options.indirect: return self.GetAnalyzeResultsIndirect() # Glob all the files in the "valgrind.tmp" directory filenames = glob.glob(self.TMP_DIR + "/memcheck.*")
def Analyze(self, check_sanity=False): if self._options.indirect: return self.GetAnalyzeResultsIndirect() # Glob all the files in the "valgrind.tmp" directory filenames = glob.glob(self.TMP_DIR + "/memcheck.*")
476,224
def Analyze(self, check_sanity=False): filenames = glob.glob(self.TMP_DIR + "/tsan.*") use_gdb = common.IsMac() analyzer = tsan_analyze.TsanAnalyze(self._source_dir, filenames, use_gdb=use_gdb) ret = analyzer.Report(check_sanity) if ret != 0: logging.info("Please see http://dev.chromium.org/developers/how-tos/" "using-valgrind/threadsanitizer for the info on " "ThreadSanitizer") return ret
def Analyze(self, check_sanity=False): filenames = glob.glob(self.TMP_DIR + "/tsan.*") use_gdb = common.IsMac() analyzer = tsan_analyze.TsanAnalyze(self._source_dir, filenames, use_gdb=use_gdb) ret = analyzer.Report(check_sanity) if ret != 0: logging.info("Please see http://dev.chromium.org/developers/how-tos/" "using-valgrind/threadsanitizer for the info on " "ThreadSanitizer") return ret
476,225
def __init__(self): ValgrindTool.__init__(self) ThreadSanitizerBase.__init__(self)
def __init__(self): ValgrindTool.__init__(self) ThreadSanitizerBase.__init__(self)
476,226
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"])
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=180000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"])
476,227
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"])
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=180000", "--ui-test-action-timeout=120000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"])
476,228
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"])
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"])
476,229
def testForge(self): """Brief test of forging history items.
def testForge(self): """Brief test of forging history items.
476,230
def testForge(self): """Brief test of forging history items.
def testForge(self): """Brief test of forging history items.
476,231
def testForge(self): """Brief test of forging history items.
def testForge(self): """Brief test of forging history items.
476,232
def _ClickTranslateUntilSuccess(self): """Since the translate can fail due to server error, continue trying until it is successful or until it has tried too many times.""" max_tries = 10 curr_try = 0 while curr_try < max_tries and not self.ClickTranslateBarTranslate(): curr_try = curr_try + 1 if curr_try == 10: self.fail('Translation failed more than %d times.' % max_tries)
def _ClickTranslateUntilSuccess(self, window_index=0, tab_index=0): """Since the translate can fail due to server error, continue trying until it is successful or until it has tried too many times.""" max_tries = 10 curr_try = 0 while curr_try < max_tries and not self.ClickTranslateBarTranslate(): curr_try = curr_try + 1 if curr_try == 10: self.fail('Translation failed more than %d times.' % max_tries)
476,233
def _ClickTranslateUntilSuccess(self): """Since the translate can fail due to server error, continue trying until it is successful or until it has tried too many times.""" max_tries = 10 curr_try = 0 while curr_try < max_tries and not self.ClickTranslateBarTranslate(): curr_try = curr_try + 1 if curr_try == 10: self.fail('Translation failed more than %d times.' % max_tries)
def _ClickTranslateUntilSuccess(self): """Since the translate can fail due to server error, continue trying until it is successful or until it has tried too many times.""" max_tries = 10 curr_try = 0 while (curr_try < max_tries and not self.ClickTranslateBarTranslate(window_index=window_index, tab_index=tab_index)): curr_try = curr_try + 1 if curr_try == 10: self.fail('Translation failed more than %d times.' % max_tries)
476,234
def _ClickTranslateUntilSuccess(self): """Since the translate can fail due to server error, continue trying until it is successful or until it has tried too many times.""" max_tries = 10 curr_try = 0 while curr_try < max_tries and not self.ClickTranslateBarTranslate(): curr_try = curr_try + 1 if curr_try == 10: self.fail('Translation failed more than %d times.' % max_tries)
def _ClickTranslateUntilSuccess(self): """Since the translate can fail due to server error, continue trying until it is successful or until it has tried too many times.""" max_tries = 10 curr_try = 0 while curr_try < max_tries and not self.ClickTranslateBarTranslate(): curr_try = curr_try + 1 if curr_try == max_tries: self.fail('Translation failed more than %d times.' % max_tries)
476,235
def testSessionRestore(self): """Test that session restore restores the translate infobar and other translate settings. """ self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) translate_info = self.GetTranslateInfo() self.assertTrue('translate_bar' in translate_info) self.SelectTranslateOption('toggle_always_translate') self._ClickTranslateUntilSuccess() self.SetPrefs(pyauto.kRestoreOnStartup, 1) self.RestartBrowser(clear_profile=False) self.WaitForInfobarCount(1) translate_info = self.GetTranslateInfo() self.assertTrue('translate_bar' in translate_info) # Sometimes translation fails. We don't really care whether it succeededs, # just that a translation was attempted. self.assertNotEqual(self.before_translate, translate_info['translate_bar']['bar_state'])
def testSessionRestore(self): """Test that session restore restores the translate infobar and other translate settings. """ self.NavigateToURL("http://www.news.google.com") self.AppendTab(pyauto.GURL("http://www.google.com/webhp?hl=es")) self.WaitForInfobarCount(1, tab_index=1) translate_info = self.GetTranslateInfo(tab_index=1) self.assertTrue('translate_bar' in translate_info) self.SelectTranslateOption('toggle_always_translate', tab_index=1) self._ClickTranslateUntilSuccess(tab_index=1) self.SetPrefs(pyauto.kRestoreOnStartup, 1) self.RestartBrowser(clear_profile=False) self.WaitForInfobarCount(1) translate_info = self.GetTranslateInfo() self.assertTrue('translate_bar' in translate_info) # Sometimes translation fails. We don't really care whether it succeededs, # just that a translation was attempted. self.assertNotEqual(self.before_translate, translate_info['translate_bar']['bar_state'])
476,236
def testSessionRestore(self): """Test that session restore restores the translate infobar and other translate settings. """ self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) translate_info = self.GetTranslateInfo() self.assertTrue('translate_bar' in translate_info) self.SelectTranslateOption('toggle_always_translate') self._ClickTranslateUntilSuccess() self.SetPrefs(pyauto.kRestoreOnStartup, 1) self.RestartBrowser(clear_profile=False) self.WaitForInfobarCount(1) translate_info = self.GetTranslateInfo() self.assertTrue('translate_bar' in translate_info) # Sometimes translation fails. We don't really care whether it succeededs, # just that a translation was attempted. self.assertNotEqual(self.before_translate, translate_info['translate_bar']['bar_state'])
def testSessionRestore(self): """Test that session restore restores the translate infobar and other translate settings. """ self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) translate_info = self.GetTranslateInfo() self.assertTrue('translate_bar' in translate_info) self.SelectTranslateOption('toggle_always_translate') self._ClickTranslateUntilSuccess() self.SetPrefs(pyauto.kRestoreOnStartup, 1) self.RestartBrowser(clear_profile=False) self.WaitForInfobarCount(1, tab_index=1) self.WaitUntilTranslateComplete() translate_info = self.GetTranslateInfo(tab_index=1) self.assertTrue('translate_bar' in translate_info) # Sometimes translation fails. We don't really care whether it succeededs, # just that a translation was attempted. self.assertNotEqual(self.before_translate, translate_info['translate_bar']['bar_state'])
476,237
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "sync": self.TestSync, "sync_unit_tests": self.TestSync, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "sync": self.TestSync, "sync_unit_tests": self.TestSync, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
476,238
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "sync": self.TestSync, "sync_unit_tests": self.TestSync, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "sync": self.TestSync, "sync_unit_tests": self.TestSync, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
476,239
def Run(self): ''' Runs the test specified by command-line argument --test ''' logging.info("running test %s" % (self._test)) return self._test_list[self._test]()
def Run(self): ''' Runs the test specified by command-line argument --test ''' logging.info("running test %s" % (self._test)) return self._test_list[self._test]()
476,240
def _ReadGtestFilterFile(self, name, cmd): '''Read a file which is a list of tests to filter out with --gtest_filter and append the command-line option to cmd. ''' filters = [] for directory in self._data_dirs: gtest_filter_files = [ os.path.join(directory, name + ".gtest.txt"), os.path.join(directory, name + ".gtest-%s.txt" % \ self._options.valgrind_tool)] for platform_suffix in common.PlatformNames(): gtest_filter_files += [ os.path.join(directory, name + ".gtest_%s.txt" % platform_suffix), os.path.join(directory, name + ".gtest-%s_%s.txt" % \ (self._options.valgrind_tool, platform_suffix))] for filename in gtest_filter_files: if os.path.exists(filename): logging.info("reading gtest filters from %s" % filename) f = open(filename, 'r') for line in f.readlines(): if line.startswith("#") or line.startswith("//") or line.isspace(): continue line = line.rstrip() filters.append(line) gtest_filter = self._options.gtest_filter if len(filters): if gtest_filter: gtest_filter += ":" if gtest_filter.find("-") < 0: gtest_filter += "-" else: gtest_filter = "-" gtest_filter += ":".join(filters) if gtest_filter: cmd.append("--gtest_filter=%s" % gtest_filter)
def _ReadGtestFilterFile(self, name, cmd): '''Read a file which is a list of tests to filter out with --gtest_filter and append the command-line option to cmd. ''' filters = [] for directory in self._data_dirs: gtest_filter_files = [ os.path.join(directory, name + ".gtest.txt"), os.path.join(directory, name + ".gtest-%s.txt" % \ self._options.valgrind_tool)] for platform_suffix in common.PlatformNames(): gtest_filter_files += [ os.path.join(directory, name + ".gtest_%s.txt" % platform_suffix), os.path.join(directory, name + ".gtest-%s_%s.txt" % \ (self._options.valgrind_tool, platform_suffix))] for filename in gtest_filter_files: if os.path.exists(filename): logging.info("reading gtest filters from %s" % filename) f = open(filename, 'r') for line in f.readlines(): if line.startswith("#") or line.startswith("//") or line.isspace(): continue line = line.rstrip() filters.append(line) gtest_filter = self._gtest_filter if len(filters): if gtest_filter: gtest_filter += ":" if gtest_filter.find("-") < 0: gtest_filter += "-" else: gtest_filter = "-" gtest_filter += ":".join(filters) if gtest_filter: cmd.append("--gtest_filter=%s" % gtest_filter)
476,241
def _main(_): parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " "[-t <test> ...]") parser.disable_interspersed_args() parser.add_option("-b", "--build_dir", help="the location of the output of the compiler output") parser.add_option("-t", "--test", action="append", help="which test to run") parser.add_option("", "--baseline", action="store_true", default=False, help="generate baseline data instead of validating") parser.add_option("", "--gtest_filter", help="additional arguments to --gtest_filter") parser.add_option("", "--gtest_repeat", help="argument for --gtest_repeat") parser.add_option("-v", "--verbose", action="store_true", default=False, help="verbose output - enable debug log messages") parser.add_option("", "--tool", dest="valgrind_tool", default="memcheck", help="specify a valgrind tool to run the tests under") parser.add_option("", "--tool_flags", dest="valgrind_tool_flags", default="", help="specify custom flags for the selected valgrind tool") # My machine can do about 120 layout tests/hour in release mode. # Let's do 30 minutes worth per run. # The CPU is mostly idle, so perhaps we can raise this when # we figure out how to run them more efficiently. parser.add_option("-n", "--num_tests", default=60, type="int", help="for layout tests: # of subtests per run. 0 for all.") options, args = parser.parse_args() if options.verbose: logging_utils.config_root(logging.DEBUG) else: logging_utils.config_root() if not options.test or not len(options.test): parser.error("--test not specified") for t in options.test: tests = ChromeTests(options, args, t) ret = tests.Run() if ret: return ret return 0
def _main(_): parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " "[-t <test> ...]") parser.disable_interspersed_args() parser.add_option("-b", "--build_dir", help="the location of the output of the compiler output") parser.add_option("-t", "--test", action="append", default=[], help="which test to run, supports test:gtest_filter format " "as well.") parser.add_option("", "--baseline", action="store_true", default=False, help="generate baseline data instead of validating") parser.add_option("", "--gtest_filter", help="additional arguments to --gtest_filter") parser.add_option("", "--gtest_repeat", help="argument for --gtest_repeat") parser.add_option("-v", "--verbose", action="store_true", default=False, help="verbose output - enable debug log messages") parser.add_option("", "--tool", dest="valgrind_tool", default="memcheck", help="specify a valgrind tool to run the tests under") parser.add_option("", "--tool_flags", dest="valgrind_tool_flags", default="", help="specify custom flags for the selected valgrind tool") # My machine can do about 120 layout tests/hour in release mode. # Let's do 30 minutes worth per run. # The CPU is mostly idle, so perhaps we can raise this when # we figure out how to run them more efficiently. parser.add_option("-n", "--num_tests", default=60, type="int", help="for layout tests: # of subtests per run. 0 for all.") options, args = parser.parse_args() if options.verbose: logging_utils.config_root(logging.DEBUG) else: logging_utils.config_root() if not options.test or not len(options.test): parser.error("--test not specified") for t in options.test: tests = ChromeTests(options, args, t) ret = tests.Run() if ret: return ret return 0
476,242
def _main(_): parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " "[-t <test> ...]") parser.disable_interspersed_args() parser.add_option("-b", "--build_dir", help="the location of the output of the compiler output") parser.add_option("-t", "--test", action="append", help="which test to run") parser.add_option("", "--baseline", action="store_true", default=False, help="generate baseline data instead of validating") parser.add_option("", "--gtest_filter", help="additional arguments to --gtest_filter") parser.add_option("", "--gtest_repeat", help="argument for --gtest_repeat") parser.add_option("-v", "--verbose", action="store_true", default=False, help="verbose output - enable debug log messages") parser.add_option("", "--tool", dest="valgrind_tool", default="memcheck", help="specify a valgrind tool to run the tests under") parser.add_option("", "--tool_flags", dest="valgrind_tool_flags", default="", help="specify custom flags for the selected valgrind tool") # My machine can do about 120 layout tests/hour in release mode. # Let's do 30 minutes worth per run. # The CPU is mostly idle, so perhaps we can raise this when # we figure out how to run them more efficiently. parser.add_option("-n", "--num_tests", default=60, type="int", help="for layout tests: # of subtests per run. 0 for all.") options, args = parser.parse_args() if options.verbose: logging_utils.config_root(logging.DEBUG) else: logging_utils.config_root() if not options.test or not len(options.test): parser.error("--test not specified") for t in options.test: tests = ChromeTests(options, args, t) ret = tests.Run() if ret: return ret return 0
def _main(_): parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " "[-t <test> ...]") parser.disable_interspersed_args() parser.add_option("-b", "--build_dir", help="the location of the output of the compiler output") parser.add_option("-t", "--test", action="append", help="which test to run") parser.add_option("", "--baseline", action="store_true", default=False, help="generate baseline data instead of validating") parser.add_option("", "--gtest_filter", help="additional arguments to --gtest_filter") parser.add_option("", "--gtest_repeat", help="argument for --gtest_repeat") parser.add_option("-v", "--verbose", action="store_true", default=False, help="verbose output - enable debug log messages") parser.add_option("", "--tool", dest="valgrind_tool", default="memcheck", help="specify a valgrind tool to run the tests under") parser.add_option("", "--tool_flags", dest="valgrind_tool_flags", default="", help="specify custom flags for the selected valgrind tool") # My machine can do about 120 layout tests/hour in release mode. # Let's do 30 minutes worth per run. # The CPU is mostly idle, so perhaps we can raise this when # we figure out how to run them more efficiently. parser.add_option("-n", "--num_tests", default=60, type="int", help="for layout tests: # of subtests per run. 0 for all.") options, args = parser.parse_args() if options.verbose: logging_utils.config_root(logging.DEBUG) else: logging_utils.config_root() if not options.test: parser.error("--test not specified") for t in options.test: tests = ChromeTests(options, args, t) ret = tests.Run() if ret: return ret return 0
476,243
def Analyze(self, log_lines, check_sanity=False): """Analyzes the app's output and applies suppressions to the reports.
def Analyze(self, log_lines, check_sanity=False): """Analyzes the app's output and applies suppressions to the reports.
476,244
def GetReports(self, files): '''Extracts reports from a set of files.
def GetReports(self, files): '''Extracts reports from a set of files.
476,245
def TestRemoting(self): return self.SimpleTest("chrome", "remoting_unittests")
def TestRemoting(self): return self.SimpleTest("chrome", "remoting_unittests")
476,246
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
476,247
def SetArchiveVars(archive): """Set a bunch of global variables appropriate for the specified archive.""" global BUILD_ARCHIVE_TYPE global BUILD_ARCHIVE_DIR global BUILD_ZIP_NAME global BUILD_DIR_NAME global BUILD_EXE_NAME global BUILD_BASE_URL BUILD_ARCHIVE_TYPE = archive BUILD_ARCHIVE_DIR = 'chromium-rel-' + BUILD_ARCHIVE_TYPE if BUILD_ARCHIVE_TYPE in ('linux', 'linux-64'): BUILD_ZIP_NAME = 'chrome-linux.zip' BUILD_DIR_NAME = 'chrome-linux' BUILD_EXE_NAME = 'chrome' elif BUILD_ARCHIVE_TYPE in ('mac'): BUILD_ZIP_NAME = 'chrome-mac.zip' BUILD_DIR_NAME = 'chrome-mac' BUILD_EXE_NAME = 'Chromium.app/Contents/MacOS/Chromium' elif BUILD_ARCHIVE_TYPE in ('xp'): BUILD_ZIP_NAME = 'chrome-win32.zip' BUILD_DIR_NAME = 'chrome-win32' BUILD_EXE_NAME = 'chrome.exe' BUILD_BASE_URL += BUILD_ARCHIVE_DIR
def SetArchiveVars(archive): """Set a bunch of global variables appropriate for the specified archive.""" global BUILD_ARCHIVE_TYPE global BUILD_ARCHIVE_DIR global BUILD_ZIP_NAME global BUILD_DIR_NAME global BUILD_EXE_NAME global BUILD_BASE_URL BUILD_ARCHIVE_TYPE = archive BUILD_ARCHIVE_DIR = 'chromium-rel-' + BUILD_ARCHIVE_TYPE if BUILD_ARCHIVE_TYPE in ('linux', 'linux-64', 'linux-chromiumos'): BUILD_ZIP_NAME = 'chrome-linux.zip' BUILD_DIR_NAME = 'chrome-linux' BUILD_EXE_NAME = 'chrome' elif BUILD_ARCHIVE_TYPE in ('mac'): BUILD_ZIP_NAME = 'chrome-mac.zip' BUILD_DIR_NAME = 'chrome-mac' BUILD_EXE_NAME = 'Chromium.app/Contents/MacOS/Chromium' elif BUILD_ARCHIVE_TYPE in ('xp'): BUILD_ZIP_NAME = 'chrome-win32.zip' BUILD_DIR_NAME = 'chrome-win32' BUILD_EXE_NAME = 'chrome.exe' BUILD_BASE_URL += BUILD_ARCHIVE_DIR
476,248
def main(): usage = ('%prog [options] [-- chromium-options]\n' 'Perform binary search on the snapshot builds.') parser = optparse.OptionParser(usage=usage) # Strangely, the default help output doesn't include the choice list. choices = ['mac', 'xp', 'linux', 'linux-64'] parser.add_option('-a', '--archive', choices = choices, help = 'The buildbot archive to bisect [%s].' % '|'.join(choices)) parser.add_option('-b', '--bad', type = 'int', help = 'The bad revision to bisect to.') parser.add_option('-g', '--good', type = 'int', help = 'The last known good revision to bisect from.') parser.add_option('-p', '--profile', '--user-data-dir', type = 'str', help = 'Profile to use; this will not reset every run. ' + 'Defaults to a clean profile.') (opts, args) = parser.parse_args() if opts.archive is None: parser.print_help() return 1 if opts.bad and opts.good and (opts.good > opts.bad): print ('The good revision (%d) must precede the bad revision (%d).\n' % (opts.good, opts.bad)) parser.print_help() return 1 SetArchiveVars(opts.archive) # Pick a starting point, try to get HEAD for this. if opts.bad: bad_rev = opts.bad else: bad_rev = 0 try: # Location of the latest build revision number BUILD_LATEST_URL = '%s/LATEST' % (BUILD_BASE_URL) nh = urllib.urlopen(BUILD_LATEST_URL) latest = int(nh.read()) nh.close() bad_rev = raw_input('Bad revision [HEAD:%d]: ' % latest) if (bad_rev == ''): bad_rev = latest bad_rev = int(bad_rev) except Exception, e: print('Could not determine latest revision. This could be bad...') bad_rev = int(raw_input('Bad revision: ')) # Find out when we were good. if opts.good: good_rev = opts.good else: good_rev = 0 try: good_rev = int(raw_input('Last known good [0]: ')) except Exception, e: pass # Get a list of revisions to bisect across. revlist = GetRevList(good_rev, bad_rev) if len(revlist) < 2: # Don't have enough builds to bisect print 'We don\'t have enough builds to bisect. revlist: %s' % revlist sys.exit(1) # If we don't have a |good_rev|, set it to be the first revision possible. if good_rev == 0: good_rev = revlist[0] # These are indexes of |revlist|. good = 0 bad = len(revlist) - 1 last_known_good_rev = revlist[good] # Binary search time! while good < bad: candidates = revlist[good:bad] num_poss = len(candidates) if num_poss > 10: print('%d candidates. %d tries left.' % (num_poss, round(math.log(num_poss, 2)))) else: print('Candidates: %s' % revlist[good:bad]) # Cut the problem in half... test = int((bad - good) / 2) + good test_rev = revlist[test] # Let the user give this rev a spin (in her own profile, if she wants). profile = opts.profile if not profile: profile = 'profile' # In a temp dir. TryRevision(test_rev, profile, args) if AskIsGoodBuild(test_rev): last_known_good_rev = revlist[good] good = test + 1 else: bad = test # We're done. Let the user know the results in an official manner. print('You are probably looking for build %d.' % revlist[bad]) print('CHANGELOG URL:') print(CHANGELOG_URL % (last_known_good_rev, revlist[bad])) print('Built at revision:') print(BUILD_VIEWVC_URL % revlist[bad])
def main(): usage = ('%prog [options] [-- chromium-options]\n' 'Perform binary search on the snapshot builds.') parser = optparse.OptionParser(usage=usage) # Strangely, the default help output doesn't include the choice list. choices = ['mac', 'xp', 'linux', 'linux-64', 'linux-chromiumos'] parser.add_option('-a', '--archive', choices = choices, help = 'The buildbot archive to bisect [%s].' % '|'.join(choices)) parser.add_option('-b', '--bad', type = 'int', help = 'The bad revision to bisect to.') parser.add_option('-g', '--good', type = 'int', help = 'The last known good revision to bisect from.') parser.add_option('-p', '--profile', '--user-data-dir', type = 'str', help = 'Profile to use; this will not reset every run. ' + 'Defaults to a clean profile.') (opts, args) = parser.parse_args() if opts.archive is None: parser.print_help() return 1 if opts.bad and opts.good and (opts.good > opts.bad): print ('The good revision (%d) must precede the bad revision (%d).\n' % (opts.good, opts.bad)) parser.print_help() return 1 SetArchiveVars(opts.archive) # Pick a starting point, try to get HEAD for this. if opts.bad: bad_rev = opts.bad else: bad_rev = 0 try: # Location of the latest build revision number BUILD_LATEST_URL = '%s/LATEST' % (BUILD_BASE_URL) nh = urllib.urlopen(BUILD_LATEST_URL) latest = int(nh.read()) nh.close() bad_rev = raw_input('Bad revision [HEAD:%d]: ' % latest) if (bad_rev == ''): bad_rev = latest bad_rev = int(bad_rev) except Exception, e: print('Could not determine latest revision. This could be bad...') bad_rev = int(raw_input('Bad revision: ')) # Find out when we were good. if opts.good: good_rev = opts.good else: good_rev = 0 try: good_rev = int(raw_input('Last known good [0]: ')) except Exception, e: pass # Get a list of revisions to bisect across. revlist = GetRevList(good_rev, bad_rev) if len(revlist) < 2: # Don't have enough builds to bisect print 'We don\'t have enough builds to bisect. revlist: %s' % revlist sys.exit(1) # If we don't have a |good_rev|, set it to be the first revision possible. if good_rev == 0: good_rev = revlist[0] # These are indexes of |revlist|. good = 0 bad = len(revlist) - 1 last_known_good_rev = revlist[good] # Binary search time! while good < bad: candidates = revlist[good:bad] num_poss = len(candidates) if num_poss > 10: print('%d candidates. %d tries left.' % (num_poss, round(math.log(num_poss, 2)))) else: print('Candidates: %s' % revlist[good:bad]) # Cut the problem in half... test = int((bad - good) / 2) + good test_rev = revlist[test] # Let the user give this rev a spin (in her own profile, if she wants). profile = opts.profile if not profile: profile = 'profile' # In a temp dir. TryRevision(test_rev, profile, args) if AskIsGoodBuild(test_rev): last_known_good_rev = revlist[good] good = test + 1 else: bad = test # We're done. Let the user know the results in an official manner. print('You are probably looking for build %d.' % revlist[bad]) print('CHANGELOG URL:') print(CHANGELOG_URL % (last_known_good_rev, revlist[bad])) print('Built at revision:') print(BUILD_VIEWVC_URL % revlist[bad])
476,249
def CheckChange(input_api, output_api): for f in input_api.AffectedFiles(): dir = os.path.normpath(input_api.os_path.dirname(f.LocalPath())) if dir in DEPENDENT_DIRS: return [output_api.PresubmitPromptWarning(REBUILD_WARNING)] return []
def CheckChange(input_api, output_api): for f in input_api.AffectedFiles(): dir = os.path.normpath(input_api.os_path.dirname(f.LocalPath())) while len(dir): if dir in BLACKLIST_DIRS: return [] if dir in DEPENDENT_DIRS: return [output_api.PresubmitPromptWarning(REBUILD_WARNING)] dir = os.path.dirname(dir) return []
476,250
def __init__(self, name, type): SizeArgument.__init__(self, name, "GLsizei")
def __init__(self, name, type): SizeArgument.__init__(self, name, "GLsizei")
476,251
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1])) else: return PointerArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) # Is this a resource argument? Must come after pointer check. elif arg_parts[0].startswith('GLidBind'): return ResourceIdBindArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLidZero'): return ResourceIdZeroArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLid'): return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLboolean') and len(arg_parts[0]) > 9: return BoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and arg_parts[0] != "GLintptr"): return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLsizeiNotNegative'): return SizeNotNegativeArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLsize'): return SizeArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) else: return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1])) else: return PointerArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) # Is this a resource argument? Must come after pointer check. elif arg_parts[0].startswith('GLidBind'): return ResourceIdBindArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLidZero'): return ResourceIdZeroArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLid'): return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLboolean') and len(arg_parts[0]) > 9: return BoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and not arg_parts[0].startswith('GLintptr')): return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLsizeiNotNegative'): return SizeNotNegativeArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLsize'): return SizeArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) else: return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
476,252
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1])) else: return PointerArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) # Is this a resource argument? Must come after pointer check. elif arg_parts[0].startswith('GLidBind'): return ResourceIdBindArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLidZero'): return ResourceIdZeroArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLid'): return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLboolean') and len(arg_parts[0]) > 9: return BoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and arg_parts[0] != "GLintptr"): return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLsizeiNotNegative'): return SizeNotNegativeArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLsize'): return SizeArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) else: return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1])) else: return PointerArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) # Is this a resource argument? Must come after pointer check. elif arg_parts[0].startswith('GLidBind'): return ResourceIdBindArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLidZero'): return ResourceIdZeroArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLid'): return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLboolean') and len(arg_parts[0]) > 9: return BoolArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and arg_parts[0] != "GLintptr"): return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('GLsizeiNotNegative') or arg_parts[0].startswith('GLintptrNotNegative')): return SizeNotNegativeArgument(arg_parts[-1], " ".join(arg_parts[0:-1]), arg_parts[0][0:-11]) elif arg_parts[0].startswith('GLsize'): return SizeArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) else: return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
476,253
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
476,254
def testToolbarButtonsPref(self): """Verify toolbar buttons prefs..""" # Assert defaults first self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton)) self.SetPrefs(pyauto.kShowHomeButton, True) self.RestartBrowser(clear_profile=False) self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton))
def testToolbarButtonsPref(self): """Verify toolbar buttons prefs.""" # Assert defaults first self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton)) self.SetPrefs(pyauto.kShowHomeButton, True) self.RestartBrowser(clear_profile=False) self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton))
476,255
def testDnsPrefectchingEnabledPref(self): """Verify DNS prefetching pref.""" # Assert default self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kDnsPrefetchingEnabled)) self.SetPrefs(pyauto.kDnsPrefetchingEnabled, False) self.RestartBrowser(clear_profile=False) self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kDnsPrefetchingEnabled))
def testDnsPrefetchingEnabledPref(self): """Verify DNS prefetching pref.""" # Assert default self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kDnsPrefetchingEnabled)) self.SetPrefs(pyauto.kDnsPrefetchingEnabled, False) self.RestartBrowser(clear_profile=False) self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kDnsPrefetchingEnabled))
476,256
def TestRemoting(self): return self.SimpleTest("chrome", "remoting_unittests")
def TestRemoting(self): return self.SimpleTest("chrome", "remoting_unittests")
476,257
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
476,258
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
476,259
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 to the input file. Returns: The module name as a string. """ basename = os.path.basename(infile_path) return os.path.splitext(basename)[0]
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 to the input file. Returns: The module name as a string. """ basename = os.path.basename(infile_path) while 1: new_basename = os.path.splitext(basename)[0] if basename == new_basename: break else: basename = new_basename return basename
476,260
def _MakeFile(self, size): """Make a file on-the-fly with the given size. Returns the path to the file. """ fd, file_path = tempfile.mkstemp(suffix='.zip', prefix='file-') os.lseek(fd, size, 0) os.write(fd, 'a') os.close(fd) return file_path
def _MakeFile(self, size): """Make a file on-the-fly with the given size. Returns the path to the file. """ fd, file_path = tempfile.mkstemp(suffix='.zip', prefix='file-downloads-') os.lseek(fd, size, 0) os.write(fd, 'a') os.close(fd) return file_path
476,261
def testCodeSign(self): """Check the app for codesign and bail out if it's non-branded.""" browser_info = self.GetBrowserInfo()
def testCodeSign(self): """Check the app for codesign and bail out if it's non-branded.""" browser_info = self.GetBrowserInfo()
476,262
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[], expect_retval=None): """Poll on a condition until timeout.
476,263
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
476,264
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
476,265
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
476,266
def WaitForInfobarCount(self, count, windex=0, tab_index=0): """Wait until infobar count becomes |count|.
def WaitForInfobarCount(self, count, windex=0, tab_index=0): """Wait until infobar count becomes |count|.
476,267
def WaitForInfobarCount(self, count, windex=0, tab_index=0): """Wait until infobar count becomes |count|.
def WaitForInfobarCount(self, count, windex=0, tab_index=0): """Wait until infobar count becomes |count|.
476,268
def _get_test_file_queue(self, test_files): """Create the thread safe queue of lists of (test filenames, test URIs) tuples. Each TestShellThread pulls a list from this queue and runs those tests in order before grabbing the next available list.
def _get_test_file_queue(self, test_files): """Create the thread safe queue of lists of (test filenames, test URIs) tuples. Each TestShellThread pulls a list from this queue and runs those tests in order before grabbing the next available list.
476,269
def AddWebKitEditorActions(actions): """Add editor actions from editor_client_impl.cc. Arguments: actions: set of actions to add to. """ action_re = re.compile(r'''\{ [\w']+, +\w+, +"(.*)" +\},''') editor_file = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit', 'glue', 'editor_client_impl.cc') for line in open(editor_file): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1))
def AddWebKitEditorActions(actions): """Add editor actions from editor_client_impl.cc. Arguments: actions: set of actions to add to. """ action_re = re.compile(r'''\{ [\w']+, +\w+, +"(.*)" +\},''') editor_file = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit', 'api', 'src','EditorClientImpl.cc') for line in open(editor_file): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1))
476,270
def GrepForActions(path, actions): """Grep a source file for calls to UserMetrics functions. Arguments: path: path to the file actions: set of actions to add to """ action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(L"(.*)"') other_action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(') computed_action_re = re.compile(r'UserMetrics::RecordComputedAction') for line in open(path): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1)) elif other_action_re.search(line): # Warn if this file shouldn't be mentioning RecordAction. if os.path.basename(path) != 'user_metrics.cc': print >>sys.stderr, 'WARNING: %s has funny RecordAction' % path elif computed_action_re.search(line): # Warn if this file shouldn't be calling RecordComputedAction. if os.path.basename(path) not in KNOWN_COMPUTED_USERS: print >>sys.stderr, 'WARNING: %s has RecordComputedAction' % path
def GrepForActions(path, actions): """Grep a source file for calls to UserMetrics functions. Arguments: path: path to the file actions: set of actions to add to """ global number_of_files_total number_of_files_total = number_of_files_total + 1 action_re = re.compile(r'UserMetricsAction\("([^"]*)') computed_action_re = re.compile(r'UserMetrics::RecordComputedAction') for line in open(path): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1)) elif other_action_re.search(line): # Warn if this file shouldn't be mentioning RecordAction. if os.path.basename(path) != 'user_metrics.cc': print >>sys.stderr, 'WARNING: %s has funny RecordAction' % path elif computed_action_re.search(line): # Warn if this file shouldn't be calling RecordComputedAction. if os.path.basename(path) not in KNOWN_COMPUTED_USERS: print >>sys.stderr, 'WARNING: %s has RecordComputedAction' % path
476,271
def GrepForActions(path, actions): """Grep a source file for calls to UserMetrics functions. Arguments: path: path to the file actions: set of actions to add to """ action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(L"(.*)"') other_action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(') computed_action_re = re.compile(r'UserMetrics::RecordComputedAction') for line in open(path): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1)) elif other_action_re.search(line): # Warn if this file shouldn't be mentioning RecordAction. if os.path.basename(path) != 'user_metrics.cc': print >>sys.stderr, 'WARNING: %s has funny RecordAction' % path elif computed_action_re.search(line): # Warn if this file shouldn't be calling RecordComputedAction. if os.path.basename(path) not in KNOWN_COMPUTED_USERS: print >>sys.stderr, 'WARNING: %s has RecordComputedAction' % path
def GrepForActions(path, actions): """Grep a source file for calls to UserMetrics functions. Arguments: path: path to the file actions: set of actions to add to """ action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(L"(.*)"') other_action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(') computed_action_re = re.compile(r'UserMetrics::RecordComputedAction') for line in open(path): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1)) elif other_action_re.search(line): # Warn if this file shouldn't be mentioning RecordAction. if os.path.basename(path) != 'user_metrics.cc': print >>sys.stderr, 'WARNING: %s has funny RecordAction' % path elif computed_action_re.search(line): # Warn if this file shouldn't be calling RecordComputedAction. if os.path.basename(path) not in KNOWN_COMPUTED_USERS: print >>sys.stderr, 'WARNING: %s has RecordComputedAction' % path
476,272
def GrepForActions(path, actions): """Grep a source file for calls to UserMetrics functions. Arguments: path: path to the file actions: set of actions to add to """ action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(L"(.*)"') other_action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(') computed_action_re = re.compile(r'UserMetrics::RecordComputedAction') for line in open(path): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1)) elif other_action_re.search(line): # Warn if this file shouldn't be mentioning RecordAction. if os.path.basename(path) != 'user_metrics.cc': print >>sys.stderr, 'WARNING: %s has funny RecordAction' % path elif computed_action_re.search(line): # Warn if this file shouldn't be calling RecordComputedAction. if os.path.basename(path) not in KNOWN_COMPUTED_USERS: print >>sys.stderr, 'WARNING: %s has RecordComputedAction' % path
def GrepForActions(path, actions): """Grep a source file for calls to UserMetrics functions. Arguments: path: path to the file actions: set of actions to add to """ action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(L"(.*)"') other_action_re = re.compile(r'[> ]UserMetrics:?:?RecordAction\(') computed_action_re = re.compile(r'UserMetrics::RecordComputedAction') for line in open(path): match = action_re.search(line) if match: # Plain call to RecordAction actions.add(match.group(1)) elif other_action_re.search(line): # Warn if this file shouldn't be mentioning RecordAction. if os.path.basename(path) != 'user_metrics.cc': print >>sys.stderr, 'WARNING: %s has funny RecordAction' % path elif computed_action_re.search(line): # Warn if this file shouldn't be calling RecordComputedAction. if os.path.basename(path) not in KNOWN_COMPUTED_USERS: print >>sys.stderr, 'WARNING: {0} has RecordComputedAction at {1}'.\ format(path, line_number)
476,273
def WalkDirectory(root_path, actions): for path, dirs, files in os.walk(root_path): if '.svn' in dirs: dirs.remove('.svn') for file in files: ext = os.path.splitext(file)[1] if ext == '.cc': GrepForActions(os.path.join(path, file), actions)
def WalkDirectory(root_path, actions): for path, dirs, files in os.walk(root_path): if '.svn' in dirs: dirs.remove('.svn') for file in files: ext = os.path.splitext(file)[1] if ext in ('.cc', '.mm', '.c', '.m'): GrepForActions(os.path.join(path, file), actions)
476,274
def main(argv): actions = set() AddComputedActions(actions) AddWebKitEditorActions(actions) # Walk the source tree to process all .cc files. chrome_root = os.path.join(path_utils.ScriptDir(), '..') WalkDirectory(chrome_root, actions) webkit_root = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit') WalkDirectory(os.path.join(webkit_root, 'glue'), actions) WalkDirectory(os.path.join(webkit_root, 'port'), actions) # Print out the actions as a sorted list. for action in sorted(actions): print action
def main(argv): actions = set() AddComputedActions(actions) # Walk the source tree to process all .cc files. chrome_root = os.path.join(path_utils.ScriptDir(), '..') WalkDirectory(chrome_root, actions) webkit_root = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit') WalkDirectory(os.path.join(webkit_root, 'glue'), actions) WalkDirectory(os.path.join(webkit_root, 'port'), actions) # Print out the actions as a sorted list. for action in sorted(actions): print action
476,275
def _TriggerUnsafeDownload(self, filename, tab_index=0, windex=0): """Trigger download of an unsafe/dangerous filetype.
def _TriggerUnsafeDownload(self, filename, tab_index=0, windex=0): """Trigger download of an unsafe/dangerous filetype.
476,276
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
476,277
def main(argv=None): if argv is None: argv = sys.argv short_options = 'f:i:o:t:h' long_options = ['file=', 'help'] helpstr = """\
def main(argv=None): if argv is None: argv = sys.argv short_options = 'e:f:i:o:t:h' long_options = ['eval=', 'file=', 'help'] helpstr = """\
476,278
def main(argv=None): if argv is None: argv = sys.argv short_options = 'f:i:o:t:h' long_options = ['file=', 'help'] helpstr = """\
def main(argv=None): if argv is None: argv = sys.argv short_options = 'f:i:o:t:h' long_options = ['file=', 'help'] helpstr = """\
476,279
def main(argv=None): if argv is None: argv = sys.argv short_options = 'f:i:o:t:h' long_options = ['file=', 'help'] helpstr = """\
def main(argv=None): if argv is None: argv = sys.argv short_options = 'f:i:o:t:h' long_options = ['file=', 'help'] helpstr = """\
476,280
def main(argv=None): if argv is None: argv = sys.argv short_options = 'f:i:o:t:h' long_options = ['file=', 'help'] helpstr = """\
deffor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) main(argv=None):for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) iffor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) argvfor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) isfor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) None:for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) argvfor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) =for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) sys.argvfor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) short_optionsfor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) =for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) 'f:i:o:t:h'for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) long_optionsfor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) =for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) ['file=',for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) 'help']for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) helpstrfor key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) =for key, val in evals.iteritems(): values[key] = str(eval(val, globals(), values)) """\
476,281
def LintTestFiles(input_api, output_api): current_dir = input_api.PresubmitLocalPath() # Set 'webkit/tools/layout_tests' in include path. python_paths = [ current_dir, input_api.os_path.join(current_dir, '..', '..', '..', 'tools', 'python') ] env = input_api.environ.copy() if env.get('PYTHONPATH'): python_paths.append(env['PYTHONPATH']) env['PYTHONPATH'] = input_api.os_path.pathsep.join(python_paths) args = [ input_api.python_executable, input_api.os_path.join(current_dir, 'run_webkit_tests.py'), '--lint-test-files' ] subproc = input_api.subprocess.Popen( args, cwd=current_dir, env=env, stdin=input_api.subprocess.PIPE, stdout=input_api.subprocess.PIPE, stderr=input_api.subprocess.STDOUT) stdout_data = subproc.communicate()[0] # TODO(ukai): consolidate run_webkit_tests --lint-test-files reports. is_error = lambda line: (input_api.re.match('^Line:', line) or input_api.re.search('ERROR Line:', line)) error = filter(is_error, stdout_data.splitlines()) if error: return [output_api.PresubmitError('Lint error\n%s' % '\n'.join(error), long_text=stdout_data)] return []
def LintTestFiles(input_api, output_api): current_dir = str(input_api.PresubmitLocalPath()) # Set 'webkit/tools/layout_tests' in include path. python_paths = [ current_dir, input_api.os_path.join(current_dir, '..', '..', '..', 'tools', 'python') ] env = input_api.environ.copy() if env.get('PYTHONPATH'): python_paths.append(env['PYTHONPATH']) env['PYTHONPATH'] = input_api.os_path.pathsep.join(python_paths) args = [ input_api.python_executable, input_api.os_path.join(current_dir, 'run_webkit_tests.py'), '--lint-test-files' ] subproc = input_api.subprocess.Popen( args, cwd=current_dir, env=env, stdin=input_api.subprocess.PIPE, stdout=input_api.subprocess.PIPE, stderr=input_api.subprocess.STDOUT) stdout_data = subproc.communicate()[0] # TODO(ukai): consolidate run_webkit_tests --lint-test-files reports. is_error = lambda line: (input_api.re.match('^Line:', line) or input_api.re.search('ERROR Line:', line)) error = filter(is_error, stdout_data.splitlines()) if error: return [output_api.PresubmitError('Lint error\n%s' % '\n'.join(error), long_text=stdout_data)] return []
476,282
def WriteGLES2ImplementationDeclaration(self, func, file): """Writes the GLES2 Implemention declaration.""" file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
def WriteGLES2ImplementationDeclaration(self, func, file): """Writes the GLES2 Implemention declaration.""" file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
476,283
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: self.WriteGLES2ImplementationDeclaration(func, file)
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') impl_decl = func.GetInfo('impl_decl') if (func.can_auto_generate and (impl_func == None or impl_func == True) and (impl_decl == None or impl_decl == True)): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) for arg in func.GetOriginalArgs(): arg.WriteClientSideValidationCode(file) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: self.WriteGLES2ImplementationDeclaration(func, file)
476,284
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" FreeIds(%s);\n" % func.MakeOriginalArgString("")) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" FreeIds(%s);\n" % func.MakeOriginalArgString("")) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
476,285
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) all_but_last_args = func.GetOriginalArgs()[:-1] arg_string = ( ", ".join(["%s" % arg.name for arg in all_but_last_args])) code = """ typedef %(func_name)s::Result Result;
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) all_but_last_args = func.GetOriginalArgs()[:-1] arg_string = ( ", ".join(["%s" % arg.name for arg in all_but_last_args])) code = """ typedef %(func_name)s::Result Result;
476,286
code = """ typedef %(func_name)s::Result Result;
code = """ typedef %(func_name)s::Result Result;
476,287
code = """ typedef %(func_name)s::Result Result;
code = """ typedef %(func_name)s::Result Result;
476,288
def main(argv): if len(argv) < 3: print('usage: %s order.html input_file_1 input_file_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() full_paths = {} for full_path in argv[2:]: file_name = os.path.basename(full_path) if file_name.endswith('.js'): full_paths[file_name] = full_path extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: if not input_file_name in full_paths: print('A full path to %s isn\'t specified in command line. ' 'Probably, you have an obsolete script entry in %s' % (input_file_name, argv[1])) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_paths[input_file_name], 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
def main(argv): if len(argv) < 3: print('usage: %s order.html input_source_dir_1 input_source_dir_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() full_paths = {} for full_path in argv[2:]: file_name = os.path.basename(full_path) if file_name.endswith('.js'): full_paths[file_name] = full_path extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: if not input_file_name in full_paths: print('A full path to %s isn\'t specified in command line. ' 'Probably, you have an obsolete script entry in %s' % (input_file_name, argv[1])) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_paths[input_file_name], 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
476,289
def main(argv): if len(argv) < 3: print('usage: %s order.html input_file_1 input_file_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() full_paths = {} for full_path in argv[2:]: file_name = os.path.basename(full_path) if file_name.endswith('.js'): full_paths[file_name] = full_path extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: if not input_file_name in full_paths: print('A full path to %s isn\'t specified in command line. ' 'Probably, you have an obsolete script entry in %s' % (input_file_name, argv[1])) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_paths[input_file_name], 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
def main(argv): if len(argv) < 3: print('usage: %s order.html input_file_1 input_file_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: if not input_file_name in full_paths: print('A full path to %s isn\'t specified in command line. ' 'Probably, you have an obsolete script entry in %s' % (input_file_name, argv[1])) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_paths[input_file_name], 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
476,290
def main(argv): if len(argv) < 3: print('usage: %s order.html input_file_1 input_file_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() full_paths = {} for full_path in argv[2:]: file_name = os.path.basename(full_path) if file_name.endswith('.js'): full_paths[file_name] = full_path extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: if not input_file_name in full_paths: print('A full path to %s isn\'t specified in command line. ' 'Probably, you have an obsolete script entry in %s' % (input_file_name, argv[1])) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_paths[input_file_name], 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
def main(argv): if len(argv) < 3: print('usage: %s order.html input_file_1 input_file_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() full_paths = {} for full_path in argv[2:]: file_name = os.path.basename(full_path) if file_name.endswith('.js'): full_paths[file_name] = full_path extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: full_path = expander.expand(input_file_name) if (full_path is None): raise Exception('File %s referenced in %s not found on any source paths, ' 'check source tree for consistency' % (input_file_name, input_file_name)) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_paths[input_file_name], 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
476,291
def main(argv): if len(argv) < 3: print('usage: %s order.html input_file_1 input_file_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() full_paths = {} for full_path in argv[2:]: file_name = os.path.basename(full_path) if file_name.endswith('.js'): full_paths[file_name] = full_path extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: if not input_file_name in full_paths: print('A full path to %s isn\'t specified in command line. ' 'Probably, you have an obsolete script entry in %s' % (input_file_name, argv[1])) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_paths[input_file_name], 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
def main(argv): if len(argv) < 3: print('usage: %s order.html input_file_1 input_file_2 ... ' 'output_file' % argv[0]) return 1 output_file_name = argv.pop() full_paths = {} for full_path in argv[2:]: file_name = os.path.basename(full_path) if file_name.endswith('.js'): full_paths[file_name] = full_path extractor = OrderedJSFilesExtractor(argv[1]) output = StringIO() for input_file_name in extractor.ordered_js_files: if not input_file_name in full_paths: print('A full path to %s isn\'t specified in command line. ' 'Probably, you have an obsolete script entry in %s' % (input_file_name, argv[1])) output.write('/* %s */\n\n' % input_file_name) input_file = open(full_path, 'r') output.write(input_file.read()) output.write('\n') input_file.close() output_file = open(output_file_name, 'w') output_file.write(output.getvalue()) output_file.close() output.close() # Touch output file directory to make sure that Xcode will copy # modified resource files. if sys.platform == 'darwin': output_dir_name = os.path.dirname(output_file_name) os.utime(output_dir_name, None)
476,292
def __init__(self): # If we have a testing.tmp directory, we didn't cleanup last time. if os.path.exists(BaseTool.TMP_DIR): shutil.rmtree(BaseTool.TMP_DIR) os.mkdir(BaseTool.TMP_DIR)
def __init__(self): # If we have a testing.tmp directory, we didn't cleanup last time. if os.path.exists(BaseTool.TMP_DIR): shutil.rmtree(BaseTool.TMP_DIR) os.mkdir(BaseTool.TMP_DIR)
476,293
def Main(self, args, check_sanity): """Call this to run through the whole process: Setup, Execute, Analyze""" start = datetime.datetime.now() retcode = -1 if self.Setup(args): retcode = self.RunTestsAndAnalyze(check_sanity) if not self._nocleanup_on_exit: shutil.rmtree(self.TMP_DIR, ignore_errors=True) self.Cleanup() else: logging.error("Setup failed") end = datetime.datetime.now() seconds = (end - start).seconds hours = seconds / 3600 seconds = seconds % 3600 minutes = seconds / 60 seconds = seconds % 60 logging.info("elapsed time: %02d:%02d:%02d" % (hours, minutes, seconds)) return retcode
def Main(self, args, check_sanity): """Call this to run through the whole process: Setup, Execute, Analyze""" start = datetime.datetime.now() retcode = -1 if self.Setup(args): retcode = self.RunTestsAndAnalyze(check_sanity) if not self._nocleanup_on_exit: shutil.rmtree(self.temp_dir, ignore_errors=True) self.Cleanup() else: logging.error("Setup failed") end = datetime.datetime.now() seconds = (end - start).seconds hours = seconds / 3600 seconds = seconds % 3600 minutes = seconds / 60 seconds = seconds % 60 logging.info("elapsed time: %02d:%02d:%02d" % (hours, minutes, seconds)) return retcode
476,294
def ToolCommand(self): """Get the valgrind command to run.""" # Note that self._args begins with the exe to be run. tool_name = self.ToolName()
def ToolCommand(self): """Get the valgrind command to run.""" # Note that self._args begins with the exe to be run. tool_name = self.ToolName()
476,295
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ (fd, indirect_fname) = tempfile.mkstemp(dir=self.TMP_DIR, prefix="browser_wrapper.", text=True) f = os.fdopen(fd, "w") f.write("#!/bin/sh\n") f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n') # Add the PID of the browser wrapper to the logfile names so we can # separate log files for different UI tests at the analyze stage. f.write(command.replace("%p", "$$.%p")) f.write(' "$@"\n') f.close() os.chmod(indirect_fname, stat.S_IRUSR|stat.S_IXUSR) os.putenv("BROWSER_WRAPPER", indirect_fname) logging.info('export BROWSER_WRAPPER=' + indirect_fname)
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ (fd, indirect_fname) = tempfile.mkstemp(dir=self.temp_dir, prefix="browser_wrapper.", text=True) f = os.fdopen(fd, "w") f.write("#!/bin/sh\n") f.write('echo "Started Valgrind wrapper for this test, PID=$$"\n') # Add the PID of the browser wrapper to the logfile names so we can # separate log files for different UI tests at the analyze stage. f.write(command.replace("%p", "$$.%p")) f.write(' "$@"\n') f.close() os.chmod(indirect_fname, stat.S_IRUSR|stat.S_IXUSR) os.putenv("BROWSER_WRAPPER", indirect_fname) logging.info('export BROWSER_WRAPPER=' + indirect_fname)
476,296
def GetAnalyzeResults(self, check_sanity=False): # Glob all the files in the "testing.tmp" directory filenames = glob.glob(self.TMP_DIR + "/" + self.ToolName() + ".*")
def GetAnalyzeResults(self, check_sanity=False): # Glob all the files in the "testing.tmp" directory filenames = glob.glob(self.TMP_DIR + "/" + self.ToolName() + ".*")
476,297
def ToolSpecificFlags(self): proc = ThreadSanitizerBase.ToolSpecificFlags(self) # On PIN, ThreadSanitizer has its own suppression mechanism # and --log-file flag which work exactly on Valgrind. suppression_count = 0 for suppression_file in self._options.suppressions: if os.path.exists(suppression_file): suppression_count += 1 proc += ["--suppressions=%s" % suppression_file]
def ToolSpecificFlags(self): proc = ThreadSanitizerBase.ToolSpecificFlags(self) # On PIN, ThreadSanitizer has its own suppression mechanism # and --log-file flag which work exactly on Valgrind. suppression_count = 0 for suppression_file in self._options.suppressions: if os.path.exists(suppression_file): suppression_count += 1 proc += ["--suppressions=%s" % suppression_file]
476,298
def Analyze(self, check_sanity=False): filenames = glob.glob(self.TMP_DIR + "/tsan.*") analyzer = tsan_analyze.TsanAnalyzer(self._source_dir) ret = analyzer.Report(filenames, check_sanity) if ret != 0: logging.info(self.INFO_MESSAGE) return ret
def Analyze(self, check_sanity=False): filenames = glob.glob(self.temp_dir + "/tsan.*") analyzer = tsan_analyze.TsanAnalyzer(self._source_dir) ret = analyzer.Report(filenames, check_sanity) if ret != 0: logging.info(self.INFO_MESSAGE) return ret
476,299