rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
proc += ["-logdir", (os.getcwd() + "\\" + self.TMP_DIR)]
proc += ["-logdir", (os.getcwd() + "\\" + self.temp_dir)]
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
09a4f701e8a53003ff9f43042db088214ef61594 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/09a4f701e8a53003ff9f43042db088214ef61594/valgrind_test.py
filenames = glob.glob(self.TMP_DIR + "/*/results.txt")
filenames = glob.glob(self.temp_dir + "/*/results.txt")
def Analyze(self, check_sanity=False): # Glob all the results files in the "testing.tmp" directory filenames = glob.glob(self.TMP_DIR + "/*/results.txt")
09a4f701e8a53003ff9f43042db088214ef61594 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/09a4f701e8a53003ff9f43042db088214ef61594/valgrind_test.py
O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype
O3D_PLUGIN_NPAPI_FILENAME = FLAGS.set_npapi_filename O3D_PLUGIN_NPAPI_MIMETYPE = FLAGS.set_npapi_mimetype O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID = FLAGS.set_activex_hostcontrol_clsid O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID = FLAGS.set_activex_typelib_clsid O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME = FLAGS.set_activex_hostcontrol_name O3D_PLUGIN_ACTIVEX_TYPELIB_NAME = FLAGS.set_activex_typelib_name
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
53e6a0ee72319153b1382a4c9bd670f06cbdcd77 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/53e6a0ee72319153b1382a4c9bd670f06cbdcd77/version_info.py
('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE),
('@@@PluginNpapiFilename@@@', O3D_PLUGIN_NPAPI_FILENAME), ('@@@PluginNpapiMimeType@@@', O3D_PLUGIN_NPAPI_MIMETYPE), ('@@@PluginActiveXHostControlClsid@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID), ('@@@PluginActiveXTypeLibClsid@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID), ('@@@PluginActiveXHostControlName@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME), ('@@@PluginActiveXTypeLibName@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_NAME),
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
53e6a0ee72319153b1382a4c9bd670f06cbdcd77 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/53e6a0ee72319153b1382a4c9bd670f06cbdcd77/version_info.py
if not os.path.exists(os.path.join(dir_name, ".svn")):
if not (os.path.exists(os.path.join(dir_name, ".svn")) or (dir_name in GIT_SOURCE_DIRECTORY)):
def ApplyDirectoryRules(existing_rules, dir_name): """Combines rules from the existing rules and the new directory. Any directory can contain a DEPS file. Toplevel DEPS files can contain module dependencies which are used by gclient. We use these, along with additional include rules and implicit rules for the given directory, to come up with a combined set of rules to apply for the directory. Args: existing_rules: The rules for the parent directory. We'll add-on to these. dir_name: The directory name that the deps file may live in (if it exists). This will also be used to generate the implicit rules. Returns: A tuple containing: (1) the combined set of rules to apply to the sub-tree, and (2) a list of all subdirectories that should NOT be checked, as specified in the DEPS file (if any). """ # Check for a .svn directory in this directory. This will tell us if it's # a source directory and should be checked. if not os.path.exists(os.path.join(dir_name, ".svn")): return (None, []) # Check the DEPS file in this directory. if VERBOSE: print "Applying rules from", dir_name def FromImpl(unused): pass # NOP function so "From" doesn't fail. class _VarImpl: def __init__(self, local_scope): self._local_scope = local_scope def Lookup(self, var_name): """Implements the Var syntax.""" if var_name in self._local_scope.get("vars", {}): return self._local_scope["vars"][var_name] raise Error("Var is not defined: %s" % var_name) local_scope = {} global_scope = {"From": FromImpl, "Var": _VarImpl(local_scope).Lookup} deps_file = os.path.join(dir_name, "DEPS") if os.path.exists(deps_file): execfile(deps_file, global_scope, local_scope) elif VERBOSE: print " No deps file found in", dir_name # Even if a DEPS file does not exist we still invoke ApplyRules # to apply the implicit "allow" rule for the current directory deps = local_scope.get(DEPS_VAR_NAME, {}) include_rules = local_scope.get(INCLUDE_RULES_VAR_NAME, []) skip_subdirs = local_scope.get(SKIP_SUBDIRS_VAR_NAME, []) return (ApplyRules(existing_rules, deps, include_rules, dir_name), skip_subdirs)
cd99caefe64b3149b85300ddb21aa965942ffd8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/cd99caefe64b3149b85300ddb21aa965942ffd8d/checkdeps.py
"""Test downloading with filenames containing special chars."""
"""Test downloading with filenames containing special chars. The files are created on the fly and cleaned after use. """
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4/downloads.py
test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
crazy_filenames = self._EvalDataFrom('crazy_filenames.txt') logging.info('Testing with %d crazy filenames' % len(crazy_filenames))
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4/downloads.py
downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(len(downloads), len(filenames))
def _CreateFile(name): """Create and fill the given file with some junk.""" fp = open(name, 'w') print >>fp, 'This is a junk file named %s. ' % name * 100 fp.close()
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4/downloads.py
for filename in filenames: downloaded_file = os.path.join(download_dir, filename) self.assertTrue(os.path.exists(downloaded_file)) self.assertEqual( self._ComputeMD5sum(downloaded_file), self._ComputeMD5sum(os.path.join(test_dir, filename))) os.path.exists(downloaded_file) and os.remove(downloaded_file)
temp_dir = tempfile.mkdtemp(prefix='download') try: for filename in crazy_filenames: file_path = os.path.join(temp_dir, filename) _CreateFile(file_path) file_url = self.GetFileURLForPath(file_path) downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
def testCrazyFilenames(self): """Test downloading with filenames containing special chars.""" download_dir = self.GetDownloadDirectory().value() test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(downloaded_file) file_url = self.GetFileURLForPath(os.path.join(test_dir, filename)) self._DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete()
e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4/downloads.py
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(len(downloads), len(crazy_filenames))
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4/downloads.py
Also verify that the download shelf showed up. """ test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') checksum_file = os.path.join(test_dir, 'a_zip_file.md5sum') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) golden_md5sum = urllib.urlopen(checksum_file).read() downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) self.NavigateToURL(file_url, 1, 0) self.WaitForAllDownloadsToComplete() self.assertTrue(self.IsDownloadShelfVisible(1)) self.assertFalse(self.IsDownloadShelfVisible(0)) self.assertTrue(os.path.exists(downloaded_pkg)) self.assertEqual(golden_md5sum, self._ComputeMD5sum(downloaded_pkg)) downloads = self.GetDownloadsInfo().Downloads() print downloads def testDownloadIncognitoAndRegular(self): """Download the same zip file in regular and incognito window and verify that it downloaded correctly with same file name appended with counter for the second download in regular window. Also verify that the download shelf showed up. """ test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') checksum_file = os.path.join(test_dir, 'a_zip_file.md5sum') file_url = 'file://%s' % os.path.join(test_dir, 'a_zip_file.zip') golden_md5sum = urllib.urlopen(checksum_file).read() downloaded_pkg_incog = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') downloaded_pkg_regul= os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file (1).zip') os.path.exists(downloaded_pkg_incog) and os.remove(downloaded_pkg_incog) os.path.exists(downloaded_pkg_regul) and os.remove(downloaded_pkg_regul) self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) self.NavigateToURL(file_url, 1, 0) self.NavigateToURL(file_url, 0, 0) self.WaitForAllDownloadsToComplete() self.assertTrue(self.WaitUntil(lambda: self.IsDownloadShelfVisible(1))) self.assertTrue(self.WaitUntil(lambda: self.IsDownloadShelfVisible(0))) self.assertTrue(os.path.exists(downloaded_pkg_incog)) self.assertEqual(golden_md5sum, self._ComputeMD5sum(downloaded_pkg_incog)) self.assertTrue(os.path.exists(downloaded_pkg_regul)) self.assertEqual(golden_md5sum, self._ComputeMD5sum(downloaded_pkg_regul))
for filename in crazy_filenames: downloaded_file = os.path.join(download_dir, filename) self.assertTrue(os.path.exists(downloaded_file)) self.assertEqual( self._ComputeMD5sum(downloaded_file), self._ComputeMD5sum(os.path.join(temp_dir, filename))) os.path.exists(downloaded_file) and os.remove(downloaded_file) finally: shutil.rmtree(temp_dir)
def testDownloadInIncognito(self): """Download a zip in incognito window and verify.
e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1b8e33cb6c10d0cf6ee2e6f2d1c76e388c613b4/downloads.py
path_utils.maybe_make_directory(self._options.results_directory)
os.makedirs(self._options.results_directory)
def __init__(self, options): self._options = options
eed2fefde6c7cfc2bfa8938d71b6c4c07233e768 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/eed2fefde6c7cfc2bfa8938d71b6c4c07233e768/test_output_xml_to_json.py
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)
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
55b7254dc5b6b90b20cbf7a79637027fbde0cb2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/55b7254dc5b6b90b20cbf7a79637027fbde0cb2d/testserver.py
startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json)
startup_pipe.write(struct.pack('@H', listen_port))
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port 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
55b7254dc5b6b90b20cbf7a79637027fbde0cb2d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/55b7254dc5b6b90b20cbf7a79637027fbde0cb2d/testserver.py
def TryKillingOldServer(port): for protocol in ["http", "https"]: try: urllib2.urlopen("%s://localhost:%d/kill" % (protocol, port)).read() print "Killed old server instance on port %d (via %s)" % (port, protocol) except urllib2.URLError: pass
def TryKillingOldServer(port): # Note that an HTTP /kill request to the FTP server has the effect of # killing it. for protocol in ["http", "https"]: try: urllib2.urlopen("%s://localhost:%d/kill" % (protocol, port)).read() print "Killed old server instance on port %d (via %s)" % (port, protocol) except urllib2.URLError: # Common case, indicates no server running. pass
a29ca9e3b6d8f2cab697a3642eb20c3cee39712a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a29ca9e3b6d8f2cab697a3642eb20c3cee39712a/testserver.py
TryKillingOldServer(port)
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port # Try to free up the port if there's an orphaned old instance. TryKillingOldServer(port) if options.server_type == SERVER_HTTP: if 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
a29ca9e3b6d8f2cab697a3642eb20c3cee39712a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a29ca9e3b6d8f2cab697a3642eb20c3cee39712a/testserver.py
def CombineLibraries(output, remove_re, inputs): '''Combines all the libraries and objects in inputs, while removing any object files that match remove_re. ''' removals = [] if remove_re: removals = CollectRemovals(remove_re, inputs) print removals args = ['lib.exe', '/out:%s' % output] args += ['/remove:%s' % obj for obj in removals] args += inputs Shell(*args)
e50dd358f64b8c3ec86ec31c7d6c81ef63983476 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e50dd358f64b8c3ec86ec31c7d6c81ef63983476/combine_libs.py
if sys.platform != 'win32':
if sys.platform != 'win32' and sys.platform != 'cygwin':
def Main(): '''Main function for this script''' parser = GetOptionParser() (opt, args) = parser.parse_args() output = opt.output remove = opt.remove if not output: parser.error('You must specify an output file') if not args: parser.error('You must specify at least one object or library') output = output.strip() remove = remove.strip() if remove: try: remove_re = re.compile(opt.remove) except: parser.error('%s is not a valid regular expression' % opt.remove) else: remove_re = None if sys.platform != 'win32': parser.error('this script only works on Windows for now') # If this is set, we can't capture lib.exe's output. if 'VS_UNICODE_OUTPUT' in os.environ: del os.environ['VS_UNICODE_OUTPUT'] CombineLibraries(output, remove_re, args)
e50dd358f64b8c3ec86ec31c7d6c81ef63983476 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e50dd358f64b8c3ec86ec31c7d6c81ef63983476/combine_libs.py
extractor = OrderedJSFilesExtractor(argv[1])
input_order_file_name = argv[1] extractor = OrderedJSFilesExtractor(input_order_file_name)
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() extractor = OrderedJSFilesExtractor(argv[1]) expander = PathExpander(argv[2:]) 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_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)
6b93abb6ebafb7f90dc0dd4c47dc432464923c80 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6b93abb6ebafb7f90dc0dd4c47dc432464923c80/concatenate_js_files.py
(input_file_name, input_file_name))
(input_file_name, input_order_file_name))
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() extractor = OrderedJSFilesExtractor(argv[1]) expander = PathExpander(argv[2:]) 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_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)
6b93abb6ebafb7f90dc0dd4c47dc432464923c80 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6b93abb6ebafb7f90dc0dd4c47dc432464923c80/concatenate_js_files.py
os.putenv("LD_LIBRARY_PATH", self._options.build_dir)
if (os.getenv("LD_LIBRARY_PATH")): os.putenv("LD_LIBRARY_PATH", "%s:%s" % (os.getenv("LD_LIBRARY_PATH"), self._options.build_dir)) else: os.putenv("LD_LIBRARY_PATH", self._options.build_dir)
def SimpleTest(self, module, name, heapcheck_test_args=None, cmd_args=None): '''Builds the command line and runs the specified test.
f4120bb913a60c41ad04bc2008ea41e9498bcd47 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f4120bb913a60c41ad04bc2008ea41e9498bcd47/chrome_tests.py
num_invalid_values = arg.GetNumInvalidValues()
num_invalid_values = arg.GetNumInvalidValues(func)
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues() for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
"""Writes the GLES2 Implemention declaration."""
"""Writes the GLES2 Implemention."""
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" 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(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
self.WriteGLES2ImplementationDeclaration(func, file)
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" 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(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
impl_func = func.GetInfo('impl_func') if impl_func == None or impl_func == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" typedef %s::Result Result;\n" % func.original_name) file.Write(" Result* result = GetResultAs<Result*>();\n") file.Write(" *result = 0;\n") arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return *result;\n") file.Write("}\n") file.Write("\n") else: self.WriteGLES2ImplementationDeclaration(func, file)
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
code = """%(return_type)s %(func_name)s(%(args)s) { helper_->SetBucketSize(kResultBucketId, 0); helper_->%(func_name)s(%(id_name)s, kResultBucketId); std::string str; if (GetBucketAsString(kResultBucketId, &str)) { GLsizei max_size = std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size()); if (%(length_name)s != NULL) { *%(length_name)s = max_size; } memcpy(%(dest_name)s, str.c_str(), max_size); %(dest_name)s[max_size] = '\\0'; } } """ args = func.GetOriginalArgs() file.Write(code % { 'return_type': func.return_type, 'func_name': func.original_name, 'args': func.MakeTypedOriginalArgString(""), 'id_name': args[0].name, 'bufsize_name': args[1].name, 'length_name': args[2].name, 'dest_name': args[3].name, })
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
file.Write("// TODO(gman): %s\n\n" % func.name) def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
valid_test = """ TEST_F(%(test_name)s, %(name)sValidArgs) { const char* kInfo = "hello"; const uint32 kBucketId = 123; SpecializedSetup<%(name)s, 0>(); %(expect_len_code)s EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)) .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)), SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1))); %(name)s cmd; cmd.Init(%(args)s); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId); ASSERT_TRUE(bucket != NULL); EXPECT_EQ(strlen(kInfo) + 1, bucket->size()); EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo, bucket->size())); } """ args = func.GetOriginalArgs() id_name = args[0].GetValidGLArg(0, 0) get_len_func = func.GetInfo('get_len_func') get_len_enum = func.GetInfo('get_len_enum') sub = { 'id_name': id_name, 'get_len_func': get_len_func, 'get_len_enum': get_len_enum, 'gl_args': '%s, strlen(kInfo) + 1, _, _' % args[0].GetValidGLArg(0, 0), 'args': '%s, kBucketId' % args[0].GetValidArg(0, 0), 'expect_len_code': '', } if get_len_func[0:2] == 'gl': sub['expect_len_code'] = ( " EXPECT_CALL(*gl_, %s(%s, %s, _))\n" " .WillOnce(SetArgumentPointee<2>(strlen(kInfo)));") % ( get_len_func[2:], id_name, get_len_enum) self.WriteValidUnitTest(func, file, valid_test, sub) invalid_test = """ TEST_F(%(test_name)s, %(name)sInvalidArgs) { const uint32 kBucketId = 123; EXPECT_CALL(*gl_, %(gl_func_name)s(_, _, _, _)) .Times(0); %(name)s cmd; cmd.Init(kInvalidClientId, kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); } """ self.WriteValidUnitTest(func, file, invalid_test)
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3]
args = func.GetCmdArgs() id_arg = args[0] bucket_arg = args[1] id_arg.WriteGetCode(file) bucket_arg.WriteGetCode(file) id_arg.WriteValidationCode(file) file.Write(" GLint len = 0;\n") file.Write(" %s(%s, %s, &len);\n" % ( func.GetInfo('get_len_func'), id_arg.name, func.GetInfo('get_len_enum'))) file.Write(" Bucket* bucket = CreateBucket(%s);\n" % bucket_arg.name) file.Write(" bucket->SetSize(len + 1);\n");
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
" %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file)
" %s(%s, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));\n" % (func.GetGLFunctionName(), id_arg.name))
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" return 0
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
pass def WriteClientSideValidationCode(self, file): """Writes the validation code for an argument.""" pass
def WriteValidationCode(self, file): """Writes the validation code for an argument.""" if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """overridden from Argument.""" return 1
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
"""returns an invalid value and expected parse result by index."""
"""overridden from Argument."""
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
"""Base calss for EnumArgument, IntArgument and BoolArgument"""
"""Base class for EnumArgument, IntArgument and BoolArgument"""
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] return len(invalid) return 0
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
return (invalid[index], "kNoError", self.gl_error) return ("---ERROR1---", "kNoError", self.gl_error)
def GetInvalidArg(self, offset, index): """returns an invalid value by index.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] num_invalid = len(invalid) if index >= num_invalid: index = num_invalid - 1 return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """Overridden from Argument.""" return 2
e1ea91c039be302d932f52103de15e4d66c29781 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e1ea91c039be302d932f52103de15e4d66c29781/build_gles2_cmd_buffer.py
if exclude is not None and exclude(name):
head, tail = os.path.split(name) if tail in ('.svn', '.git'):
def add(self, name, arcname=None, recursive=True, exclude=None): if exclude is not None and exclude(name): return tarfile.TarFile.add(self, name, arcname=arcname, recursive=recursive)
dc270379012f31fb73a1c60394ecc8248b494005 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/dc270379012f31fb73a1c60394ecc8248b494005/export_tarball.py
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True if not options.remove_nonessential_files: return False for nonessential_dir in NONESSENTIAL_DIRS: if path.startswith(os.path.join(GetSourceDirectory(), nonessential_dir)): return True return False
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
dc270379012f31fb73a1c60394ecc8248b494005 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/dc270379012f31fb73a1c60394ecc8248b494005/export_tarball.py
archive.add(GetSourceDirectory(), arcname=output_basename, exclude=ShouldExcludePath)
archive.add(GetSourceDirectory(), arcname=output_basename)
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
dc270379012f31fb73a1c60394ecc8248b494005 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/dc270379012f31fb73a1c60394ecc8248b494005/export_tarball.py
self.file.write(line1 + '\n')
nolint = '' if len(line1) > 80: nolint = ' // NOLINT' self.file.write(line1 + nolint + '\n')
def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] self.file.write(line1 + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = line[i] if not splitter == ',': indent = " " + indent self.__WriteLine(indent + line[i + 1:].lstrip(), True) return self.file.write(line) if ends_with_eol: self.file.write('\n')
f221119b3693149e42fd45c6ed62ad05af75564a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f221119b3693149e42fd45c6ed62ad05af75564a/build_gles2_cmd_buffer.py
self.file.write(line)
nolint = '' if len(line) > 80: nolint = ' // NOLINT' self.file.write(line + nolint)
def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] self.file.write(line1 + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = line[i] if not splitter == ',': indent = " " + indent self.__WriteLine(indent + line[i + 1:].lstrip(), True) return self.file.write(line) if ends_with_eol: self.file.write('\n')
f221119b3693149e42fd45c6ed62ad05af75564a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f221119b3693149e42fd45c6ed62ad05af75564a/build_gles2_cmd_buffer.py
subprocess.call(['taskkill.exe', '/PID', pid])
subprocess.call(['taskkill.exe', '/PID', str(pid)])
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', pid]) sys.exit(0)
edabcd69156d56093d5c167ac95d15713a2ad345 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/edabcd69156d56093d5c167ac95d15713a2ad345/coverage_posix.py
return self._retcode
return self.retcode()
def kill(self): """Kill our running process if needed. Wait for kill to complete.
edabcd69156d56093d5c167ac95d15713a2ad345 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/edabcd69156d56093d5c167ac95d15713a2ad345/coverage_posix.py
subprocess.call(['taskkill.exe', '/PID', self._process.pid]) self._retcode = self._process.wait() return self._retcode
subprocess.call(['taskkill.exe', '/PID', str(self._process.pid)]) return self.retcode()
def kill(self): """Kill our running process if needed. Wait for kill to complete.
edabcd69156d56093d5c167ac95d15713a2ad345 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/edabcd69156d56093d5c167ac95d15713a2ad345/coverage_posix.py
Kill it if needed. """ return self.kill()
Waits for process to die but does NOT kill it explicitly. """ if self._retcode == None: self._retcode = self._process.wait() return self._retcode
def retcode(self): """Return the return value of the subprocess.
edabcd69156d56093d5c167ac95d15713a2ad345 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/edabcd69156d56093d5c167ac95d15713a2ad345/coverage_posix.py
self.driver = WebDriver.WebDriver(WEBDRIVER_SERVER_URL, "chrome", "ANY");
self.driver = WebDriver.WebDriver(WEBDRIVER_SERVER_URL, "chrome", "ANY")
def setUp(self): global WEBDRIVER_SERVER_URL global WEBDRIVER_PROCESS WEBDRIVER_PROCESS = subprocess.Popen([WEBDRIVER_EXE, '--port=%d' % WEBDRIVER_PORT]) if WEBDRIVER_PROCESS == None: print "Chromium executable not found. The path used was: " print WEBDRIVER_EXE sys.exit(-1)
bebf64c3339c8ee243bc822c538d0afdffc4a4dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/bebf64c3339c8ee243bc822c538d0afdffc4a4dc/webdriver_remote_tests.py
"""Preforms a string search ignoring case""" def assertFind(self, text, search): text = string.lower(text) search = string.lower(search) self.assertNotEqual(-1, string.find(text, search))
def assertURL(self, url): u = self.driver.get_current_url() self.assertEqual(u, url)
bebf64c3339c8ee243bc822c538d0afdffc4a4dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/bebf64c3339c8ee243bc822c538d0afdffc4a4dc/webdriver_remote_tests.py
self.driver.back();
self.driver.back()
def testNavigation(self): # Loads two pages into chrome's navigation history. self.navigate(self.NEWS) self.navigate(self.SEARCH)
bebf64c3339c8ee243bc822c538d0afdffc4a4dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/bebf64c3339c8ee243bc822c538d0afdffc4a4dc/webdriver_remote_tests.py
self.WaitForInfobarCount(0)
def testNoTranslate(self): """Tests that a page isn't translated if the user declines translate.""" self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) self.SelectTranslateOption('decline_translation') self.WaitForInfobarCount(0) translate_info = self.GetTranslateInfo() self.assertEqual(self.spanish, translate_info['original_language']) self.assertFalse(translate_info['page_translated']) self.assertTrue(translate_info['can_translate_page']) # If the user goes to the site again, the infobar should drop down but # the page should not be automatically translated. self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) translate_info = self.GetTranslateInfo() self.assertFalse(translate_info['page_translated']) self.assertTrue(translate_info['can_translate_page']) self.assertTrue('translate_bar' in translate_info) self.assertEquals(self.before_translate, translate_info['translate_bar']['bar_state'])
529ad6c9f4949b77cde6d0abeeb1549e8b1b221d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/529ad6c9f4949b77cde6d0abeeb1549e8b1b221d/translate.py
platform enough.
platform enough. the function seems simple: "print output of child, kill it if there is no output by timeout. But it was tricky to get this right in a x-platform way (see warnings about deadlock on the python subprocess doc page).
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', str(pid)]) sys.exit(0)
0b67d8394464e33052775d7b89ff3d4a1016aa59 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0b67d8394464e33052775d7b89ff3d4a1016aa59/coverage_posix.py
LINE = 0 DIED = 1
PROGRESS = 0 DONE = 1
def TerminateSignalHandler(sig, stack): """When killed, try and kill our child processes.""" signal.signal(sig, signal.SIG_DFL) for pid in gChildPIDs: if 'kill' in os.__all__: # POSIX os.kill(pid, sig) else: subprocess.call(['taskkill.exe', '/PID', str(pid)]) sys.exit(0)
0b67d8394464e33052775d7b89ff3d4a1016aa59 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0b67d8394464e33052775d7b89ff3d4a1016aa59/coverage_posix.py
self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid)
stdout_file = tempfile.TemporaryFile()
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
0b67d8394464e33052775d7b89ff3d4a1016aa59 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0b67d8394464e33052775d7b89ff3d4a1016aa59/coverage_posix.py
while True: line = self._process.stdout.readline() if not line: break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass
self._process = subprocess.Popen(self._cmd, stdin=subprocess.PIPE, stdout=stdout_file, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: previous_tell = 0 self._retcode = None while self._retcode is None: self._retcode = self._process.poll() current_tell = stdout_file.tell() if current_tell > previous_tell: self._queue.put(RunProgramThread.PROGRESS) stdout_file.seek(previous_tell) print stdout_file.read(current_tell - previous_tell), previous_tell = current_tell time.sleep(0.5) stdout_file.flush() stdout_file.seek(previous_tell) print stdout_file.read(stdout_file.tell() - previous_tell) except IOError, e: logging.exception('%s', e) pass finally: stdout_file.close()
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
0b67d8394464e33052775d7b89ff3d4a1016aa59 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0b67d8394464e33052775d7b89ff3d4a1016aa59/coverage_posix.py
self._queue.put(RunProgramThread.DIED)
self._queue.put(RunProgramThread.DONE)
def run(self): self._process = subprocess.Popen(self._cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) gChildPIDs.append(self._process.pid) try: while True: line = self._process.stdout.readline() if not line: # EOF break print line, self._queue.put(RunProgramThread.LINE, True) except IOError: pass # If we get here the process is dead. gChildPIDs.remove(self._process.pid) self._queue.put(RunProgramThread.DIED)
0b67d8394464e33052775d7b89ff3d4a1016aa59 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0b67d8394464e33052775d7b89ff3d4a1016aa59/coverage_posix.py
if x == RunProgramThread.DIED:
if x == RunProgramThread.DONE:
def RunUntilCompletion(self, timeout): """Run thread until completion or timeout (in seconds).
0b67d8394464e33052775d7b89ff3d4a1016aa59 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0b67d8394464e33052775d7b89ff3d4a1016aa59/coverage_posix.py
'-m', os.path.join(self._web_socket_tests, 'handler_map.txt'),
def Start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.IsRunning(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
fec7da233ce09b1bc5d0b1b610c24e7f76eb3cb7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/fec7da233ce09b1bc5d0b1b610c24e7f76eb3cb7/websocket_server.py
impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
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.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb/build_gles2_cmd_buffer.py
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)):
if func.can_auto_generate and (impl_func == None or impl_func == True):
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)
80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb/build_gles2_cmd_buffer.py
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) code = """ if (IsReservedId(%(id)s)) { SetGLError(GL_INVALID_OPERATION); return; } if (%(id)s != 0) { id_allocator_.MarkAsUsed(%(id)s); } helper_->%(name)s(%(arg_string)s); } """ file.Write(code % { 'name': func.name, 'arg_string': func.MakeOriginalArgString(""), 'id': func.GetOriginalArgs()[1].name, }) else: self.WriteGLES2ImplementationDeclaration(func, file)
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb/build_gles2_cmd_buffer.py
impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: 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")
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.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: 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")
80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb/build_gles2_cmd_buffer.py
impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: 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;
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.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: 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;
80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb/build_gles2_cmd_buffer.py
helper_->%(func_name)s(%(arg_string)s, result_shm_id(), result_shm_offset());
helper_->%(func_name)s(%(arg_string)s, result_shm_id(), result_shm_offset());
code = """ typedef %(func_name)s::Result Result;
80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb/build_gles2_cmd_buffer.py
file.Write(code % { 'func_name': func.name, 'arg_string': arg_string, })
file.Write(code % { 'func_name': func.name, 'arg_string': arg_string, })
code = """ typedef %(func_name)s::Result Result;
80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/80f44b4b6ccc8da50c7b9a9923de5fa83b838bfb/build_gles2_cmd_buffer.py
main()
exit(main())
def main(): cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[0])))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
3d6a7ab7f7d280e7876fe892cfe6522702e3c2a6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/3d6a7ab7f7d280e7876fe892cfe6522702e3c2a6/run_webkit_tests.py
self.nonce = None
self.nonce_time = None
def serve_forever(self): self.stop = False self.nonce = None while not self.stop: self.handle_request() self.socket.close()
5fd949eabe62eab5418762466dd6beb6d808908e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5fd949eabe62eab5418762466dd6beb6d808908e/testserver.py
"""This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
"""This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed. A stale response is sent iff "stale" is present in the request path. """
def AuthDigestHandler(self): """This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
5fd949eabe62eab5418762466dd6beb6d808908e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5fd949eabe62eab5418762466dd6beb6d808908e/testserver.py
nonce_life = 10 stale = False if (not self.server.nonce or (time.time() - self.server.nonce_time > nonce_life)): if self.server.nonce: stale = True self.server.nonce_time = time.time() self.server.nonce = \ _new_md5(time.ctime(self.server.nonce_time) + 'privatekey').hexdigest() nonce = self.server.nonce
stale = 'stale' in self.path nonce = self.GetNonce(force_reset=stale)
def AuthDigestHandler(self): """This handler tests 'Digest' authentication. It just sends a page with title 'user/pass' if you succeed."""
5fd949eabe62eab5418762466dd6beb6d808908e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5fd949eabe62eab5418762466dd6beb6d808908e/testserver.py
'resource_type': func.name[3:-1].lower()
'resource_type': func.name[3:-1].lower(), 'count_name': func.GetOriginalArgs()[0].name,
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
37bbaa22acd3239013124bc95f2dc6c88baf2d0e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/37bbaa22acd3239013124bc95f2dc6c88baf2d0e/build_gles2_cmd_buffer.py
file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" %s_id_handler_->FreeIds(%s);\n" % (func.name[6:-1].lower(), func.MakeOriginalArgString(""))) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
code = """%(return_type)s %(name)s(%(typed_args)s) { if (%(count_name)s < 0) { SetGLError(GL_INVALID_VALUE, "gl%(name)s: n < 0"); return; } %(resource_type)s_id_handler_->FreeIds(%(args)s); helper_->%(name)sImmediate(%(args)s); } """ file.Write(code % { 'return_type': func.return_type, 'name': func.original_name, 'typed_args': func.MakeTypedOriginalArgString(""), 'args': func.MakeOriginalArgString(""), 'resource_type': func.name[6:-1].lower(), 'count_name': func.GetOriginalArgs()[0].name, })
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" %s_id_handler_->FreeIds(%s);\n" % (func.name[6:-1].lower(), func.MakeOriginalArgString(""))) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
37bbaa22acd3239013124bc95f2dc6c88baf2d0e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/37bbaa22acd3239013124bc95f2dc6c88baf2d0e/build_gles2_cmd_buffer.py
GLsizei num_values = util_.GLGetNumValuesReturned(pname); if (num_values == 0) { SetGLError(GL_INVALID_ENUM, "gl%(func_name)s: invalid enum"); return error::kNoError; }
GLsizei num_values = GetNumValuesReturnedForGLGet(pname, &num_values);
code = """ typedef %(func_name)s::Result Result;
37bbaa22acd3239013124bc95f2dc6c88baf2d0e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/37bbaa22acd3239013124bc95f2dc6c88baf2d0e/build_gles2_cmd_buffer.py
json_file.close()
finally: json_file.close()
def parse_json_file(path, encoding="utf-8"): """ Load the specified file and parse it as JSON. Args: path: Path to a file containing JSON-encoded data. encoding: Encoding used in the file. Defaults to utf-8. Returns: A Python object representing the data encoded in the file. Raises: Exception: If the file could not be read or its contents could not be parsed as JSON data. """ try: json_file = open(path, 'r') except IOError, msg: raise Exception("Failed to read the file at %s: %s" % (path, msg)) try: json_obj = json.load(json_file, encoding) except ValueError, msg: raise Exception("Failed to parse JSON out of file %s: %s" % (path, msg)) json_file.close() return json_obj
0132ee82dad01d9df0964ce9935f040e4d91b175 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0132ee82dad01d9df0964ce9935f040e4d91b175/directory.py
O3D_PLUGIN_NAME = 'O3D Plugin'
O3D_PLUGIN_NAME = FLAGS.set_name
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
f501b1e180bca772d448ae6205e0d93a79ecc387 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f501b1e180bca772d448ae6205e0d93a79ecc387/version_info.py
O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME,
O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME,
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
f501b1e180bca772d448ae6205e0d93a79ecc387 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f501b1e180bca772d448ae6205e0d93a79ecc387/version_info.py
O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0)
O3D_PLUGIN_MIME_TYPE = FLAGS.set_mimetype
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
f501b1e180bca772d448ae6205e0d93a79ecc387 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f501b1e180bca772d448ae6205e0d93a79ecc387/version_info.py
sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = 'O3D Plugin' O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_MIME_TYPE = 'application/vnd.o3d.auto' if FLAGS.name: print '%s' % O3D_PLUGIN_NAME sys.exit(0) if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.mimetype: print '%s' % O3D_PLUGIN_MIME_TYPE sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginMimeType@@@', O3D_PLUGIN_MIME_TYPE), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
f501b1e180bca772d448ae6205e0d93a79ecc387 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f501b1e180bca772d448ae6205e0d93a79ecc387/version_info.py
if not cur_leak_signature: print 'Missing leak signature for the following stack: ' for frame in cur_stack: print ' ' + frame print 'Aborting...' return 3
def Analyze(self, log_lines, check_sanity=False): """Analyzes the app's output and applies suppressions to the reports.
7698c4287d88a0652cddd973958ceea78ec0fa17 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/7698c4287d88a0652cddd973958ceea78ec0fa17/heapcheck_test.py
'third_party', 'WebKit', 'WebKitTools', 'Scripts', 'webkitpy', 'thirdparty', 'pywebsocket')
'third_party', 'WebKit', 'WebKitTools', 'pywebsocket')
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
9c5e6b0f70ceea0c70b1fa4d891f632ed635f80a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9c5e6b0f70ceea0c70b1fa4d891f632ed635f80a/websocket_server.py
'third_party', 'WebKit', 'WebKitTools', 'Scripts', 'webkitpy', 'thirdparty', 'pywebsocket', 'mod_pywebsocket', 'standalone.py')
'third_party', 'WebKit', 'WebKitTools', 'pywebsocket', 'mod_pywebsocket', 'standalone.py')
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
9c5e6b0f70ceea0c70b1fa4d891f632ed635f80a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9c5e6b0f70ceea0c70b1fa4d891f632ed635f80a/websocket_server.py
'<a href="http://localhost:8888/echo">back to referring page</a></div>'
'<a href="/echo">back to referring page</a></div>'
def EchoAllHandler(self): """This handler yields a (more) human-readable page listing information about the request header & contents."""
5b712c834b0f706d7c68e57ffa10c929ee7c5a7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b712c834b0f706d7c68e57ffa10c929ee7c5a7b/testserver.py
print 'HTTPS server started on port %d...' % port
print 'HTTPS server started on port %d...' % server.server_port
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port 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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
5b712c834b0f706d7c68e57ffa10c929ee7c5a7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b712c834b0f706d7c68e57ffa10c929ee7c5a7b/testserver.py
print 'HTTP server started on port %d...' % port
print 'HTTP server started on port %d...' % server.server_port
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port 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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
5b712c834b0f706d7c68e57ffa10c929ee7c5a7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b712c834b0f706d7c68e57ffa10c929ee7c5a7b/testserver.py
listen_port = server.server_port
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port 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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
5b712c834b0f706d7c68e57ffa10c929ee7c5a7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b712c834b0f706d7c68e57ffa10c929ee7c5a7b/testserver.py
print 'FTP server started on port %d...' % port
listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port 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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
5b712c834b0f706d7c68e57ffa10c929ee7c5a7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b712c834b0f706d7c68e57ffa10c929ee7c5a7b/testserver.py
startup_pipe.write("READY")
startup_pipe.write(struct.pack('@H', listen_port))
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port 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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
5b712c834b0f706d7c68e57ffa10c929ee7c5a7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b712c834b0f706d7c68e57ffa10c929ee7c5a7b/testserver.py
option_parser.add_option('', '--port', default='8888', type='int', help='Port used by the server.')
option_parser.add_option('', '--port', default='0', type='int', help='Port used by the server. If unspecified, the ' 'server will listen on an ephemeral port.')
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port 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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
5b712c834b0f706d7c68e57ffa10c929ee7c5a7b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b712c834b0f706d7c68e57ffa10c929ee7c5a7b/testserver.py
os.mkdir(self._options.results_directory)
path_utils.maybe_make_directory(self._options.results_directory)
def __init__(self, options): self._options = options
4ea07c2d2aa22ded66491b1bd7ff838aab0a70c5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4ea07c2d2aa22ded66491b1bd7ff838aab0a70c5/test_output_xml_to_json.py
"""Download a file from downloads data directory.
"""Download a file from downloads data directory, in first tab first window.
def DownloadFileFromDownloadsDataDir(test, file_name): """Download a file from downloads data directory. Args: test: derived from pyauto.PyUITest - base class for UI test cases file_name: name of file to download """ download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads') downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), file_name) # Check if file already exists. If so then delete it. if os.path.exists(downloaded_pkg): RemoveDownloadedTestFile(test, file_name) test.WaitForAllDownloadsToComplete()
4f5f35c401ade94e518a35c77a029b72f22b9c5d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4f5f35c401ade94e518a35c77a029b72f22b9c5d/test_utils.py
download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads')
file_url = test.GetFileURLForDataPath(os.path.join('downloads', file_name))
def DownloadFileFromDownloadsDataDir(test, file_name): """Download a file from downloads data directory. Args: test: derived from pyauto.PyUITest - base class for UI test cases file_name: name of file to download """ download_dir = os.path.join(os.path.abspath(test.DataDir()), 'downloads') downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(), file_name) # Check if file already exists. If so then delete it. if os.path.exists(downloaded_pkg): RemoveDownloadedTestFile(test, file_name) test.WaitForAllDownloadsToComplete()
4f5f35c401ade94e518a35c77a029b72f22b9c5d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4f5f35c401ade94e518a35c77a029b72f22b9c5d/test_utils.py
A notification can be canceled even if it has not been shown yet.
This function should NOT be called until |WaitForNotificationCount| has been used to verify the notification is showing. This function cannot be used to cancel a notification that is in the display queue.
def _CancelNotification(self, notification_id, tab_index=0, windex=0): """Cancels a notification with the given id.
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
self._CallJavascriptFunc(
msg = self._CallJavascriptFunc(
def _CancelNotification(self, notification_id, tab_index=0, windex=0): """Cancels a notification with the given id.
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
self.assertEquals(len(self.GetActiveNotifications()), 1)
self.assertEquals(1, len(self.GetActiveNotifications()))
def testCreateSimpleNotification(self): """Creates a simple notification.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateSimpleNotification('no_such_file.png', 'My Title', 'My Body') self.assertEquals(len(self.GetActiveNotifications()), 1) notification = self.GetActiveNotifications()[0] html_data = urllib.unquote(notification['content_url']) self.assertTrue('no_such_file.png' in html_data) self.assertTrue('My Title' in html_data) self.assertTrue('My Body' in html_data)
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
self.assertEquals(len(self.GetActiveNotifications()), 1)
self.assertEquals(1, len(self.GetActiveNotifications()))
def testCreateHTMLNotification(self): """Creates an HTML notification using a fake url.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertEquals(len(self.GetActiveNotifications()), 1) notification = self.GetActiveNotifications()[0] self.assertEquals(self.NO_SUCH_URL, notification['content_url']) self.assertEquals('', notification['display_source']) self.assertEquals('file:///', notification['origin_url'])
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
self.assertEquals(len(self.GetActiveNotifications()), 0)
self.assertFalse(self.GetActiveNotifications())
def testCloseNotification(self): """Creates a notification and closes it.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self.CloseNotification(0) self.assertEquals(len(self.GetActiveNotifications()), 0)
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
self.assertEquals(len(self.GetActiveNotifications()), 0)
self.assertFalse(self.GetActiveNotifications())
def testCancelNotification(self): """Creates a notification and cancels it in the origin page.""" self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) note_id = self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertNotEquals(-1, note_id) self._CancelNotification(note_id) self.assertEquals(len(self.GetActiveNotifications()), 0)
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
self.assertEquals(len(self.GetActiveNotifications()), 0)
self.assertFalse(self.GetActiveNotifications())
def testPermissionInfobarAppears(self): """Requests notification privileges and verifies the infobar appears.""" self.NavigateToURL(self.TEST_PAGE_URL) self._RequestPermission() self.assertTrue(self.WaitForInfobarCount(1)) self.assertEquals(len(self.GetActiveNotifications()), 0) self._VerifyInfobar('') # file:/// origins are blank
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
self.assertEquals(len(self.GetActiveNotifications()), 0)
self.assertFalse(self.GetActiveNotifications())
def testAllowOnPermissionInfobar(self): """Tries to create a notification and clicks allow on the infobar.""" self.NavigateToURL(self.TEST_PAGE_URL) # This notification should not be shown because we don't have permission. self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertEquals(len(self.GetActiveNotifications()), 0)
435c54d0bfc12ea06eae2143c91812f1ae4112b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/435c54d0bfc12ea06eae2143c91812f1ae4112b7/notifications.py
ssl_client_auth, ssl_client_cas):
ssl_client_auth, ssl_client_cas, ssl_bulk_ciphers):
def __init__(self, server_address, request_hander_class, cert_path, ssl_client_auth, ssl_client_cas): 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) self.ssl_client_auth = ssl_client_auth self.ssl_client_cas = [] for ca_file in ssl_client_cas: s = open(ca_file).read() x509 = tlslite.api.X509() x509.parse(s) self.ssl_client_cas.append(x509.subject)
9b0dc7da8207eb16eb77a5e76830fb0dd099e78f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9b0dc7da8207eb16eb77a5e76830fb0dd099e78f/testserver.py
options.ssl_client_auth, options.ssl_client_ca)
options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher)
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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
9b0dc7da8207eb16eb77a5e76830fb0dd099e78f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9b0dc7da8207eb16eb77a5e76830fb0dd099e78f/testserver.py
'should indicate that it supports the CA contained ' 'in the specified certificate file')
'should include the CA named in the subject of ' 'the DER-encoded certificate contained in the ' 'specified file. This option may appear multiple ' 'times, indicating multiple CA names should be ' 'sent in the request.') option_parser.add_option('', '--ssl-bulk-cipher', action='append', help='Specify the bulk encryption algorithm(s)' 'that will be accepted by the SSL server. Valid ' 'values are "aes256", "aes128", "3des", "rc4". If ' 'omitted, all algorithms will be used. This ' 'option may appear multiple times, indicating ' 'multiple algorithms should be enabled.');
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) 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 # 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) print 'FTP server started on port %d...' % 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") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
9b0dc7da8207eb16eb77a5e76830fb0dd099e78f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9b0dc7da8207eb16eb77a5e76830fb0dd099e78f/testserver.py