rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
return valgrind_test.RunTool(cmd)
return valgrind_test.RunTool(cmd, "layout")
def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build the ginormous commandline in 'cmd'. # It's going to be roughly # python valgrind_test.py ... python run_webkit_tests.py ... # but we'll use the --indirect flag to valgrind_test.py # to avoid valgrinding python. # Start by building the valgrind_test.py commandline. cmd = self._DefaultCommand("webkit") cmd.append("--trace_children") cmd.append("--indirect") # Now build script_cmd, the run_webkits_tests.py commandline # Store each chunk in its own directory so that we can find the data later chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num) test_shell = os.path.join(self._options.build_dir, "test_shell") out_dir = os.path.join(google.path_utils.ScriptDir(), "latest") out_dir = os.path.join(out_dir, chunk_dir) if os.path.exists(out_dir): old_files = glob.glob(os.path.join(out_dir, "*.txt")) for f in old_files: os.remove(f) else: os.makedirs(out_dir) script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py") script_cmd = ["python", script, "--run-singly", "-v", "--noshow-results", "--time-out-ms=200000", "--nocheck-sys-deps"] # Pass build mode to run_webkit_tests.py. We aren't passed it directly, # so parse it out of build_dir. run_webkit_tests.py can only handle # the two values "Release" and "Debug". # TODO(Hercules): unify how all our scripts pass around build mode # (--mode / --target / --build_dir / --debug) if self._options.build_dir.endswith("Debug"): script_cmd.append("--debug"); if (chunk_size > 0): script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size)) if len(self._args): # if the arg is a txt file, then treat it as a list of tests if os.path.isfile(self._args[0]) and self._args[0][-4:] == ".txt": script_cmd.append("--test-list=%s" % self._args[0]) else: script_cmd.extend(self._args) self._ReadGtestFilterFile("layout", script_cmd) # Now run script_cmd with the wrapper in cmd cmd.extend(["--"]) cmd.extend(script_cmd) return valgrind_test.RunTool(cmd)
4ec5079fe12c534bccefbad831e9a8f208490e86 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4ec5079fe12c534bccefbad831e9a8f208490e86/chrome_tests.py
def WriteGLES2ImplementationImpl(self, func, file): """Writes the GLES2 Implemention definition.""" if not func.can_auto_generate: file.Write("%s GLES2Implementation::%s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) if not func.return_type == "void": file.Write(" return 0;\n") file.Write("}\n") file.Write("\n")
def WriteGLES2ImplementationImpl(self, func, file): """Writes the GLES2 Implemention definition.""" if not func.can_auto_generate: file.Write("%s GLES2Implementation::%s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) if not func.return_type == "void": file.Write(" return 0;\n") file.Write("}\n") file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" MakeIds(%s);\n" % func.MakeOriginalArgString("")) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" GLuint client_id;\n") file.Write(" MakeIds(1, &client_id);\n") file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeCmdArgString(""))) file.Write(" return client_id;\n") file.Write("}\n") file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) all_but_last_args = func.GetOriginalArgs()[:-1] arg_string = ( ", ".join(["%s" % arg.name for arg in all_but_last_args])) file.Write(" helper_->%s(%s, result_shm_id(), result_shm_offset());\n" % (func.name, arg_string)) file.Write(" WaitForCmd();\n") file.Write(" GLsizei num_values = util_.GLGetNumValuesReturned(pname);\n") file.Write( " DCHECK_LE(num_values * sizeof(*params), kMaxSizeOfSimpleResult);\n") file.Write( " memcpy(params, result_buffer_, num_values * sizeof(*params));\n") file.Write("}\n") file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" // TODO(gman): This needs to change to use SendString.\n") file.Write(" helper_->%sImmediate(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
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")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, file): """Writes the GLES2 Implemention definition.""" self.type_handler.WriteGLES2ImplementationImpl(self, file)
def WriteGLES2ImplementationImpl(self, file): """Writes the GLES2 Implemention definition.""" self.type_handler.WriteGLES2ImplementationImpl(self, file)
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CHeaderWriter( filename, "// A class to emluate GLES2 over command buffers.\n") file.Write( " self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n") self.WriteNamespaceClose(file) file.Close()
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CHeaderWriter( filename, "// A class to emluate GLES2 over command buffers.\n") file.Write( "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n")
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
if options.generate_implementation_templates: gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h")
def main(argv): """This is the main function.""" parser = OptionParser() parser.add_option( "-g", "--generate-implementation-templates", action="store_true", help="generates files that are generally hand edited..") parser.add_option( "--generate-command-id-tests", action="store_true", help="generate tests for commands ids. Commands MUST not change ID!") parser.add_option( "-v", "--verbose", action="store_true", help="prints more output.") (options, args) = parser.parse_args(args=argv) gen = GLGenerator(options.verbose) gen.ParseGLH("common/GLES2/gl2.h") gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") gen.WriteFormat("common/gles2_cmd_format_autogen.h") gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_autogen.h") gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") gen.WriteServiceUtilsImplementation( "service/gles2_cmd_validation_implementation_autogen.h") if options.generate_implementation_templates: gen.WriteGLES2ImplementationImpl("client/gles2_implementation_gen.h") if options.generate_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") if gen.errors > 0: print "%d errors" % gen.errors sys.exit(1)
b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b4a937e280d5e05e48c8a7abf6caf1fdf5448b1b/build_gles2_cmd_buffer.py
_sync_handler = chromiumsync.TestServer()
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.KillHandler, self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.CacheProxyRevalidateHandler, self.CachePrivateHandler, self.CachePublicHandler, self.CacheSMaxAgeHandler, self.CacheMustRevalidateHandler, self.CacheMustRevalidateMaxAgeHandler, self.CacheNoStoreHandler, self.CacheNoStoreMaxAgeHandler, self.CacheNoTransformHandler, self.DownloadHandler, self.DownloadFinishHandler, self.EchoHeader, self.EchoHeaderOverride, self.EchoAllHandler, self.FileHandler, self.RealFileWithCommonHeaderHandler, self.RealBZ2FileWithCommonHeaderHandler, self.SetCookieHandler, self.AuthBasicHandler, self.AuthDigestHandler, self.SlowServerHandler, self.ContentTypeHandler, self.ServerRedirectHandler, self.ClientRedirectHandler, self.ChromiumSyncTimeHandler, self.MultipartHandler, self.DefaultResponseHandler] self._post_handlers = [ self.WriteFile, self.EchoTitleHandler, self.EchoAllHandler, self.ChromiumSyncCommandHandler, self.EchoHandler] + self._get_handlers self._put_handlers = [ self.WriteFile, self.EchoTitleHandler, self.EchoAllHandler, self.EchoHandler] + self._get_handlers
76e099c09f010d2c85932bdd4508baf5da07d46d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/76e099c09f010d2c85932bdd4508baf5da07d46d/testserver.py
http_response, raw_reply = self._sync_handler.HandleCommand(raw_request)
if not self.server._sync_handler: import chromiumsync self.server._sync_handler = chromiumsync.TestServer() http_response, raw_reply = self.server._sync_handler.HandleCommand( raw_request)
def ChromiumSyncCommandHandler(self): """Handle a chromiumsync command arriving via http.
76e099c09f010d2c85932bdd4508baf5da07d46d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/76e099c09f010d2c85932bdd4508baf5da07d46d/testserver.py
"""Inspects the given stanza and changes the handshake state if needed. Called when a stanza is received from the client. Inspects the stanza to make sure it has the expected attributes given the current state, advances the state if needed, and sends a reply to the client if needed. """ def ExpectStanza(stanza, name): if stanza.tagName != name: raise UnexpectedXml(stanza) def ExpectIq(stanza, type, name): ExpectStanza(stanza, 'iq') if (stanza.getAttribute('type') != type or stanza.firstChild.tagName != name): raise UnexpectedXml(stanza) def GetStanzaId(stanza): return stanza.getAttribute('id') def HandleStream(stanza): ExpectStanza(stanza, 'stream:stream') domain = stanza.getAttribute('to') if domain: self._domain = domain SendStreamData() def SendStreamData(): next_id = self._id_generator.GetNextId() stream_data = self._STREAM_DATA % (self._domain, next_id) self._connection.SendData(stream_data) def GetUserDomain(stanza): encoded_username_password = stanza.firstChild.data username_password = base64.b64decode(encoded_username_password) (_, username_domain, _) = username_password.split('\0') at_pos = username_domain.find('@') if at_pos != -1: username = username_domain[:at_pos] domain = username_domain[at_pos+1:] else: username = username_domain domain = self._domain return (username, domain) if self._state == self._INITIAL_STREAM_NEEDED: HandleStream(stanza) self._connection.SendStanza(self._AUTH_STANZA, False) self._state = self._AUTH_NEEDED elif self._state == self._AUTH_NEEDED: ExpectStanza(stanza, 'auth') (self._username, self._domain) = GetUserDomain(stanza) self._connection.SendStanza(self._AUTH_SUCCESS_STANZA, False) self._state = self._AUTH_STREAM_NEEDED elif self._state == self._AUTH_STREAM_NEEDED: HandleStream(stanza) self._connection.SendStanza(self._BIND_STANZA, False) self._state = self._BIND_NEEDED elif self._state == self._BIND_NEEDED: ExpectIq(stanza, 'set', 'bind') stanza_id = GetStanzaId(stanza) resource_element = stanza.getElementsByTagName('resource')[0] resource = resource_element.firstChild.data full_resource = '%s.%s' % (self._resource_prefix, resource) response = CloneXml(self._BIND_RESULT_STANZA) response.setAttribute('id', stanza_id) self._jid = Jid(self._username, self._domain, full_resource) jid_text = response.parentNode.createTextNode(str(self._jid)) response.getElementsByTagName('jid')[0].appendChild(jid_text) self._connection.SendStanza(response) self._state = self._SESSION_NEEDED elif self._state == self._SESSION_NEEDED: ExpectIq(stanza, 'set', 'session') stanza_id = GetStanzaId(stanza) xml = CloneXml(self._IQ_RESPONSE_STANZA) xml.setAttribute('id', stanza_id) self._connection.SendStanza(xml) self._state = self._FINISHED self._connection.HandshakeDone(self._jid) def AddrString(addr): return '%s:%d' % addr class XmppConnection(asynchat.async_chat): """A single XMPP client connection. This class handles the connection to a single XMPP client (via a socket). It does the XMPP handshake and also implements the (old) Google notification protocol. """ _NOTIFIER_STANZA = ParseXml( """<iq from="" to="" id="" type=""> <not:getAll xmlns:not="google:notifier"> <Result xmlns=""/> </not:getAll> </iq> """) def __init__(self, sock, socket_map, connections, addr): """Starts up the xmpp connection. Args: sock: The socket to the client. socket_map: A map from sockets to their owning objects. connections: The set of handshake-completed connections. addr: The host/port of the client. """ asynchat.async_chat.__init__(self, sock) self.set_terminator(None) self._socket_map = socket_map self._socket_map[self.fileno()] = self self._connections = connections self._parser = StanzaParser(self) self._jid = None self._addr = addr addr_str = AddrString(self._addr) self._id_generator = IdGenerator(addr_str) self._handshake_task = ( HandshakeTask(self, self._id_generator, addr_str)) print 'Starting connection to %s' % self def __str__(self): if self._jid: return str(self._jid)
self.stanzas.append(stanza.toxml()) def testBasic(self): parser = xmppserver.StanzaParser(self) parser.FeedString('<foo') self.assertEqual(len(self.stanzas), 0) parser.FeedString('/><bar></bar>') self.assertEqual(self.stanzas[0], '<foo/>') self.assertEqual(self.stanzas[1], '<bar/>') def testStream(self): parser = xmppserver.StanzaParser(self) parser.FeedString('<stream') self.assertEqual(len(self.stanzas), 0) parser.FeedString(':stream foo="bar" xmlns:stream="baz">') self.assertEqual(self.stanzas[0], '<stream:stream foo="bar" xmlns:stream="baz"/>') def testNested(self): parser = xmppserver.StanzaParser(self) parser.FeedString('<foo') self.assertEqual(len(self.stanzas), 0) parser.FeedString(' bar="baz"') parser.FeedString('><baz/><blah>meh</blah></foo>') self.assertEqual(self.stanzas[0], '<foo bar="baz"><baz/><blah>meh</blah></foo>') class JidTest(unittest.TestCase): def testBasic(self): jid = xmppserver.Jid('foo', 'bar.com') self.assertEqual(str(jid), '[email protected]') def testResource(self): jid = xmppserver.Jid('foo', 'bar.com', 'resource') self.assertEqual(str(jid), '[email protected]/resource') def testGetBareJid(self): jid = xmppserver.Jid('foo', 'bar.com', 'resource') self.assertEqual(str(jid.GetBareJid()), '[email protected]') class IdGeneratorTest(unittest.TestCase): def testBasic(self): id_generator = xmppserver.IdGenerator('foo') for i in xrange(0, 100): self.assertEqual('foo.%d' % i, id_generator.GetNextId()) class HandshakeTaskTest(unittest.TestCase): def setUp(self): self.data_received = 0 def SendData(self, _): self.data_received += 1 def SendStanza(self, _, unused=True): self.data_received += 1 def HandshakeDone(self, jid): self.jid = jid def DoHandshake(self, resource_prefix, resource, username, initial_stream_domain, auth_domain, auth_stream_domain): self.data_received = 0 id_generator = xmppserver.IdGenerator('foo') handshake_task = ( xmppserver.HandshakeTask(self, id_generator, resource_prefix)) stream_xml = xmppserver.ParseXml('<stream:stream xmlns:stream="foo"/>') stream_xml.setAttribute('to', initial_stream_domain) self.assertEqual(self.data_received, 0) handshake_task.FeedStanza(stream_xml) self.assertEqual(self.data_received, 2) if auth_domain: username_domain = '%s@%s' % (username, auth_domain)
def FeedStanza(self, stanza): """Inspects the given stanza and changes the handshake state if needed.
fdb367a56d2ae718b9cd24f5f41b343a363d319e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/fdb367a56d2ae718b9cd24f5f41b343a363d319e/xmppserver_test.py
return AddrString(self._addr) def collect_incoming_data(self, data): self._parser.FeedString(data) def found_terminator(self): asynchat.async_chat.found_terminator(self) def handle_close(self): print "Closing connection to %s" % self self._connections.discard(self) del self._socket_map[self.fileno()] def FeedStanza(self, stanza): if self._handshake_task: self._handshake_task.FeedStanza(stanza) elif stanza.tagName == 'iq': self._HandleIq(stanza) else: raise UnexpectedXml(stanza) def HandshakeDone(self, jid): self._jid = jid self._handshake_task = None self._connections.add(self) print "Handshake done for %s" % self def _HandleIq(self, iq): if (iq.firstChild and iq.firstChild.namespaceURI == 'google:notifier'): iq_id = iq.getAttribute('id') self._HandleNotifierCommand(iq_id, iq.firstChild) elif iq.getAttribute('type') == 'result': pass else: raise UnexpectedXml(iq) def _HandleNotifierCommand(self, id, command_xml): command = command_xml.tagName if command == 'getAll': if not command_xml.getElementsByTagName('SubscribedServiceUrl'): raise UnexpectedXml(command_xml) self._SendNotifierStanza(id, 'result') elif command == 'set': SendNotification(self._connections) else: raise UnexpectedXml(command_xml) def _SendNotifierStanza(self, id, type): stanza = CloneXml(self._NOTIFIER_STANZA) stanza.setAttribute('from', str(self._jid.GetBareJid())) stanza.setAttribute('to', str(self._jid)) stanza.setAttribute('id', id) stanza.setAttribute('type', type) self.SendStanza(stanza) def SendStanza(self, stanza, unlink=True): """Sends a stanza to the client. Args: stanza: The stanza to send. unlink: Whether to unlink stanza after sending it. (Pass in False if stanza is a constant.) """ self.SendData(stanza.toxml()) if unlink: stanza.unlink() def SendData(self, data): """Sends raw data to the client. """ self.push(data.encode('ascii')) def SendNotification(self): """Sends a notification to the client.""" next_id = self._id_generator.GetNextId() self._SendNotifierStanza(next_id, 'set') def SendNotification(connections): """Sends a notification to all connections in the given sequence.""" for connection in connections: print 'Sending notification to %s' % connection connection.SendNotification() class XmppServer(asyncore.dispatcher): """The main XMPP server class. The XMPP server starts accepting connections on the given address and spawns off XmppConnection objects for each one. Use like so:
username_domain = username auth_string = base64.b64encode('\0%s\0bar' % username_domain) auth_xml = xmppserver.ParseXml('<auth>%s</auth>'% auth_string) handshake_task.FeedStanza(auth_xml) self.assertEqual(self.data_received, 3) stream_xml = xmppserver.ParseXml('<stream:stream xmlns:stream="foo"/>') stream_xml.setAttribute('to', auth_stream_domain) handshake_task.FeedStanza(stream_xml) self.assertEqual(self.data_received, 5) bind_xml = xmppserver.ParseXml( '<iq type="set"><bind><resource>%s</resource></bind></iq>' % resource) handshake_task.FeedStanza(bind_xml) self.assertEqual(self.data_received, 6) session_xml = xmppserver.ParseXml( '<iq type="set"><session></session></iq>') handshake_task.FeedStanza(session_xml) self.assertEqual(self.data_received, 7) self.assertEqual(self.jid.username, username) self.assertEqual(self.jid.domain, auth_stream_domain or auth_domain or initial_stream_domain) self.assertEqual(self.jid.resource, '%s.%s' % (resource_prefix, resource)) def testBasic(self): self.DoHandshake('resource_prefix', 'resource', 'foo', 'bar.com', 'baz.com', 'quux.com') def testDomainBehavior(self): self.DoHandshake('resource_prefix', 'resource', 'foo', 'bar.com', 'baz.com', 'quux.com') self.DoHandshake('resource_prefix', 'resource', 'foo', 'bar.com', 'baz.com', '') self.DoHandshake('resource_prefix', 'resource', 'foo', 'bar.com', '', '') self.DoHandshake('resource_prefix', 'resource', 'foo', '', '', '') class XmppConnectionTest(unittest.TestCase): def setUp(self): self.data = [] def fileno(self): return 0 def setblocking(self, int): pass def getpeername(self): return ('', 0) def send(self, data): self.data.append(data) pass def testBasic(self): connections = set() xmpp_connection = xmppserver.XmppConnection( self, {}, connections, ('', 0)) self.assertEqual(len(connections), 0) xmpp_connection.HandshakeDone(xmppserver.Jid('foo', 'bar')) self.assertEqual(len(connections), 1) self.assertEqual(len(self.data), 0) xmpp_connection.collect_incoming_data( '<iq><getAll xmlns="google:notifier">' '<SubscribedServiceUrl/></getAll></iq>') self.assertEqual(len(self.data), 1) xmpp_connection.collect_incoming_data('<iq type="result"/>') self.assertEqual(len(self.data), 1) xmpp_connection.collect_incoming_data( '<iq><set xmlns="google:notifier"/></iq>') self.assertEqual(len(self.data), 2) def SendUnexpectedStanza(): xmpp_connection.collect_incoming_data('<foo/>') self.assertRaises(xmppserver.UnexpectedXml, SendUnexpectedStanza) def SendUnexpectedNotifierCommand(): xmpp_connection.collect_incoming_data( '<iq><foo xmlns="google:notifier"/></iq>') self.assertRaises(xmppserver.UnexpectedXml, SendUnexpectedNotifierCommand) class XmppServerTest(unittest.TestCase): def fileno(self): return 0 def setblocking(self, int): pass def getpeername(self): return ('', 0) def testBasic(self): class FakeXmppServer(xmppserver.XmppServer): def accept(self2): return (self, ('', 0))
def __str__(self): if self._jid: return str(self._jid) else: return AddrString(self._addr)
fdb367a56d2ae718b9cd24f5f41b343a363d319e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/fdb367a56d2ae718b9cd24f5f41b343a363d319e/xmppserver_test.py
xmpp_server = xmppserver.XmppServer(socket_map, ('127.0.0.1', 5222)) asyncore.loop(30.0, False, socket_map) """ def __init__(self, socket_map, addr): asyncore.dispatcher.__init__(self, None, socket_map) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(addr) self.listen(5) self._socket_map = socket_map self._socket_map[self.fileno()] = self self._connections = set() print 'XMPP server running at %s' % AddrString(addr) def handle_accept(self): (sock, addr) = self.accept() XmppConnection(sock, self._socket_map, self._connections, addr)
self.assertEqual(len(socket_map), 0) xmpp_server = FakeXmppServer(socket_map, ('', 0)) self.assertEqual(len(socket_map), 1) xmpp_server.handle_accept() self.assertEqual(len(socket_map), 2) if __name__ == '__main__': unittest.main()
def SendNotification(connections): """Sends a notification to all connections in the given sequence.""" for connection in connections: print 'Sending notification to %s' % connection connection.SendNotification()
fdb367a56d2ae718b9cd24f5f41b343a363d319e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/fdb367a56d2ae718b9cd24f5f41b343a363d319e/xmppserver_test.py
raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.")
sys.exit("Building docs not supported for cygwin python. Please run the " "build.sh script instead, which uses depot_tools python.")
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") parser.add_option("--page-name", dest="page_name") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Load the manifest of existing API Methods api_manifest = ApiManifest(_extension_api_json) # Read static file names static_names = GetStaticFileNames() # Read module names module_names = api_manifest.getModuleNames() # All pages to generate page_names = static_names | module_names # Allow the user to render a single page if they want if options.page_name: if options.page_name in page_names: page_names = [options.page_name] else: raise Exception("--page-name argument must be one of %s." % ', '.join(sorted(page_names))) # Render a manifest file containing metadata about all the extension samples samples_manifest = SamplesManifest(_samples_dir, _base_dir, api_manifest) samples_manifest.writeToFile(_samples_json) modified_files = RenderPages(page_names, test_shell) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log") if (os.path.isfile(debug_log)): os.remove(debug_log) return os.EX_OK
68b710f25760da35df8478a3e53aa4ccca72fc69 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/68b710f25760da35df8478a3e53aa4ccca72fc69/build.py
return os.EX_OK
if 'EX_OK' in dir(os): return os.EX_OK else: return 0
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") parser.add_option("--page-name", dest="page_name") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Load the manifest of existing API Methods api_manifest = ApiManifest(_extension_api_json) # Read static file names static_names = GetStaticFileNames() # Read module names module_names = api_manifest.getModuleNames() # All pages to generate page_names = static_names | module_names # Allow the user to render a single page if they want if options.page_name: if options.page_name in page_names: page_names = [options.page_name] else: raise Exception("--page-name argument must be one of %s." % ', '.join(sorted(page_names))) # Render a manifest file containing metadata about all the extension samples samples_manifest = SamplesManifest(_samples_dir, _base_dir, api_manifest) samples_manifest.writeToFile(_samples_json) modified_files = RenderPages(page_names, test_shell) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log") if (os.path.isfile(debug_log)): os.remove(debug_log) return os.EX_OK
68b710f25760da35df8478a3e53aa4ccca72fc69 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/68b710f25760da35df8478a3e53aa4ccca72fc69/build.py
ie_paths_re = re.compile('ceee[\\/](ie|common)[\\/]')
ie_paths_re = re.compile('ceee[\\\\/](ie|common)[\\\\/]')
def CheckUnittestsRan(input_api, output_api, committing): '''Checks that the unittests success file is newer than any modified file''' # But only if there were IE files modified, since we only have unit tests # for CEEE IE. files = [] ie_paths_re = re.compile('ceee[\\/](ie|common)[\\/]') for f in input_api.AffectedFiles(include_deletes = False): path = f.LocalPath() if (ie_paths_re.match(path)): files.append(f) if not files: return [] def MakeResult(message, modified_files=[]): if committing: return output_api.PresubmitError(message, modified_files) else: return output_api.PresubmitNotifyResult(message, modified_files) os_path = input_api.os_path success_files = [ os_path.join(input_api.PresubmitLocalPath(), '../chrome/Debug/ceee.success'), os_path.join(input_api.PresubmitLocalPath(), '../chrome/Release/ceee.success')] if (not os_path.exists(success_files[0]) or not os_path.exists(success_files[1])): return [MakeResult(_UNITTEST_MESSAGE)] success_time = min(os.stat(success_files[0]).st_mtime, os.stat(success_files[1]).st_mtime) modified_files = [] for f in modified_files: file_time = os.stat(f.AbsoluteLocalPath()).st_mtime if file_time > success_time: modified_files.append(f.LocalPath()) result = [] if modified_files: result.append(MakeResult('These files have been modified since Debug and/or' ' Release unittests were built.', modified_files)) return result
225e1613ba2c3f0be28d55b57a71b43d845c2d57 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/225e1613ba2c3f0be28d55b57a71b43d845c2d57/ceee_presubmit.py
exit(main())
sys.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)
56a60239afd200799de0f8ac81de2aac85e18e08 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/56a60239afd200799de0f8ac81de2aac85e18e08/run_webkit_tests.py
parts = string.split('(')
parts = re.split("(?<=[^\"])\(", string)
def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80: return splitter parts = string.split('(') fptr = re.compile('\*\w*\)') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): # Don't split on the dot in "if (.condition)". if (not parts[ii - 1][-3:] == "if " and # Don't split "(.)" or "(.*fptr)". (len(parts[ii]) > 0 and not parts[ii][0] == ")" and not fptr.match(parts[ii])) and splitter < 80): return splitter splitter += len(parts[ii]) + 1 done = False end = len(string) last_splitter = -1 while not done: splitter = string[0:end].rfind(',') if splitter < 0: return last_splitter elif splitter >= 80: end = splitter else: return splitter
95ac5dea4b8b841246634968ae6201760cd23f1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/95ac5dea4b8b841246634968ae6201760cd23f1b/build_gles2_cmd_buffer.py
if splitter < 0:
if splitter < 0 or (splitter > 0 and string[splitter - 1] == '"'):
def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80: return splitter parts = string.split('(') fptr = re.compile('\*\w*\)') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): # Don't split on the dot in "if (.condition)". if (not parts[ii - 1][-3:] == "if " and # Don't split "(.)" or "(.*fptr)". (len(parts[ii]) > 0 and not parts[ii][0] == ")" and not fptr.match(parts[ii])) and splitter < 80): return splitter splitter += len(parts[ii]) + 1 done = False end = len(string) last_splitter = -1 while not done: splitter = string[0:end].rfind(',') if splitter < 0: return last_splitter elif splitter >= 80: end = splitter else: return splitter
95ac5dea4b8b841246634968ae6201760cd23f1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/95ac5dea4b8b841246634968ae6201760cd23f1b/build_gles2_cmd_buffer.py
def MakeOriginalArgString(self, prefix, add_comma = False):
def MakeOriginalArgString(self, prefix, add_comma = False, separator = ", "):
def MakeOriginalArgString(self, prefix, add_comma = False): """Gets the list of arguments as they are in GL.""" args = self.GetOriginalArgs() arg_string = ", ".join( ["%s%s" % (prefix, arg.name) for arg in args]) return self.__GetArgList(arg_string, add_comma)
95ac5dea4b8b841246634968ae6201760cd23f1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/95ac5dea4b8b841246634968ae6201760cd23f1b/build_gles2_cmd_buffer.py
arg_string = ", ".join(
arg_string = separator.join(
def MakeOriginalArgString(self, prefix, add_comma = False): """Gets the list of arguments as they are in GL.""" args = self.GetOriginalArgs() arg_string = ", ".join( ["%s%s" % (prefix, arg.name) for arg in args]) return self.__GetArgList(arg_string, add_comma)
95ac5dea4b8b841246634968ae6201760cd23f1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/95ac5dea4b8b841246634968ae6201760cd23f1b/build_gles2_cmd_buffer.py
return_string = "return "
comma = "" if len(func.GetOriginalArgs()): comma = " << " file.Write( ' GPU_CLIENT_LOG("%s" << "("%s%s << ")");\n' % (func.original_name, comma, func.MakeOriginalArgString( "", separator=' << ", " << '))) result_string = "%s result = " % func.return_type return_string = ( ' GPU_CLIENT_LOG("return:" << result)\n return result;\n')
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CHeaderWriter( filename, "// These functions emluate GLES2 over command buffers.\n")
95ac5dea4b8b841246634968ae6201760cd23f1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/95ac5dea4b8b841246634968ae6201760cd23f1b/build_gles2_cmd_buffer.py
(return_string, func.original_name,
(result_string, func.original_name,
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CHeaderWriter( filename, "// These functions emluate GLES2 over command buffers.\n")
95ac5dea4b8b841246634968ae6201760cd23f1b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/95ac5dea4b8b841246634968ae6201760cd23f1b/build_gles2_cmd_buffer.py
gl_func_name = func.GetGLFunctionName() if gl_func_name.startswith("gl"): gl_func_name = gl_func_name[2:] else: gl_func_name = func.name
gl_func_name = func.GetGLTestFunctionName()
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" count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result) = 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.GetGLFunctionName() if gl_func_name.startswith("gl"): gl_func_name = gl_func_name[2:] else: gl_func_name = func.name
bb8972f10cb0f953768734b9ea1469b3e98ac1e5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/bb8972f10cb0f953768734b9ea1469b3e98ac1e5/build_gles2_cmd_buffer.py
archive = tarfile.open(output_fullname, 'w:bz2')
archive = MyTarFile.open(output_fullname, 'w:bz2')
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
0760ae254a07f728e5fb7c0840585ee6ac85a300 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/0760ae254a07f728e5fb7c0840585ee6ac85a300/export_tarball.py
startup_pipe.write(struct.pack('@H', listen_port))
startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(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: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
7c4d810e33c323d2baaed3c4f5f364937233f35e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/7c4d810e33c323d2baaed3c4f5f364937233f35e/testserver.py
return os.path.splitext(basename)[0]
while 1: new_basename = os.path.splitext(basename)[0] if basename == new_basename: break else: basename = new_basename return basename
def ExtractModuleName(infile_path): """Infers the module name from the input file path. The input filename is supposed to be in the form "ModuleName.sigs". This function splits the filename from the extention on that basename of the path and returns that as the module name. Args: infile_path: String holding the path to the input file. Returns: The module name as a string. """ basename = os.path.basename(infile_path) return os.path.splitext(basename)[0]
4f218bc5abf69e46e99cc3bee2809a8cb4f40e28 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4f218bc5abf69e46e99cc3bee2809a8cb4f40e28/generate_stubs.py
(len(parts[ii]) > 0 and not parts[ii][0] == ")")
(len(parts[ii]) > 0 and not parts[ii][0] == ")" and not fptr.match(parts[ii]))
def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80: return splitter parts = string.split('(') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): if (not parts[ii - 1][-3:] == "if " and (len(parts[ii]) > 0 and not parts[ii][0] == ")") and splitter < 80): return splitter splitter += len(parts[ii]) + 1 done = False end = len(string) last_splitter = -1 while not done: splitter = string[0:end].rfind(',') if splitter < 0: return last_splitter elif splitter >= 80: end = splitter else: return splitter
ac116395b8b80112cbd030b2b3c2a705823d2db0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/ac116395b8b80112cbd030b2b3c2a705823d2db0/build_gles2_cmd_buffer.py
def __init__(self, filename, file_comment = None):
def __init__(self, filename, file_comment = None, guard_depth = 3):
def __init__(self, filename, file_comment = None): CWriter.__init__(self, filename) base = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) hpath = os.path.abspath(filename)[len(base) + 1:] self.guard = self._non_alnum_re.sub('_', hpath).upper() + '_'
ac116395b8b80112cbd030b2b3c2a705823d2db0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/ac116395b8b80112cbd030b2b3c2a705823d2db0/build_gles2_cmd_buffer.py
base = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
base = os.path.dirname(os.path.abspath(filename)) for i in range(guard_depth): base = os.path.dirname(base)
def __init__(self, filename, file_comment = None): CWriter.__init__(self, filename) base = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) hpath = os.path.abspath(filename)[len(base) + 1:] self.guard = self._non_alnum_re.sub('_', hpath).upper() + '_'
ac116395b8b80112cbd030b2b3c2a705823d2db0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/ac116395b8b80112cbd030b2b3c2a705823d2db0/build_gles2_cmd_buffer.py
file.Write("}\n");
file.Write("}\n\n");
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) enums = sorted(_ENUM_LISTS.keys()) for enum in enums: if len(_ENUM_LISTS[enum]['valid']) > 0: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LISTS[enum]['valid']: file.Write(" %s,\n" % value) file.Write("};\n") file.Write("\n") file.Write("Validators::Validators()\n") pre = ': ' post = ',' count = 0 for enum in enums: count += 1 if count == len(enums): post = ' {' if len(_ENUM_LISTS[enum]['valid']) > 0: code = """ %(pre)s%(name)s( valid_%(name)s_table, arraysize(valid_%(name)s_table))%(post)s
ac116395b8b80112cbd030b2b3c2a705823d2db0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/ac116395b8b80112cbd030b2b3c2a705823d2db0/build_gles2_cmd_buffer.py
gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") gen.WriteFormat("common/gles2_cmd_format_autogen.h") gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") gen.WriteServiceUtilsImplementation( "service/gles2_cmd_validation_implementation_autogen.h") if options.generate_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") if options.generate_docs: gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h")
if options.alternate_mode == "ppapi": gen.WritePepperGLES2Interface("ppapi/c/ppb_opengles.h") elif options.alternate_mode == "chrome_ppapi": gen.WritePepperGLES2Implementation( "webkit/glue/plugins/pepper_graphics_3d_gl.cc") else: gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") gen.WriteFormat("common/gles2_cmd_format_autogen.h") gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") gen.WriteServiceUtilsImplementation( "service/gles2_cmd_validation_implementation_autogen.h") if options.generate_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") if options.generate_docs: gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h")
def main(argv): """This is the main function.""" parser = OptionParser() parser.add_option( "-g", "--generate-implementation-templates", action="store_true", help="generates files that are generally hand edited..") parser.add_option( "--generate-command-id-tests", action="store_true", help="generate tests for commands ids. Commands MUST not change ID!") parser.add_option( "--generate-docs", action="store_true", help="generate a docs friendly version of the command formats.") parser.add_option( "-v", "--verbose", action="store_true", help="prints more output.") (options, args) = parser.parse_args(args=argv) gen = GLGenerator(options.verbose) gen.ParseGLH("common/GLES2/gl2.h") gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") gen.WriteFormat("common/gles2_cmd_format_autogen.h") gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") gen.WriteServiceUtilsImplementation( "service/gles2_cmd_validation_implementation_autogen.h") if options.generate_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") if options.generate_docs: gen.WriteDocs("docs/gles2_cmd_format_docs_autogen.h") if gen.errors > 0: print "%d errors" % gen.errors sys.exit(1)
ac116395b8b80112cbd030b2b3c2a705823d2db0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/ac116395b8b80112cbd030b2b3c2a705823d2db0/build_gles2_cmd_buffer.py
self._source_dir = layout_package.path_utils.get_absolute_path( self._source_dir)
self._source_dir = os.path.abspath(self._source_dir).replace('\\', '/')
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "sync": self.TestSync, "sync_unit_tests": self.TestSync, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
9527085ab57483070372725949c055ef93a4fd43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9527085ab57483070372725949c055ef93a4fd43/chrome_tests.py
def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build the ginormous commandline in 'cmd'. # It's going to be roughly # python valgrind_test.py ... python run_webkit_tests.py ... # but we'll use the --indirect flag to valgrind_test.py # to avoid valgrinding python. # Start by building the valgrind_test.py commandline. cmd = self._DefaultCommand("webkit") cmd.append("--trace_children") cmd.append("--indirect") # Now build script_cmd, the run_webkits_tests.py commandline # Store each chunk in its own directory so that we can find the data later chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num) test_shell = os.path.join(self._options.build_dir, "test_shell") out_dir = os.path.join(google.path_utils.ScriptDir(), "latest") out_dir = os.path.join(out_dir, chunk_dir) if os.path.exists(out_dir): old_files = glob.glob(os.path.join(out_dir, "*.txt")) for f in old_files: os.remove(f) else: os.makedirs(out_dir) script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py") script_cmd = ["python", script, "--run-singly", "-v", "--noshow-results", "--time-out-ms=200000", "--nocheck-sys-deps"] # Pass build mode to run_webkit_tests.py. We aren't passed it directly, # so parse it out of build_dir. run_webkit_tests.py can only handle # the two values "Release" and "Debug". # TODO(Hercules): unify how all our scripts pass around build mode # (--mode / --target / --build_dir / --debug) if self._options.build_dir.endswith("Debug"): script_cmd.append("--debug"); if (chunk_size > 0): script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size)) if len(self._args): # if the arg is a txt file, then treat it as a list of tests if os.path.isfile(self._args[0]) and self._args[0][-4:] == ".txt": script_cmd.append("--test-list=%s" % self._args[0]) else: script_cmd.extend(self._args) self._ReadGtestFilterFile("layout", script_cmd) # Now run script_cmd with the wrapper in cmd cmd.extend(["--"]) cmd.extend(script_cmd) return valgrind_test.RunTool(cmd, "layout")
9527085ab57483070372725949c055ef93a4fd43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9527085ab57483070372725949c055ef93a4fd43/chrome_tests.py
def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build the ginormous commandline in 'cmd'. # It's going to be roughly # python valgrind_test.py ... python run_webkit_tests.py ... # but we'll use the --indirect flag to valgrind_test.py # to avoid valgrinding python. # Start by building the valgrind_test.py commandline. cmd = self._DefaultCommand("webkit") cmd.append("--trace_children") cmd.append("--indirect") # Now build script_cmd, the run_webkits_tests.py commandline # Store each chunk in its own directory so that we can find the data later chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num) test_shell = os.path.join(self._options.build_dir, "test_shell") out_dir = os.path.join(google.path_utils.ScriptDir(), "latest") out_dir = os.path.join(out_dir, chunk_dir) if os.path.exists(out_dir): old_files = glob.glob(os.path.join(out_dir, "*.txt")) for f in old_files: os.remove(f) else: os.makedirs(out_dir) script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py") script_cmd = ["python", script, "--run-singly", "-v", "--noshow-results", "--time-out-ms=200000", "--nocheck-sys-deps"] # Pass build mode to run_webkit_tests.py. We aren't passed it directly, # so parse it out of build_dir. run_webkit_tests.py can only handle # the two values "Release" and "Debug". # TODO(Hercules): unify how all our scripts pass around build mode # (--mode / --target / --build_dir / --debug) if self._options.build_dir.endswith("Debug"): script_cmd.append("--debug"); if (chunk_size > 0): script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size)) if len(self._args): # if the arg is a txt file, then treat it as a list of tests if os.path.isfile(self._args[0]) and self._args[0][-4:] == ".txt": script_cmd.append("--test-list=%s" % self._args[0]) else: script_cmd.extend(self._args) self._ReadGtestFilterFile("layout", script_cmd) # Now run script_cmd with the wrapper in cmd cmd.extend(["--"]) cmd.extend(script_cmd) return valgrind_test.RunTool(cmd, "layout")
9527085ab57483070372725949c055ef93a4fd43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9527085ab57483070372725949c055ef93a4fd43/chrome_tests.py
script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py")
script = os.path.join(self._source_dir, "third_party", "WebKit", "WebKitTools", "Scripts", "run-chromium-webkit-tests")
def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build the ginormous commandline in 'cmd'. # It's going to be roughly # python valgrind_test.py ... python run_webkit_tests.py ... # but we'll use the --indirect flag to valgrind_test.py # to avoid valgrinding python. # Start by building the valgrind_test.py commandline. cmd = self._DefaultCommand("webkit") cmd.append("--trace_children") cmd.append("--indirect") # Now build script_cmd, the run_webkits_tests.py commandline # Store each chunk in its own directory so that we can find the data later chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num) test_shell = os.path.join(self._options.build_dir, "test_shell") out_dir = os.path.join(google.path_utils.ScriptDir(), "latest") out_dir = os.path.join(out_dir, chunk_dir) if os.path.exists(out_dir): old_files = glob.glob(os.path.join(out_dir, "*.txt")) for f in old_files: os.remove(f) else: os.makedirs(out_dir) script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py") script_cmd = ["python", script, "--run-singly", "-v", "--noshow-results", "--time-out-ms=200000", "--nocheck-sys-deps"] # Pass build mode to run_webkit_tests.py. We aren't passed it directly, # so parse it out of build_dir. run_webkit_tests.py can only handle # the two values "Release" and "Debug". # TODO(Hercules): unify how all our scripts pass around build mode # (--mode / --target / --build_dir / --debug) if self._options.build_dir.endswith("Debug"): script_cmd.append("--debug"); if (chunk_size > 0): script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size)) if len(self._args): # if the arg is a txt file, then treat it as a list of tests if os.path.isfile(self._args[0]) and self._args[0][-4:] == ".txt": script_cmd.append("--test-list=%s" % self._args[0]) else: script_cmd.extend(self._args) self._ReadGtestFilterFile("layout", script_cmd) # Now run script_cmd with the wrapper in cmd cmd.extend(["--"]) cmd.extend(script_cmd) return valgrind_test.RunTool(cmd, "layout")
9527085ab57483070372725949c055ef93a4fd43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9527085ab57483070372725949c055ef93a4fd43/chrome_tests.py
def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build the ginormous commandline in 'cmd'. # It's going to be roughly # python valgrind_test.py ... python run_webkit_tests.py ... # but we'll use the --indirect flag to valgrind_test.py # to avoid valgrinding python. # Start by building the valgrind_test.py commandline. cmd = self._DefaultCommand("webkit") cmd.append("--trace_children") cmd.append("--indirect") # Now build script_cmd, the run_webkits_tests.py commandline # Store each chunk in its own directory so that we can find the data later chunk_dir = os.path.join("layout", "chunk_%05d" % chunk_num) test_shell = os.path.join(self._options.build_dir, "test_shell") out_dir = os.path.join(google.path_utils.ScriptDir(), "latest") out_dir = os.path.join(out_dir, chunk_dir) if os.path.exists(out_dir): old_files = glob.glob(os.path.join(out_dir, "*.txt")) for f in old_files: os.remove(f) else: os.makedirs(out_dir) script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py") script_cmd = ["python", script, "--run-singly", "-v", "--noshow-results", "--time-out-ms=200000", "--nocheck-sys-deps"] # Pass build mode to run_webkit_tests.py. We aren't passed it directly, # so parse it out of build_dir. run_webkit_tests.py can only handle # the two values "Release" and "Debug". # TODO(Hercules): unify how all our scripts pass around build mode # (--mode / --target / --build_dir / --debug) if self._options.build_dir.endswith("Debug"): script_cmd.append("--debug"); if (chunk_size > 0): script_cmd.append("--run-chunk=%d:%d" % (chunk_num, chunk_size)) if len(self._args): # if the arg is a txt file, then treat it as a list of tests if os.path.isfile(self._args[0]) and self._args[0][-4:] == ".txt": script_cmd.append("--test-list=%s" % self._args[0]) else: script_cmd.extend(self._args) self._ReadGtestFilterFile("layout", script_cmd) # Now run script_cmd with the wrapper in cmd cmd.extend(["--"]) cmd.extend(script_cmd) return valgrind_test.RunTool(cmd, "layout")
9527085ab57483070372725949c055ef93a4fd43 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9527085ab57483070372725949c055ef93a4fd43/chrome_tests.py
lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE)
lock_filename = os.path.join(options.source_dir, LOCK_FILE)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + CHROMIUM_SOURCE_DIR os.chdir(CHROMIUM_SOURCE_DIR) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. # TODO(wtc): Consider using Python's rmtree function in the shutil module, # or the RemoveDirectory function in # trunk/tools/buildbot/scripts/common/chromium_utils.py. cmd = 'rmdir /s /q %s\\%s\\%s' % (CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_DIR, options.target) _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_FILE, options.target) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-analyze.exe --dir %s %s' % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_ANALYZE_OPTIONS) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = ('%s\\cov-commit-defects.exe --dir %s --remote %s --port %s' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_REMOTE, COVERITY_PORT, COVERITY_PRODUCT, COVERITY_TARGET, COVERITY_USER, CHROMIUM_PASSWORD) _RunCommand(cmd, options.dry_run) print 'Total time: %ds' % (time.time() - start_time) os.close(lock_file) os.remove(lock_filename) return 0
6c5cc7993d5dddffff198dead864ea32a31b4fe2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6c5cc7993d5dddffff198dead864ea32a31b4fe2/coverity.py
print 'Change directory to ' + CHROMIUM_SOURCE_DIR os.chdir(CHROMIUM_SOURCE_DIR)
print 'Change directory to ' + options.source_dir os.chdir(options.source_dir) coverity_password = _ReadPassword(options.coverity_password_file)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + CHROMIUM_SOURCE_DIR os.chdir(CHROMIUM_SOURCE_DIR) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. # TODO(wtc): Consider using Python's rmtree function in the shutil module, # or the RemoveDirectory function in # trunk/tools/buildbot/scripts/common/chromium_utils.py. cmd = 'rmdir /s /q %s\\%s\\%s' % (CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_DIR, options.target) _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_FILE, options.target) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-analyze.exe --dir %s %s' % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_ANALYZE_OPTIONS) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = ('%s\\cov-commit-defects.exe --dir %s --remote %s --port %s' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_REMOTE, COVERITY_PORT, COVERITY_PRODUCT, COVERITY_TARGET, COVERITY_USER, CHROMIUM_PASSWORD) _RunCommand(cmd, options.dry_run) print 'Total time: %ds' % (time.time() - start_time) os.close(lock_file) os.remove(lock_filename) return 0
6c5cc7993d5dddffff198dead864ea32a31b4fe2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6c5cc7993d5dddffff198dead864ea32a31b4fe2/coverity.py
cmd = 'rmdir /s /q %s\\%s\\%s' % (CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_DIR, options.target) _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_FILE, options.target) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-analyze.exe --dir %s %s' % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_ANALYZE_OPTIONS) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = ('%s\\cov-commit-defects.exe --dir %s --remote %s --port %s'
if sys.platform == 'linux2': rm_path = os.path.join(options.source_dir,'src','out',options.target) elif sys.platform == 'win32': rm_path = os.path.join(options.source_dir,options.solution_dir, options.target) else: print 'Platform "%s" unrecognized, don\'t know how to proceed' _ReleaseLock(lock_file, lock_filename) sys.exit(1) if options.dry_run: print 'shutil.rmtree(%s)' % repr(rm_path) else: shutil.rmtree(rm_path,True) print 'Elapsed time: %ds' % (time.time() - start_time) use_shell_during_make = False if sys.platform == 'linux2': use_shell_during_make = True os.chdir('src') _RunCommand('pwd', options.dry_run, shell=True) cmd = '%s/cov-build --dir %s make BUILDTYPE=%s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) elif sys.platform == 'win32': cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.source_dir, options.solution_file, options.target) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_analyze_exe = os.path.join(options.coverity_bin_dir,'cov-analyze') cmd = '%s --dir %s %s' % (cov_analyze_exe, options.coverity_intermediate_dir, options.coverity_analyze_options) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_commit_exe = os.path.join(options.coverity_bin_dir,'cov-commit-defects') coverity_target = options.coverity_target if sys.platform != 'win32': coverity_target = '"%s"' % coverity_target cmd = ('%s --dir %s --remote %s --port %s '
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + CHROMIUM_SOURCE_DIR os.chdir(CHROMIUM_SOURCE_DIR) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. # TODO(wtc): Consider using Python's rmtree function in the shutil module, # or the RemoveDirectory function in # trunk/tools/buildbot/scripts/common/chromium_utils.py. cmd = 'rmdir /s /q %s\\%s\\%s' % (CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_DIR, options.target) _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_FILE, options.target) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-analyze.exe --dir %s %s' % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_ANALYZE_OPTIONS) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = ('%s\\cov-commit-defects.exe --dir %s --remote %s --port %s' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_REMOTE, COVERITY_PORT, COVERITY_PRODUCT, COVERITY_TARGET, COVERITY_USER, CHROMIUM_PASSWORD) _RunCommand(cmd, options.dry_run) print 'Total time: %ds' % (time.time() - start_time) os.close(lock_file) os.remove(lock_filename) return 0
6c5cc7993d5dddffff198dead864ea32a31b4fe2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6c5cc7993d5dddffff198dead864ea32a31b4fe2/coverity.py
'--password %s') % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_REMOTE, COVERITY_PORT, COVERITY_PRODUCT, COVERITY_TARGET, COVERITY_USER, CHROMIUM_PASSWORD) _RunCommand(cmd, options.dry_run)
'--password %s') % (cov_commit_exe, options.coverity_intermediate_dir, options.coverity_dbhost, options.coverity_port, options.coverity_product, coverity_target, options.coverity_user, coverity_password) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + CHROMIUM_SOURCE_DIR os.chdir(CHROMIUM_SOURCE_DIR) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. # TODO(wtc): Consider using Python's rmtree function in the shutil module, # or the RemoveDirectory function in # trunk/tools/buildbot/scripts/common/chromium_utils.py. cmd = 'rmdir /s /q %s\\%s\\%s' % (CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_DIR, options.target) _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_FILE, options.target) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-analyze.exe --dir %s %s' % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_ANALYZE_OPTIONS) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = ('%s\\cov-commit-defects.exe --dir %s --remote %s --port %s' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_REMOTE, COVERITY_PORT, COVERITY_PRODUCT, COVERITY_TARGET, COVERITY_USER, CHROMIUM_PASSWORD) _RunCommand(cmd, options.dry_run) print 'Total time: %ds' % (time.time() - start_time) os.close(lock_file) os.remove(lock_filename) return 0
6c5cc7993d5dddffff198dead864ea32a31b4fe2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6c5cc7993d5dddffff198dead864ea32a31b4fe2/coverity.py
os.close(lock_file) os.remove(lock_filename)
_ReleaseLock(lock_file, lock_filename)
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = '%s\\%s' % (CHROMIUM_SOURCE_DIR, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + CHROMIUM_SOURCE_DIR os.chdir(CHROMIUM_SOURCE_DIR) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. # TODO(wtc): Consider using Python's rmtree function in the shutil module, # or the RemoveDirectory function in # trunk/tools/buildbot/scripts/common/chromium_utils.py. cmd = 'rmdir /s /q %s\\%s\\%s' % (CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_DIR, options.target) _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, CHROMIUM_SOURCE_DIR, CHROMIUM_SOLUTION_FILE, options.target) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = '%s\\cov-analyze.exe --dir %s %s' % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_ANALYZE_OPTIONS) _RunCommand(cmd, options.dry_run) print 'Elapsed time: %ds' % (time.time() - start_time) cmd = ('%s\\cov-commit-defects.exe --dir %s --remote %s --port %s' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (COVERITY_BIN_DIR, COVERITY_INTERMEDIATE_DIR, COVERITY_REMOTE, COVERITY_PORT, COVERITY_PRODUCT, COVERITY_TARGET, COVERITY_USER, CHROMIUM_PASSWORD) _RunCommand(cmd, options.dry_run) print 'Total time: %ds' % (time.time() - start_time) os.close(lock_file) os.remove(lock_filename) return 0
6c5cc7993d5dddffff198dead864ea32a31b4fe2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6c5cc7993d5dddffff198dead864ea32a31b4fe2/coverity.py
'third_party', 'WebKit', 'WebKitTools', 'pywebsocket')
'third_party', 'WebKit', 'WebKitTools', 'Scripts', 'webkitpy', 'thirdparty', 'pywebsocket')
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
9de7d54c4440572cf655859043afda743240c4de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9de7d54c4440572cf655859043afda743240c4de/websocket_server.py
'third_party', 'WebKit', 'WebKitTools', 'pywebsocket', 'mod_pywebsocket', 'standalone.py')
'third_party', 'WebKit', 'WebKitTools', 'Scripts', 'webkitpy', 'thirdparty', 'pywebsocket', 'mod_pywebsocket', 'standalone.py')
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
9de7d54c4440572cf655859043afda743240c4de /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/9de7d54c4440572cf655859043afda743240c4de/websocket_server.py
def cg_to_glsl(cg_shader):
def cg_to_glsl(cg_shader, CGC):
def cg_to_glsl(cg_shader): cg_shader = cg_rename_attributes(cg_shader) vertex_entry = re.search(r'#o3d\s+VertexShaderEntryPoint\s+(\w+)', cg_shader).group(1) p = subprocess.Popen([CGC]+('-profile glslv -entry %s' % vertex_entry).split(' '), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) glsl_vertex, err_v = p.communicate(cg_shader) fragment_entry = re.search(r'#o3d\s+PixelShaderEntryPoint\s+(\w+)', cg_shader).group(1) p = subprocess.Popen([CGC]+('-profile glslf -entry %s' % fragment_entry).split(' '), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) glsl_fragment, err_f = p.communicate(cg_shader) log = ( '// glslv profile log:\n' + '\n'.join('// ' + l for l in err_v.splitlines()) + '\n\n' '// glslf profile log:\n' + '\n'.join('// ' + l for l in err_f.splitlines())) + '\n' return glsl_vertex, glsl_fragment, log
4c987da0e89b88a1487fc22cae1a294f604e8d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4c987da0e89b88a1487fc22cae1a294f604e8d10/convert.py
def check_cg(): if not os.path.exists(CGC): print >>sys.stderr, CGC+' is not found, use --cgc option to specify its' print >>sys.stderr, 'location. You may need to install nvidia cg toolkit.' sys.exit(1) def main(cg_shader):
def main(cg_shader, CGC):
def check_cg(): if not os.path.exists(CGC): print >>sys.stderr, CGC+' is not found, use --cgc option to specify its' print >>sys.stderr, 'location. You may need to install nvidia cg toolkit.' sys.exit(1)
4c987da0e89b88a1487fc22cae1a294f604e8d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4c987da0e89b88a1487fc22cae1a294f604e8d10/convert.py
glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader)
glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC)
def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment)
4c987da0e89b88a1487fc22cae1a294f604e8d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4c987da0e89b88a1487fc22cae1a294f604e8d10/convert.py
check_cg()
check_cgc(CGC)
def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment)
4c987da0e89b88a1487fc22cae1a294f604e8d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4c987da0e89b88a1487fc22cae1a294f604e8d10/convert.py
main(input)
main(input, CGC)
def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment)
4c987da0e89b88a1487fc22cae1a294f604e8d10 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4c987da0e89b88a1487fc22cae1a294f604e8d10/convert.py
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
def HandleXmppSocket(fd, socket_map, handler): """Runs the handler for the xmpp connection for fd.
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
5b1bf077a7b9ec15911dce368946ffaee00746a3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b1bf077a7b9ec15911dce368946ffaee00746a3/testserver.py
handler(dispatcher)
handler(xmpp_connection)
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
5b1bf077a7b9ec15911dce368946ffaee00746a3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b1bf077a7b9ec15911dce368946ffaee00746a3/testserver.py
dispatcher.handle_error()
xmpp_connection.handle_error()
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
5b1bf077a7b9ec15911dce368946ffaee00746a3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b1bf077a7b9ec15911dce368946ffaee00746a3/testserver.py
xmpp_connection = self._xmpp_socket_map.get(fd) RunDispatcherHandler(xmpp_connection, asyncore.dispatcher.handle_read_event)
HandleXmppSocket(fd, self._xmpp_socket_map, asyncore.dispatcher.handle_read_event)
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
5b1bf077a7b9ec15911dce368946ffaee00746a3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b1bf077a7b9ec15911dce368946ffaee00746a3/testserver.py
xmpp_connection = self._xmpp_socket_map.get(fd) RunDispatcherHandler(xmpp_connection, asyncore.dispatcher.handle_write_event)
HandleXmppSocket(fd, self._xmpp_socket_map, asyncore.dispatcher.handle_write_event)
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
5b1bf077a7b9ec15911dce368946ffaee00746a3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b1bf077a7b9ec15911dce368946ffaee00746a3/testserver.py
xmpp_connection = self._xmpp_socket_map.get(fd) RunDispatcherHandler(xmpp_connection, asyncore.dispatcher.handle_expt_event)
HandleXmppSocket(fd, self._xmpp_socket_map, asyncore.dispatcher.handle_expt_event)
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
5b1bf077a7b9ec15911dce368946ffaee00746a3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5b1bf077a7b9ec15911dce368946ffaee00746a3/testserver.py
if splitter >= 0 and not string[splitter + 1] == '=':
if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80:
def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') if splitter >= 0 and not string[splitter + 1] == '=': return splitter parts = string.split('(') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): if not parts[ii - 1][-3:] == "if ": return splitter splitter += len(parts[ii]) + 1 done = False end = len(string) last_splitter = -1 while not done: splitter = string[0:end].rfind(',') if splitter < 0: return last_splitter elif splitter >= 80: end = splitter else: return splitter
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
if not parts[ii - 1][-3:] == "if ":
if (not parts[ii - 1][-3:] == "if " and (len(parts[ii]) > 0 and not parts[ii][0] == ")") and splitter < 80):
def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') if splitter >= 0 and not string[splitter + 1] == '=': return splitter parts = string.split('(') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): if not parts[ii - 1][-3:] == "if ": return splitter splitter += len(parts[ii]) + 1 done = False end = len(string) last_splitter = -1 while not done: splitter = string[0:end].rfind(',') if splitter < 0: return last_splitter elif splitter >= 80: end = splitter else: return splitter
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n")
file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);\n")
def WriteCmdSizeTest(self, func, file): """Writes the size test for a command.""" file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" %s cmd = {{0}};\n" % func.name)
file.Write(" %s cmd = { { 0 } };\n" % func.name)
def WriteFormatTest(self, func, file): """Writes a format test for a command.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" %s cmd = {{0}};\n" % func.name) file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") args = func.GetCmdArgs() value = 11 for arg in args: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(");\n") value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") func.type_handler.WriteCmdSizeTest(func, file) file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd));\n"); for arg in args: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" void Init(%s) {\n" % func.MakeTypedCmdArgString("_")) file.Write(" SetHeader(0); // TODO(gman): pass in correct size\n") args = func.GetCmdArgs() for arg in args: file.Write(" %s = _%s;\n" % (arg.name, arg.name)) file.Write(" }\n") file.Write("\n")
raise Error
def WriteImmediateCmdInit(self, func, file): """Writes the Init function for the immediate version of a command.""" file.Write(" void Init(%s) {\n" % func.MakeTypedCmdArgString("_")) file.Write(" SetHeader(0); // TODO(gman): pass in correct size\n") args = func.GetCmdArgs() for arg in args: file.Write(" %s = _%s;\n" % (arg.name, arg.name)) file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
copy_args = func.MakeCmdArgString("_", False) file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedCmdArgString("_", True)) file.Write(" // TODO(gman): compute correct size.\n") file.Write(" const uint32 size = ComputeSize(0);\n") file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % copy_args) file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n") file.Write(" }\n") file.Write("\n")
raise Error
def WriteImmediateCmdSet(self, func, file): """Writes the Set function for the immediate version of a command.""" copy_args = func.MakeCmdArgString("_", False) file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedCmdArgString("_", True)) file.Write(" // TODO(gman): compute correct size.\n") file.Write(" const uint32 size = ComputeSize(0);\n") file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % copy_args) file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n") file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" %
file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n" " return parse_error::kParseInvalidArguments;\n" " }\n" %
def WriteHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % (func.name, func.GetLastOriginalArg().name))
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" %
file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n" " return parse_error::kParseInvalidArguments;\n" " }\n" %
def WriteImmediateHandlerImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % (func.original_name, func.GetLastOriginalArg().name))
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" cmd.header.size * 4u); // NOLINT\n")
file.Write(" cmd.header.size * 4u);\n")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" static GLuint ids[] = { 12, 23, 34, };\n") file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") args = func.GetCmdArgs() value = 11 for arg in args: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n ids);\n") args = func.GetCmdArgs() value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) +\n") file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n") file.Write(" cmd.header.size * 4u); // NOLINT\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n"); file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n"); for arg in args: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): Check that ids were inserted;\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" cmd.header.size * 4u); // NOLINT\n")
file.Write(" cmd.header.size * 4u);\n")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" static GLuint ids[] = { 12, 23, 34, };\n") file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") args = func.GetCmdArgs() value = 11 for arg in args: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n ids);\n") args = func.GetCmdArgs() value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) +\n") file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u),\n") file.Write(" cmd.header.size * 4u); // NOLINT\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n"); file.Write(" RoundSizeToMultipleOfEntries(cmd.n * 4u));\n"); for arg in args: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): Check that ids were inserted;\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" cmd.header.size * 4u); // NOLINT\n")
file.Write(" cmd.header.size * 4u);\n")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" const int kSomeBaseValueToTestWith = 51;\n") file.Write(" static %s data[] = {\n" % func.info.data_type) for v in range(0, func.info.count): file.Write(" static_cast<%s>(kSomeBaseValueToTestWith + %d),\n" % (func.info.data_type, v)) file.Write(" };\n") file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") args = func.GetCmdArgs() value = 11 for arg in args: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n data);\n") args = func.GetCmdArgs() value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) +\n") file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n") file.Write(" cmd.header.size * 4u); // NOLINT\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n") for arg in args: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): Check that data was inserted;\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" cmd.header.size * 4u); // NOLINT\n")
file.Write(" cmd.header.size * 4u);\n")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" const int kSomeBaseValueToTestWith = 51;\n") file.Write(" static %s data[] = {\n" % func.info.data_type) for v in range(0, func.info.count * 2): file.Write(" static_cast<%s>(kSomeBaseValueToTestWith + %d),\n" % (func.info.data_type, v)) file.Write(" };\n") file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") args = func.GetCmdArgs() value = 1 for arg in args: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n data);\n") args = func.GetCmdArgs() value = 1 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) +\n") file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)),\n") file.Write(" cmd.header.size * 4u); // NOLINT\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" RoundSizeToMultipleOfEntries(sizeof(data)));\n") for arg in args: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): Check that data was inserted;\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" static uint32 ComputeDataSize(const char* s) {\n") file.Write(" return strlen(s);\n") file.Write(" }\n") file.Write("\n") file.Write(" static uint32 ComputeSize(const char* s) {\n")
file.Write(" static uint32 ComputeSize(uint32 data_size) {\n")
def WriteImmediateCmdComputeSize(self, func, file): """Overrriden from TypeHandler.""" file.Write(" static uint32 ComputeDataSize(const char* s) {\n") file.Write(" return strlen(s);\n") file.Write(" }\n") file.Write("\n") file.Write(" static uint32 ComputeSize(const char* s) {\n") file.Write(" return static_cast<uint32>(\n") file.Write(" sizeof(ValueType) + ComputeDataSize(s)); // NOLINT\n") file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" sizeof(ValueType) + ComputeDataSize(s)); // NOLINT\n") file.Write(" }\n") file.Write("\n")
file.Write(" sizeof(ValueType) + data_size); // NOLINT\n") file.Write(" }\n")
def WriteImmediateCmdComputeSize(self, func, file): """Overrriden from TypeHandler.""" file.Write(" static uint32 ComputeDataSize(const char* s) {\n") file.Write(" return strlen(s);\n") file.Write(" }\n") file.Write("\n") file.Write(" static uint32 ComputeSize(const char* s) {\n") file.Write(" return static_cast<uint32>(\n") file.Write(" sizeof(ValueType) + ComputeDataSize(s)); // NOLINT\n") file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" void SetHeader(const char* s) {\n") file.Write(" header.SetCmdByTotalSize<ValueType>(ComputeSize(s));\n") file.Write(" }\n") file.Write("\n")
code = """ void SetHeader(uint32 data_size) { header.SetCmdBySize<ValueType>(data_size); } """ file.Write(code)
def WriteImmediateCmdSetHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write(" void SetHeader(const char* s) {\n") file.Write(" header.SetCmdByTotalSize<ValueType>(ComputeSize(s));\n") file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) file.Write(" SetHeader(_%s);\n" % last_arg.name) args = func.GetCmdArgs()[:-1]
args = func.GetCmdArgs() set_code = []
def WriteImmediateCmdInit(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) file.Write(" SetHeader(_%s);\n" % last_arg.name) args = func.GetCmdArgs()[:-1] for arg in args: file.Write(" %s = _%s;\n" % (arg.name, arg.name)) file.Write(" data_size = strlen(_%s);\n" % last_arg.name) file.Write(" memcpy(ImmediateDataAddress(this), _%s, data_size);\n" % last_arg.name) file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" %s = _%s;\n" % (arg.name, arg.name)) file.Write(" data_size = strlen(_%s);\n" % last_arg.name) file.Write(" memcpy(ImmediateDataAddress(this), _%s, data_size);\n" % last_arg.name) file.Write(" }\n") file.Write("\n")
set_code.append(" %s = _%s;" % (arg.name, arg.name)) code = """ void Init(%(typed_args)s, uint32 _data_size) { SetHeader(_data_size); %(set_code)s memcpy(ImmediateDataAddress(this), _%(last_arg)s, _data_size); } """ file.Write(code % { "typed_args": func.MakeTypedOriginalArgString("_"), "set_code": "\n".join(set_code), "last_arg": last_arg.name })
def WriteImmediateCmdInit(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) file.Write(" SetHeader(_%s);\n" % last_arg.name) args = func.GetCmdArgs()[:-1] for arg in args: file.Write(" %s = _%s;\n" % (arg.name, arg.name)) file.Write(" data_size = strlen(_%s);\n" % last_arg.name) file.Write(" memcpy(ImmediateDataAddress(this), _%s, data_size);\n" % last_arg.name) file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" void* Set(void* cmd%s) {\n" %
file.Write(" void* Set(void* cmd%s, uint32 _data_size) {\n" %
def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedOriginalArgString("_", True)) file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % func.MakeOriginalArgString("_")) file.Write(" const uint32 size = ComputeSize(_%s);\n" % last_arg.name) file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n") file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" %
file.Write(" static_cast<ValueType*>(cmd)->Init(%s, _data_size);\n" %
def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedOriginalArgString("_", True)) file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % func.MakeOriginalArgString("_")) file.Write(" const uint32 size = ComputeSize(_%s);\n" % last_arg.name) file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n") file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" const uint32 size = ComputeSize(_%s);\n" % last_arg.name) file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n")
file.Write(" return NextImmediateCmdAddress<ValueType>(" "cmd, _data_size);\n")
def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedOriginalArgString("_", True)) file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % func.MakeOriginalArgString("_")) file.Write(" const uint32 size = ComputeSize(_%s);\n" % last_arg.name) file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n") file.Write(" }\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % (func.name, last_arg.name)) file.Write(" gles2::%s& c = GetImmediateCmdSpaceTotalSize<gles2::%s>(" "size);\n" %
file.Write(" const uint32 data_size = strlen(name);\n") file.Write(" gles2::%s& c = GetImmediateCmdSpace<gles2::%s>(" "data_size);\n" %
def WriteImmediateCmdHelper(self, func, file): """Overrriden from TypeHandler.""" args = func.MakeOriginalArgString("") last_arg = func.GetLastOriginalArg() file.Write(" void %s(%s) {\n" % (func.name, func.MakeTypedOriginalArgString(""))) file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % (func.name, last_arg.name)) file.Write(" gles2::%s& c = GetImmediateCmdSpaceTotalSize<gles2::%s>(" "size);\n" % (func.name, func.name)) file.Write(" c.Init(%s);\n" % args) file.Write(" }\n\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" c.Init(%s);\n" % args)
file.Write(" c.Init(%s, data_size);\n" % args)
def WriteImmediateCmdHelper(self, func, file): """Overrriden from TypeHandler.""" args = func.MakeOriginalArgString("") last_arg = func.GetLastOriginalArg() file.Write(" void %s(%s) {\n" % (func.name, func.MakeTypedOriginalArgString(""))) file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % (func.name, last_arg.name)) file.Write(" gles2::%s& c = GetImmediateCmdSpaceTotalSize<gles2::%s>(" "size);\n" % (func.name, func.name)) file.Write(" c.Init(%s);\n" % args) file.Write(" }\n\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd")
init_code = [] check_code = []
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n test_str);\n") value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" strlen(test_str) + 1);\n") for arg in all_but_last_arg: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(",\n static_cast<%s>(%d)" % (arg.type, value))
init_code.append(" static_cast<%s>(%d)," % (arg.type, value))
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n test_str);\n") value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" strlen(test_str) + 1);\n") for arg in all_but_last_arg: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(",\n test_str);\n")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n test_str);\n") value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" strlen(test_str) + 1);\n") for arg in all_but_last_arg: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" strlen(test_str) + 1);\n")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n test_str);\n") value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" strlen(test_str) + 1);\n") for arg in all_but_last_arg: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name))
check_code.append(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);" % (arg.type, value, arg.name))
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n test_str);\n") value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" strlen(test_str) + 1);\n") for arg in all_but_last_arg: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
code = """ TEST(GLES2FormatTest, %(func_name)s) { int8 buf[256] = { 0, }; %(func_name)s& cmd = *static_cast<%(func_name)s*>(static_cast<void*>(&buf)); static const char* const test_str = \"test string\"; void* next_cmd = cmd.Set( &cmd, %(init_code)s test_str, strlen(test_str)); EXPECT_EQ(static_cast<uint32>(%(func_name)s::kCmdId), cmd.header.command); EXPECT_EQ(sizeof(cmd) + RoundSizeToMultipleOfEntries(strlen(test_str)), cmd.header.size * 4u); EXPECT_EQ(static_cast<char*>(next_cmd), reinterpret_cast<char*>(&cmd) + sizeof(cmd) + RoundSizeToMultipleOfEntries(strlen(test_str))); %(check_code)s EXPECT_EQ(static_cast<uint32>(strlen(test_str)), cmd.data_size); EXPECT_EQ(0, memcmp(test_str, ImmediateDataAddress(&cmd), strlen(test_str))); } """ file.Write(code % { 'func_name': func.name, 'init_code': "\n".join(init_code), 'check_code': "\n".join(check_code), })
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n test_str);\n") value = 11 file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd) +\n") file.Write(" strlen(test_str) + 1);\n") for arg in all_but_last_arg: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n")
file.Write(" EXPECT_EQ(sizeof(cmd)\n")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Write(" &cmd") all_but_last_arg = func.GetCmdArgs()[:-1] value = 11 for arg in all_but_last_arg: file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) value += 1 file.Write(",\n test_str);\n") value = 11 file.Write(" EXPECT_EQ(%s::kCmdId ^ cmd.header.command);\n" % func.name) file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPECT_EQ(static_cast<char*>(next_cmd),\n") file.Write(" reinterpret_cast<char*>(&cmd) + sizeof(cmd));\n"); for arg in all_but_last_arg: file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
class EnumArgument(Argument):
class EnumBaseArgument(Argument): """Base calss for EnumArgument, IntArgument and BoolArgument""" def __init__(self, name, gl_type, type, gl_error): Argument.__init__(self, name, gl_type) self.local_type = type self.gl_error = gl_error name = type[len(gl_type):] self.enum_info = _ENUM_LISTS[name] def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.local_type, self.name)) file.Write(" SetGLError(%s);\n" % self.gl_error) file.Write(" return parse_error::kParseNoError;\n") file.Write(" }\n") def GetValidArg(self, offset, index): if 'valid' in self.enum_info: valid = self.enum_info['valid'] num_valid = len(valid) if index >= num_valid: index = num_valid - 1 return valid[index] return str(offset + 1) def GetValidGLArg(self, offset, index): return self.GetValidArg(offset, index) 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 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], "kParseNoError") return ("---ERROR1---", "kParseNoError") class EnumArgument(EnumBaseArgument):
def GetImmediateVersion(self): """Gets the immediate version of this argument.""" return self
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
Argument.__init__(self, name, "GLenum") self.enum_type = type def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.enum_type, self.name)) file.Write(" SetGLError(GL_INVALID_ENUM);\n") file.Write(" return parse_error::kParseNoError;\n") file.Write(" }\n") class IntArgument(Argument):
EnumBaseArgument.__init__(self, name, "GLenum", type, "GL_INVALID_ENUM") class IntArgument(EnumBaseArgument):
def __init__(self, name, type): Argument.__init__(self, name, "GLenum")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
Argument.__init__(self, name, "GLint") self.int_type = type def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.int_type, self.name)) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return parse_error::kParseNoError;\n") file.Write(" }\n")
EnumBaseArgument.__init__(self, name, "GLint", type, "GL_INVALID_VALUE") class BoolArgument(EnumBaseArgument): """A class for a GLboolean argument that can only except specific values. For example glUniformMatrix takes a GLboolean for it's transpose but it must be false. """ def __init__(self, name, type): EnumBaseArgument.__init__(self, name, "GLboolean", type, "GL_INVALID_VALUE")
def __init__(self, name, type): Argument.__init__(self, name, "GLint")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
type = type.replace("GLResourceId", "GLuint")
match = re.match("(GLid\w+)", type) self.resource_type = match.group(1)[4:] type = type.replace(match.group(1), "GLuint")
def __init__(self, name, type): type = type.replace("GLResourceId", "GLuint") Argument.__init__(self, name, type)
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
elif arg_parts[0] == 'GLResourceId': return ResourceIdArgument( arg_parts[-1], " ".join(arg_parts[0:-1]))
elif arg_parts[0].startswith('GLid'): return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1]))
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1])) else: return PointerArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) # Is this a resource argument? Must come after pointer check. elif arg_parts[0] == 'GLResourceId': return ResourceIdArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and arg_parts[0] != "GLintptr"): return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) else: return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
_non_alnum_re = re.compile(r'[^a-zA-Z0-9]')
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1])) else: return PointerArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) # Is this a resource argument? Must come after pointer check. elif arg_parts[0] == 'GLResourceId': return ResourceIdArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('GLint') and len(arg_parts[0]) > 5 and arg_parts[0] != "GLintptr"): return IntArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) else: return Argument(arg_parts[-1], " ".join(arg_parts[0:-1]))
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
def WriteHeader(self, file): """Writes header to file""" file.Write( "// This file is auto-generated. DO NOT EDIT!\n" "\n")
def WriteHeader(self, file): """Writes header to file""" file.Write( "// This file is auto-generated. DO NOT EDIT!\n" "\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py