bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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)
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)
475,800
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")
475,801
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
475,802
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")
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")
475,803
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
475,804
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")
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")
475,805
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")
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")
475,806
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
475,807
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")
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")
475,808
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")
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")
475,809
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
475,810
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")
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")
475,811
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
def WriteGLES2ImplementationImpl(self, func, file): """Overrriden from TypeHandler.""" pass
475,812
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")
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")
475,813
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)
475,814
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")
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")
475,815
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)
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_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") if gen.errors > 0: print "%d errors" % gen.errors sys.exit(1)
475,816
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
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
475,817
def ChromiumSyncCommandHandler(self): """Handle a chromiumsync command arriving via http.
def ChromiumSyncCommandHandler(self): """Handle a chromiumsync command arriving via http.
475,818
def FeedStanza(self, stanza): """Inspects the given stanza and changes the handshake state if needed.
def FeedStanza(self, stanza): """Inspects the given stanza and changes the handshake state if needed.
475,819
def __str__(self): if self._jid: return str(self._jid) else: return AddrString(self._addr)
def __str__(self): if self._jid: return str(self._jid) else: return AddrString(self._addr)
475,820
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()
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()
475,821
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
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): sys.exit("Building docs not supported for cygwin python. Please run the " "build.sh script instead, which uses depot_tools python.") 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
475,822
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
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) if 'EX_OK' in dir(os): return os.EX_OK else: return 0
475,823
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
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
475,824
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)
def main(): cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[0])))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
475,825
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
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 = re.split("(?<=[^\"])\(", string) 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
475,826
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
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 or (splitter > 0 and string[splitter - 1] == '"'): return last_splitter elif splitter >= 80: end = splitter else: return splitter
475,827
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)
def MakeOriginalArgString(self, prefix, add_comma = False, separator = ", "): """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)
475,828
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)
def MakeOriginalArgString(self, prefix, add_comma = False): """Gets the list of arguments as they are in GL.""" args = self.GetOriginalArgs() arg_string = separator.join( ["%s%s" % (prefix, arg.name) for arg in args]) return self.__GetArgList(arg_string, add_comma)
475,829
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CHeaderWriter( filename, "// These functions emluate GLES2 over command buffers.\n")
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CHeaderWriter( filename, "// These functions emluate GLES2 over command buffers.\n")
475,830
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CHeaderWriter( filename, "// These functions emluate GLES2 over command buffers.\n")
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CHeaderWriter( filename, "// These functions emluate GLES2 over command buffers.\n")
475,831
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
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
475,832
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True
475,833
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
475,834
def ExtractModuleName(infile_path): """Infers the module name from the input file path. The input filename is supposed to be in the form "ModuleName.sigs". This function splits the filename from the extention on that basename of the path and returns that as the module name. Args: infile_path: String holding the path to the input file. Returns: The module name as a string. """ basename = os.path.basename(infile_path) return os.path.splitext(basename)[0]
def ExtractModuleName(infile_path): """Infers the module name from the input file path. The input filename is supposed to be in the form "ModuleName.sigs". This function splits the filename from the extention on that basename of the path and returns that as the module name. Args: infile_path: String holding the path to the input file. Returns: The module name as a string. """ basename = os.path.basename(infile_path) while 1: new_basename = os.path.splitext(basename)[0] if basename == new_basename: break else: basename = new_basename return basename
475,835
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
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 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
475,836
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() + '_'
def __init__(self, filename, file_comment = None, guard_depth = 3): 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() + '_'
475,837
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() + '_'
def __init__(self, filename, file_comment = None): CWriter.__init__(self, filename) base = os.path.dirname(os.path.abspath(filename)) for i in range(guard_depth): base = os.path.dirname(base) hpath = os.path.abspath(filename)[len(base) + 1:] self.guard = self._non_alnum_re.sub('_', hpath).upper() + '_'
475,838
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
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
475,839
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)
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") 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") if gen.errors > 0: print "%d errors" % gen.errors sys.exit(1)
475,840
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "sync": self.TestSync, "sync_unit_tests": self.TestSync, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "sync": self.TestSync, "sync_unit_tests": self.TestSync, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
475,841
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")
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")
475,842
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")
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")
475,843
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")
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, "third_party", "WebKit", "WebKitTools", "Scripts", "run-chromium-webkit-tests") 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")
475,844
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")
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")
475,845
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
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 = os.path.join(options.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
475,846
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
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 ' + options.source_dir os.chdir(options.source_dir) coverity_password = _ReadPassword(options.coverity_password_file) 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
475,847
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
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
475,848
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
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') % (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) print 'Total time: %ds' % (time.time() - start_time) os.close(lock_file) os.remove(lock_filename) return 0
475,849
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
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) _ReleaseLock(lock_file, lock_filename) return 0
475,850
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
475,851
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name)
475,852
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
def cg_to_glsl(cg_shader, CGC): cg_shader = cg_rename_attributes(cg_shader) vertex_entry = re.search(r'#o3d\s+VertexShaderEntryPoint\s+(\w+)', cg_shader).group(1) p = subprocess.Popen([CGC]+('-profile glslv -entry %s' % vertex_entry).split(' '), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 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
475,853
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 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)
475,854
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)
def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment)
475,855
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)
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)
475,856
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)
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)
475,857
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
475,858
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
475,859
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
475,860
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
475,861
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
475,862
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher.
475,863
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
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 ": 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
475,864
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
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 " 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
475,865
def WriteCmdSizeTest(self, func, file): """Writes the size test for a command.""" file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\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")
475,866
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")
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")
475,867
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")
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")
475,868
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")
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")
475,869
def WriteHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % (func.name, func.GetLastOriginalArg().name))
def WriteHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n" " return parse_error::kParseInvalidArguments;\n" " }\n" % (func.name, func.GetLastOriginalArg().name))
475,870
def WriteImmediateHandlerImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % (func.original_name, func.GetLastOriginalArg().name))
def WriteImmediateHandlerImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n" " return parse_error::kParseInvalidArguments;\n" " }\n" % (func.original_name, func.GetLastOriginalArg().name))
475,871
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")
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);\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")
475,872
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")
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);\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")
475,873
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")
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);\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")
475,874
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")
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);\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")
475,875
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")
def WriteImmediateCmdComputeSize(self, func, file): """Overrriden from TypeHandler.""" file.Write(" static uint32 ComputeSize(uint32 data_size) {\n") file.Write(" return static_cast<uint32>(\n") file.Write(" sizeof(ValueType) + ComputeDataSize(s)); // NOLINT\n") file.Write(" }\n") file.Write("\n")
475,876
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")
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")
475,877
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")
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")
475,878
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")
def WriteImmediateCmdInit(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() args = func.GetCmdArgs() set_code = [] 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")
475,879
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")
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")
475,880
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")
def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s, uint32 _data_size) {\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")
475,881
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")
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, _data_size);\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")
475,882
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")
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(" return NextImmediateCmdAddress<ValueType>(" "cmd, _data_size);\n") file.Write(" }\n") file.Write("\n")
475,883
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")
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 data_size = strlen(name);\n") file.Write(" gles2::%s& c = GetImmediateCmdSpace<gles2::%s>(" "data_size);\n" % (func.name, func.name)) file.Write(" c.Init(%s);\n" % args) file.Write(" }\n\n")
475,884
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")
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, data_size);\n" % args) file.Write(" }\n\n")
475,885
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")
def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" init_code = [] check_code = [] 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")
475,886
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")
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: init_code.append(" 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")
475,887
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")
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 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")
475,888
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")
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 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")
475,889
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")
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: check_code.append(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);" % (arg.type, value, arg.name)) value += 1 file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n")
475,890
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")
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")
475,891
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")
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)\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")
475,892
def GetImmediateVersion(self): """Gets the immediate version of this argument.""" return self
def GetImmediateVersion(self): """Gets the immediate version of this argument.""" return self
475,893
def __init__(self, name, type): Argument.__init__(self, name, "GLenum")
def __init__(self, name, type): Argument.__init__(self, name, "GLenum")
475,894
def __init__(self, name, type): Argument.__init__(self, name, "GLint")
def __init__(self, name, type): Argument.__init__(self, name, "GLint")
475,895
def __init__(self, name, type): type = type.replace("GLResourceId", "GLuint") Argument.__init__(self, name, type)
def __init__(self, name, type): match = re.match("(GLid\w+)", type) self.resource_type = match.group(1)[4:] type = type.replace(match.group(1), "GLuint") Argument.__init__(self, name, type)
475,896
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]))
def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1])) else: return PointerArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) # Is this a resource argument? Must come after pointer check. elif arg_parts[0].startswith('GLid'): return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif arg_parts[0].startswith('GLenum') and len(arg_parts[0]) > 6: return EnumArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) elif (arg_parts[0].startswith('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]))
475,897
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]))
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]))
475,898
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")
475,899