rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
def MakeGuard(self, filename): """Creates a header guard id.""" base = os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))) hpath = os.path.abspath(filename)[len(base) + 1:] return self._non_alnum_re.sub('_', hpath).upper()
def WriteNamespaceClose(self, file): """Writes the code to close the namespace.""" file.Write("} // namespace gles2\n") file.Write("} // namespace gpu\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file)
file = CHeaderWriter(filename)
def WriteCommandIds(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file) file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") for func in self.functions: if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) file.Write(" %-60s /* %d */ \\\n" % ("OP(%s)" % func.name, _CMD_ID_TABLE[func.name])) file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file)
file = CHeaderWriter(filename)
def WriteFormat(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file)
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
def WriteFormat(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file)
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file) file.Write("// This file contains unit tests for gles2 commmands\n") file.Write("// It is included by gles2_cmd_format_test.cc\n") file.Write("\n")
file = CHeaderWriter( filename, "// This file contains unit tests for gles2 commmands\n" "// It is included by gles2_cmd_format_test.cc\n" "\n")
def WriteFormatTest(self, filename): """Writes the command buffer format test.""" file = CWriter(filename) self.WriteHeader(file) file.Write("// This file contains unit tests for gles2 commmands\n") file.Write("// It is included by gles2_cmd_format_test.cc\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) file.Write("// This file contains unit tests for gles2 commmand ids\n") file.Write("\n")
file = CHeaderWriter( filename, "// This file contains unit tests for gles2 commmand ids\n")
def WriteCommandIdTest(self, filename): """Writes the command id test.""" file = CWriter(filename) file.Write("// This file contains unit tests for gles2 commmand ids\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename)
file = CHeaderWriter(filename)
def WriteCmdHelperHeader(self, filename): """Writes the gles2 command helper.""" file = CWriter(filename)
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file) file.Write("// It is included by gles2_cmd_decoder.cc\n") file.Write("\n")
file = CHeaderWriter( filename, "// It is included by gles2_cmd_decoder.cc\n")
def WriteServiceImplementation(self, filename): """Writes the service decorder implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("// It is included by gles2_cmd_decoder.cc\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file) file.Write("\n") file.Write("// These functions emluate GLES2 over command buffers.\n") file.Write("\n") file.Write("\n")
file = CHeaderWriter( filename, "// These functions emluate GLES2 over command buffers.\n")
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") file.Write("// These functions emluate GLES2 over command buffers.\n") file.Write("\n") file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file) file.Write( "// This file is included by gles2_implementation.h to declare the\n") file.Write("// GL api functions.\n")
file = CHeaderWriter( filename, "// This file is included by gles2_implementation.h to declare the\n" "// GL api functions.\n")
def WriteGLES2ImplementationHeader(self, filename): """Writes the GLES2 helper header.""" file = CWriter(filename) self.WriteHeader(file) file.Write( "// This file is included by gles2_implementation.h to declare the\n") file.Write("// GL api functions.\n") for func in self.original_functions: func.WriteGLES2ImplementationHeader(file) file.Close()
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteLicense(file) file.Write("\n") file.Write("// A class to emluate GLES2 over command buffers.\n") file.Write("\n")
file = CHeaderWriter( filename, "// A class to emluate GLES2 over command buffers.\n")
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CWriter(filename) self.WriteLicense(file) file.Write("\n") file.Write("// A class to emluate GLES2 over command buffers.\n") file.Write("\n") file.Write( "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") file.Write("\n") self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write("\n")
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CWriter(filename) self.WriteLicense(file) file.Write("\n") file.Write("// A class to emluate GLES2 over command buffers.\n") file.Write("\n") file.Write( "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") file.Write("\n") self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n")
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file) file.Write("\n")
file = CHeaderWriter(filename)
def WriteServiceUtilsHeader(self, filename): """Writes the gles2 auto generated utility header.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum) file.Write("\n") file.Close()
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum)
file.Write("bool Validate%s%s(GLenum value);\n" % (_ENUM_LISTS[enum]['type'], enum))
def WriteServiceUtilsHeader(self, filename): """Writes the gles2 auto generated utility header.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum) file.Write("\n") file.Close()
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file = CWriter(filename) self.WriteHeader(file) file.Write("\n")
file = CHeaderWriter(filename)
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum)
file.Write("bool Validate%s%s(GLenum value) {\n" % (_ENUM_LISTS[enum]['type'], enum))
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
for value in _ENUM_LISTS[enum]:
for value in _ENUM_LISTS[enum]['valid']:
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
20d6af8de9f49c5a4b9a5d098840a1523ad90cb6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/20d6af8de9f49c5a4b9a5d098840a1523ad90cb6/build_gles2_cmd_buffer.py
def fix_glsl_body(body, input_mapping): # Change uniform names back to original. for match in re.findall(r'(?m)^uniform (?:\w+) (\w+)', body): body = re.sub(r'\b%s\b' % match, input_mapping[match], body) # Change attribute names back to original. for match in re.findall(r'(?m)^attribute (?:\w+) (\w+)', body): attr_name = input_mapping[match] assert attr_name.startswith('$vin.') orig_name = ATTRIBUTES_TO_SEMANTICS[attr_name[len('$vin.'):]] body = re.sub(r'\b%s\b' % match, orig_name, body) # Change vecN blah[N]; to matN blah; body = re.sub(r'(?m)^uniform vec(\d) (\w+)\[\1\];', r'uniform mat\1 \2;', body) attributes = [] if 'gl_Vertex' in body: # Change gl_Vertex to position and add attribute declaration. body = re.sub(r'\bgl_Vertex\b', 'position', body) attributes.append('attribute vec4 position;') for n in xrange(8): if 'gl_MultiTexCoord%d' % n in body: # Change gl_MultiTexCoordN (0<=N<=7) to texcoordN and add attribute # declaration. body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texcoord%d' % n, body) attributes.append('attribute vec4 texcoord%d;' % n) # ATTRIBUTES_TO_SEMANTICS should have taken care of normals. assert 'gl_Normal' not in body if 'gl_Position' in body: # If there is exactly one assignment to gl_Position, modify it similar to # how RewriteVertexProgramSource in gl/effect_gl.cc does it. The input is # taken from vec4 dx_clipping uniform. # # If there is more than one gl_Position mentioned in the shader, the # converter fails. assert len(re.findall('gl_Position', body)) == 1 attributes.append('vec4 _glPositionTemp;') attributes.append('uniform vec4 dx_clipping;') body = re.sub(r'\bgl_Position\b([^;]*);', r'_glPositionTemp\1; gl_Position = vec4(' + r'_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, ' + r'dx_clipping.w * ' + r'(_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), ' + r'_glPositionTemp.z * 2.0 - _glPositionTemp.w, ' + r'_glPositionTemp.w);', body) return '\n'.join(attributes) + '\n\n' + body
5bc7c0df9dd608a5f5fba706b6e1455b01c7b371 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5bc7c0df9dd608a5f5fba706b6e1455b01c7b371/convert.py
body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texcoord%d' % n, body) attributes.append('attribute vec4 texcoord%d;' % n)
body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texCoord%d' % n, body) attributes.append('attribute vec4 texCoord%d;' % n)
def fix_glsl_body(body, input_mapping): # Change uniform names back to original. for match in re.findall(r'(?m)^uniform (?:\w+) (\w+)', body): body = re.sub(r'\b%s\b' % match, input_mapping[match], body) # Change attribute names back to original. for match in re.findall(r'(?m)^attribute (?:\w+) (\w+)', body): attr_name = input_mapping[match] assert attr_name.startswith('$vin.') orig_name = ATTRIBUTES_TO_SEMANTICS[attr_name[len('$vin.'):]] body = re.sub(r'\b%s\b' % match, orig_name, body) # Change vecN blah[N]; to matN blah; body = re.sub(r'(?m)^uniform vec(\d) (\w+)\[\1\];', r'uniform mat\1 \2;', body) attributes = [] if 'gl_Vertex' in body: # Change gl_Vertex to position and add attribute declaration. body = re.sub(r'\bgl_Vertex\b', 'position', body) attributes.append('attribute vec4 position;') for n in xrange(8): if 'gl_MultiTexCoord%d' % n in body: # Change gl_MultiTexCoordN (0<=N<=7) to texcoordN and add attribute # declaration. body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texcoord%d' % n, body) attributes.append('attribute vec4 texcoord%d;' % n) # ATTRIBUTES_TO_SEMANTICS should have taken care of normals. assert 'gl_Normal' not in body if 'gl_Position' in body: # If there is exactly one assignment to gl_Position, modify it similar to # how RewriteVertexProgramSource in gl/effect_gl.cc does it. The input is # taken from vec4 dx_clipping uniform. # # If there is more than one gl_Position mentioned in the shader, the # converter fails. assert len(re.findall('gl_Position', body)) == 1 attributes.append('vec4 _glPositionTemp;') attributes.append('uniform vec4 dx_clipping;') body = re.sub(r'\bgl_Position\b([^;]*);', r'_glPositionTemp\1; gl_Position = vec4(' + r'_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, ' + r'dx_clipping.w * ' + r'(_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), ' + r'_glPositionTemp.z * 2.0 - _glPositionTemp.w, ' + r'_glPositionTemp.w);', body) return '\n'.join(attributes) + '\n\n' + body
5bc7c0df9dd608a5f5fba706b6e1455b01c7b371 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/5bc7c0df9dd608a5f5fba706b6e1455b01c7b371/convert.py
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
8b9587d42ad15f4c9f9fe725fde213e8d474ddaa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/8b9587d42ad15f4c9f9fe725fde213e8d474ddaa/build.py
result = result[content_start:content_end + len(_expected_output_postamble)] + "\n"
postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n"
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
8b9587d42ad15f4c9f9fe725fde213e8d474ddaa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/8b9587d42ad15f4c9f9fe725fde213e8d474ddaa/build.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testZip(self): """Download a zip and verify that it downloaded correctly. Also verify that the download shelf showed up. """ test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testZipInIncognito(self): """Download and verify a zip in incognito window.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testSaveDangerousFile(self): """Verify that we can download and save a dangerous file.""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testDeclineDangerousDownload(self): """Verify that we can decline dangerous downloads""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testRemoveDownload(self): """Verify that we can remove a download.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testBigZip(self): """Verify that we can download a 1GB file.
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(expected_filename) and os.remove(expected_filename)
self._ClearLocalDownloadState(expected_filename)
def testFileRenaming(self): """Test file renaming when downloading a already-existing filename.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = 'file://%s' % os.path.join(test_dir, 'a_zip_file.zip') download_dir = self.GetDownloadDirectory().value()
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_file) and os.remove(downloaded_file)
self._ClearLocalDownloadState(downloaded_file)
def _CreateFile(name): """Create and fill the given file with some junk.""" fp = open(name, 'w') # name could be unicode print >>fp, 'This is a junk file named %s. ' % repr(name) * 100 fp.close()
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testNoUnsafeDownloadsOnRestart(self): """Verify that unsafe file should not show up on session restart.""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self.assertTrue(self.IsDownloadShelfVisible()) # Restart the browser and assert that the download was removed. self.RestartBrowser(clear_profile=False) self.assertFalse(os.path.exists(downloaded_pkg)) self.assertFalse(self.IsDownloadShelfVisible()) self.NavigateToURL("chrome://downloads") self.assertFalse(self.GetDownloadsInfo().Downloads())
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testPauseAndResume(self): """Verify that pause and resume work while downloading a file.
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testCancelDownload(self): """Verify that we can cancel a download.""" # Create a big file (250 MB) on the fly, so that the download won't finish # before being cancelled. file_path = self._MakeFile(2**28) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self.PerformActionOnDownload(self._GetDownloadId(), 'cancel') self._DeleteAfterShutdown(file_path)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testDownloadsPersistence(self): """Verify that download history persists on session restart.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(1, len(downloads)) self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) file_url = downloads[0]['url'] self.RestartBrowser(clear_profile=False) # Trigger the download service to get loaded after restart. self.NavigateToURL('chrome://downloads/') # Verify that there's no download shelf anymore. self.assertFalse(self.IsDownloadShelfVisible(), 'Download shelf persisted browser restart.') # Verify that the download history persists. downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(1, len(downloads)) self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) self.assertEqual(file_url, downloads[0]['url']) self._DeleteAfterShutdown(downloaded_pkg)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self._ClearLocalDownloadState(downloaded_pkg)
def testDownloadTheme(self): """Verify downloading and saving a theme file installs the theme.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'extensions') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'theme.crx')) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'theme.crx') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
b5612e1d043bb450479eccd2c082d6e2f4422522 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b5612e1d043bb450479eccd2c082d6e2f4422522/downloads.py
O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME,
O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME,
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_NPAPI_FILENAME = FLAGS.set_npapi_filename O3D_PLUGIN_NPAPI_MIMETYPE = FLAGS.set_npapi_mimetype O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID = FLAGS.set_activex_hostcontrol_clsid O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID = FLAGS.set_activex_typelib_clsid O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME = FLAGS.set_activex_hostcontrol_name O3D_PLUGIN_ACTIVEX_TYPELIB_NAME = FLAGS.set_activex_typelib_name if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginNpapiFilename@@@', O3D_PLUGIN_NPAPI_FILENAME), ('@@@PluginNpapiMimeType@@@', O3D_PLUGIN_NPAPI_MIMETYPE), ('@@@PluginActiveXHostControlClsid@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID), ('@@@PluginActiveXTypeLibClsid@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID), ('@@@PluginActiveXHostControlName@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME), ('@@@PluginActiveXTypeLibName@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_NAME), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
c8175ebacc4ab1518f518b9358fe9999f35bca7a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/c8175ebacc4ab1518f518b9358fe9999f35bca7a/version_info.py
raise Exception("RenderPage called with empty name");
raise Exception("RenderPage called with empty name")
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
original = None;
original = None
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
open(input_file, 'wb').write(result);
open(input_file, 'wb').write(result)
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
return set(os.path.splitext(file)[0] for file in static_files if file.endswith(".html"))
return set(os.path.splitext(file_name)[0] for file_name in static_files if file_name.endswith(".html"))
def GetStaticFileNames(): static_files = os.listdir(_static_dir) return set(os.path.splitext(file)[0] for file in static_files if file.endswith(".html"))
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
"Please run the build.bat script.");
"Please run the build.bat script.")
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
print f;
print f
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log");
time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log")
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
return 0;
return os.EX_OK
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
747e1347b0e946512c0d150a9c27409c981ad637 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/747e1347b0e946512c0d150a9c27409c981ad637/build.py
symbol_file = 'chrome.breakpad.ia64'
symbol_file = 'chrome.breakpad.x64'
def main_linux(options, args): # minidump_stackwalk is part of Google Breakpad. You may need to checkout # the code and build your own copy. http://google-breakpad.googlecode.com/ LINUX_PROCESSOR = 'minidump_stackwalk' processor_bin = None if options.processor_dir: bin = os.path.join(os.path.expanduser(options.processor_dir), LINUX_PROCESSOR) if os.access(bin, os.X_OK): processor_bin = bin else: for path in os.environ['PATH'].split(':'): bin = os.path.join(path, LINUX_PROCESSOR) if os.access(bin, os.X_OK): processor_bin = bin break if not processor_bin: print 'Cannot find minidump_stackwalk.' return 1 if options.architecture: bits = options.architecture else: bits = struct.calcsize('P') * 8 if bits == 32: symbol_file = 'chrome.breakpad.ia32' elif bits == 64: symbol_file = 'chrome.breakpad.ia64' else: print 'Unknown architecture' return 1 symbol_dir = options.symbol_dir if not options.symbol_dir: symbol_dir = os.curdir symbol_dir = os.path.abspath(os.path.expanduser(symbol_dir)) symbol_file = os.path.join(symbol_dir, symbol_file) if not os.path.exists(symbol_file): print 'Cannot find symbols.' return 1 symbol_time = os.path.getmtime(symbol_file) dump_files = [] if options.dump_file: dump_files.append(options.dump_file) else: dump_dir = options.dump_dir if not dump_dir: dump_dir = GetCrashDumpDir() if not dump_dir: print 'Cannot find dump files.' return 1 for dump_file in LocateFiles(pattern='*.dmp', root=dump_dir): file_time = os.path.getmtime(dump_file) if file_time < symbol_time: # Ignore dumps older than symbol file. continue dump_files.append(dump_file) temp_dir = tempfile.mkdtemp(suffix='chromedump') if not VerifySymbolAndCopyToTempDir(symbol_file, temp_dir): print 'Cannot parse symbols.' shutil.rmtree(temp_dir) return 1 dump_count = 0 for dump_file in dump_files: processed_dump_file = ProcessDump(dump_file, temp_dir) if not processed_dump_file: continue print '-------------------------' print GetStackTrace(processor_bin, temp_dir, processed_dump_file) print os.remove(processed_dump_file) dump_count += 1 shutil.rmtree(temp_dir) print '%s dumps found' % dump_count return 0
23d25ac9cec199beaa4a114e3a523b52f314e254 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/23d25ac9cec199beaa4a114e3a523b52f314e254/process_dumps_linux.py
if 'regress' in perf_data[key]: if 'improve' not in perf_data[key]: bad_keys.append(key) if (not isinstance(perf_data[key]['regress'], int) and not isinstance(perf_data[key]['regress'], float)): bad_keys.append(key) if (not isinstance(perf_data[key]['improve'], int) and not isinstance(perf_data[key]['improve'], float)): bad_keys.append(key) else: if 'delta' not in perf_data[key] or 'var' not in perf_data[key]: bad_keys.append(key) if (not isinstance(perf_data[key]['delta'], int) and not isinstance(perf_data[key]['delta'], float)): bad_keys.append(key) if (not isinstance(perf_data[key]['var'], int) and not isinstance(perf_data[key]['var'], float)): bad_keys.append(key)
if 'delta' not in perf_data[key] or 'var' not in perf_data[key]: bad_keys.append(key) if (not isinstance(perf_data[key]['delta'], int) and not isinstance(perf_data[key]['delta'], float)): bad_keys.append(key) if (not isinstance(perf_data[key]['var'], int) and not isinstance(perf_data[key]['var'], float)): bad_keys.append(key)
def testPerfExpectations(self): perf_data = LoadData()
97ffcd5e9694a4ce90b87c2119bc06825b11e960 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/97ffcd5e9694a4ce90b87c2119bc06825b11e960/perf_expectations_unittest.py
self.races = []
self.reports = []
def __init__(self, source_dir, files): '''Reads in a set of files.
3c013d85adbf98cad2aa5710b44488856eb85686 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/3c013d85adbf98cad2aa5710b44488856eb85686/drmemory_analyze.py
self.races.append(tmp)
self.reports.append(tmp) elif self.line_.startswith("ASSERT FAILURE"): self.reports.append(self.line_.strip())
def ParseReportFile(self, filename): self.cur_fd_ = open(filename, 'r')
3c013d85adbf98cad2aa5710b44488856eb85686 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/3c013d85adbf98cad2aa5710b44488856eb85686/drmemory_analyze.py
if len(self.races) > 0: logging.error("Found %i error reports" % len(self.races)) for report_list in self.races:
if len(self.reports) > 0: logging.error("Found %i error reports" % len(self.reports)) for report_list in self.reports:
def Report(self, check_sanity): sys.stdout.flush() #TODO(timurrrr): support positive tests / check_sanity==True
3c013d85adbf98cad2aa5710b44488856eb85686 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/3c013d85adbf98cad2aa5710b44488856eb85686/drmemory_analyze.py
os.putenv("LD_LIBRARY_PATH", self._options.build_dir)
if (os.getenv("LD_LIBRARY_PATH")): os.putenv("LD_LIBRARY_PATH", "%s:%s" % (os.getenv("LD_LIBRARY_PATH"), self._options.build_dir)) else: os.putenv("LD_LIBRARY_PATH", self._options.build_dir)
def SimpleTest(self, module, name, valgrind_test_args=None, cmd_args=None): cmd = self._DefaultCommand(module, name, valgrind_test_args) self._ReadGtestFilterFile(name, cmd) if cmd_args: cmd.extend(["--"]) cmd.extend(cmd_args)
e26681857433768acbc503462bf0681719df0260 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/e26681857433768acbc503462bf0681719df0260/chrome_tests.py
if path.startswith('ie\\') or path.startswith('common\\'):
if (ie_paths_re.match(path)):
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 = [] for f in input_api.AffectedFiles(include_deletes = False): path = f.LocalPath() if path.startswith('ie\\') or path.startswith('common\\'): 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
4f8bdff2472dccf3c5e18aa88769cb907fbe1b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/4f8bdff2472dccf3c5e18aa88769cb907fbe1b71/ceee_presubmit.py
overide_config_name = 'chromium.sync-branch' override_branch_name = RunGit(['config', '--get', overide_config_name])
override_branch_name = GetOverrideShortBranchName()
def GetGClientBranchName(): """Returns the name of the magic branch that lets us know that DEPS is managing the update cycle.""" # Is there an override branch specified? overide_config_name = 'chromium.sync-branch' override_branch_name = RunGit(['config', '--get', overide_config_name]) if not override_branch_name: return 'refs/heads/gclient' # No override, so return the default branch. # Verify that the branch from config exists. ref_branch = 'refs/heads/' + override_branch_name current_head = RunGit(['show-ref', '--hash', ref_branch]) if current_head: return ref_branch # Inform the user about the problem and how to fix it. print ("The specified override branch ('%s') doesn't appear to exist." % override_branch_name) print "Please fix your git config value '%s'." % overide_config_name sys.exit(1)
2fc2546019208ea2784e6215856dd6cec50dfa4d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/2fc2546019208ea2784e6215856dd6cec50dfa4d/sync-webkit-git.py
subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt'))
subprocess.check_call(['git', 'fetch', GetRemote()], shell=(os.name == 'nt'))
def UpdateGClientBranch(webkit_rev, magic_gclient_branch): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', magic_gclient_branch]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', magic_gclient_branch, target], shell=(os.name == 'nt')) return True
2fc2546019208ea2784e6215856dd6cec50dfa4d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/2fc2546019208ea2784e6215856dd6cec50dfa4d/sync-webkit-git.py
output += "Suppression (error hash=
output += "Suppression (error hash=
def __str__(self): ''' Pretty print the type and backtrace(s) of this specific error, including suppression (which is just a mangled backtrace).''' output = "" if (self._commandline): output += self._commandline + "\n"
6839697d91ea795df5471a1e0c3328dd14172e00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6839697d91ea795df5471a1e0c3328dd14172e00/memcheck_analyze.py
cur_report_errors.add("This error was already printed " "in some other test, see 'hash=
cur_report_errors.add("This error was already printed in " "some other test, see 'hash=
def Report(self, files, check_sanity=False): '''Reads in a set of files and prints Memcheck report.
6839697d91ea795df5471a1e0c3328dd14172e00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/6839697d91ea795df5471a1e0c3328dd14172e00/memcheck_analyze.py
crx_file = os.path.join(self.DataDir(), 'extensions', 'theme.crx')
crx_file = os.path.abspath( os.path.join(self.DataDir(), 'extensions', 'theme.crx'))
def testSetTheme(self): """Verify theme install.""" self.assertFalse(self.GetThemeInfo()) # Verify there's no theme at startup crx_file = os.path.join(self.DataDir(), 'extensions', 'theme.crx') self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file))) theme = self.GetThemeInfo() self.assertEqual('camo theme', theme['name']) # TODO: verify "theme installed" infobar
a8f954dd8c406aeb4323c7c1a70a7ef87f1e5efa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a8f954dd8c406aeb4323c7c1a70a7ef87f1e5efa/themes.py
crx_file = os.path.join(self.DataDir(), 'extensions', 'theme.crx')
crx_file = os.path.abspath( os.path.join(self.DataDir(), 'extensions', 'theme.crx'))
def testThemeReset(self): """Verify theme reset.""" crx_file = os.path.join(self.DataDir(), 'extensions', 'theme.crx') self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file))) self.assertTrue(self.ResetToDefaultTheme()) self.assertFalse(self.GetThemeInfo())
a8f954dd8c406aeb4323c7c1a70a7ef87f1e5efa /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a8f954dd8c406aeb4323c7c1a70a7ef87f1e5efa/themes.py
num_invalid_values = arg.GetNumInvalidValues()
num_invalid_values = arg.GetNumInvalidValues(func)
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues() for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
"""Writes the GLES2 Implemention declaration."""
"""Writes the GLES2 Implemention."""
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
self.WriteGLES2ImplementationDeclaration(func, file)
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
impl_func = func.GetInfo('impl_func') if impl_func == None or impl_func == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" typedef %s::Result Result;\n" % func.original_name) file.Write(" Result* result = GetResultAs<Result*>();\n") file.Write(" *result = 0;\n") arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return *result;\n") file.Write("}\n") file.Write("\n") else: self.WriteGLES2ImplementationDeclaration(func, file)
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
code = """%(return_type)s %(func_name)s(%(args)s) { helper_->SetBucketSize(kResultBucketId, 0); helper_->%(func_name)s(%(id_name)s, kResultBucketId); std::string str; if (GetBucketAsString(kResultBucketId, &str)) { GLsizei max_size = std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size()); if (%(length_name)s != NULL) { *%(length_name)s = max_size; } memcpy(%(dest_name)s, str.c_str(), max_size); %(dest_name)s[max_size] = '\\0'; } } """ args = func.GetOriginalArgs() file.Write(code % { 'return_type': func.return_type, 'func_name': func.original_name, 'args': func.MakeTypedOriginalArgString(""), 'id_name': args[0].name, 'bufsize_name': args[1].name, 'length_name': args[2].name, 'dest_name': args[3].name, })
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
file.Write("// TODO(gman): %s\n\n" % func.name) def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
valid_test = """ TEST_F(%(test_name)s, %(name)sValidArgs) { const char* kInfo = "hello"; const uint32 kBucketId = 123; SpecializedSetup<%(name)s, 0>(); %(expect_len_code)s EXPECT_CALL(*gl_, %(gl_func_name)s(%(gl_args)s)) .WillOnce(DoAll(SetArgumentPointee<2>(strlen(kInfo)), SetArrayArgument<3>(kInfo, kInfo + strlen(kInfo) + 1))); %(name)s cmd; cmd.Init(%(args)s); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId); ASSERT_TRUE(bucket != NULL); EXPECT_EQ(strlen(kInfo) + 1, bucket->size()); EXPECT_EQ(0, memcmp(bucket->GetData(0, bucket->size()), kInfo, bucket->size())); } """ args = func.GetOriginalArgs() id_name = args[0].GetValidGLArg(0, 0) get_len_func = func.GetInfo('get_len_func') get_len_enum = func.GetInfo('get_len_enum') sub = { 'id_name': id_name, 'get_len_func': get_len_func, 'get_len_enum': get_len_enum, 'gl_args': '%s, strlen(kInfo) + 1, _, _' % args[0].GetValidGLArg(0, 0), 'args': '%s, kBucketId' % args[0].GetValidArg(0, 0), 'expect_len_code': '', } if get_len_func[0:2] == 'gl': sub['expect_len_code'] = ( " EXPECT_CALL(*gl_, %s(%s, %s, _))\n" " .WillOnce(SetArgumentPointee<2>(strlen(kInfo)));") % ( get_len_func[2:], id_name, get_len_enum) self.WriteValidUnitTest(func, file, valid_test, sub) invalid_test = """ TEST_F(%(test_name)s, %(name)sInvalidArgs) { const uint32 kBucketId = 123; EXPECT_CALL(*gl_, %(gl_func_name)s(_, _, _, _)) .Times(0); %(name)s cmd; cmd.Init(kInvalidClientId, kBucketId); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); } """ self.WriteValidUnitTest(func, file, invalid_test)
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3]
args = func.GetCmdArgs() id_arg = args[0] bucket_arg = args[1] id_arg.WriteGetCode(file) bucket_arg.WriteGetCode(file) id_arg.WriteValidationCode(file) file.Write(" GLint len = 0;\n") file.Write(" %s(%s, %s, &len);\n" % ( func.GetInfo('get_len_func'), id_arg.name, func.GetInfo('get_len_enum'))) file.Write(" Bucket* bucket = CreateBucket(%s);\n" % bucket_arg.name) file.Write(" bucket->SetSize(len + 1);\n");
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
" %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file)
" %s(%s, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));\n" % (func.GetGLFunctionName(), id_arg.name))
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" return 0
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
pass def WriteClientSideValidationCode(self, file): """Writes the validation code for an argument.""" pass
def WriteValidationCode(self, file): """Writes the validation code for an argument.""" if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """overridden from Argument.""" return 1
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
"""returns an invalid value and expected parse result by index."""
"""overridden from Argument."""
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
"""Base calss for EnumArgument, IntArgument and BoolArgument"""
"""Base class for EnumArgument, IntArgument and BoolArgument"""
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] return len(invalid) return 0
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
return (invalid[index], "kNoError", self.gl_error) return ("---ERROR1---", "kNoError", self.gl_error)
def GetInvalidArg(self, offset, index): """returns an invalid value by index.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] num_invalid = len(invalid) if index >= num_invalid: index = num_invalid - 1 return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
def GetNumInvalidValues(self):
def GetNumInvalidValues(self, func):
def GetNumInvalidValues(self): """Overridden from Argument.""" return 2
a5eba71687a62fcb4b39f5733a699dba889f0b71 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/a5eba71687a62fcb4b39f5733a699dba889f0b71/build_gles2_cmd_buffer.py
_NAME_RE = re.compile('[A-Za-z0-9_]+')
_NAME_RE = re.compile('^[A-Za-z0-9_]+$')
def ToTclibMessage(self): msg = grit.extern.tclib.Message( 'utf-8', id=self.id, meaning=self.meaning) self.FillTclibBaseMessage(msg) return msg
ff27fe969340f7ab35292dcbaa55ee562c3f6903 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/ff27fe969340f7ab35292dcbaa55ee562c3f6903/tclib.py
output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path'])
if webgl_mode: output_file.write(" '../o3d_assets/samples/%s.fake_webgl_input.txt',\n" % asset['path']) else: output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path'])
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
51cf61ff968587decf4da988cafbff403b2ef34b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/51cf61ff968587decf4da988cafbff403b2ef34b/samples_gen.py
write_action(asset, False);
write_action(asset, False)
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
51cf61ff968587decf4da988cafbff403b2ef34b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/51cf61ff968587decf4da988cafbff403b2ef34b/samples_gen.py
write_action(asset, True); output_file.write(" ],\n")
write_action(asset, True) output_file.write(""" ], }, { 'target_name': 'copy_samples', 'type': 'none', 'dependencies': [ 'convert_samples', ], 'copies': [\n""")
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
51cf61ff968587decf4da988cafbff403b2ef34b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/51cf61ff968587decf4da988cafbff403b2ef34b/samples_gen.py
output_file.write(" 'copies': [\n")
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
51cf61ff968587decf4da988cafbff403b2ef34b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/51cf61ff968587decf4da988cafbff403b2ef34b/samples_gen.py
"--ui-test-action-max-timeout=180000",
"--ui-test-action-max-timeout=280000",
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=180000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=240000", "--ui-test-action-timeout=120000", "--ui-test-action-max-timeout=180000", "--ui-test-sleep-timeout=120000", "--ui-test-terminate-timeout=120000"])
b93f87a5b876ef9a5a08906d7f79772ed08de1bb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/b93f87a5b876ef9a5a08906d7f79772ed08de1bb/chrome_tests.py
def __init__(self, solution, projects, tests): self._projects = projects self._tests = tests self._saved_autohides = None self._solution = win32com.client.GetObject(solution) self._dte = self._GetDte(self._solution)
f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d/smoke_test.py
except pythoncom.com_error, e: print 'Exception from solution.DTE "%s", retrying: ' % str(e) time.sleep(2.0)
except pythoncom.com_error: logging.exception('Exception getting DTE, retrying') time.sleep(10.0)
def _GetDte(self, solution): '''Sometimes invoking solution.DTE will fail with an exception during Visual Studio initialization. To work around this, we try a couple of times with an intervening sleep to give VS time to settle.''' # Attempt ten times under a try block. for i in range(0, 10): try: return solution.DTE except pythoncom.com_error, e: # Sleep for 2 seconds print 'Exception from solution.DTE "%s", retrying: ' % str(e) time.sleep(2.0)
f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d/smoke_test.py
print 'Building project "%s" in "%s" configuration' % (project, config)
logging.info('Building project "%s" in "%s" configuration', project, config)
def BuildConfig(self, config): '''Builds all projects for a given config.
f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d/smoke_test.py
runner = TestRunner(_CHROME_SOLUTION, _PROJECTS_TO_BUILD, _TESTS_TO_RUN)
parser = GetOptionParser() (options, args) = parser.parse_args() if args: parser.error('This script takes no arguments') solution = options.solution if not os.path.exists(solution): solution = os.path.join(os.path.dirname(_CHROME_SOLUTION), solution) solution = solution + '.sln' solution = os.path.abspath(solution) runner = TestRunner(solution, _PROJECTS_TO_BUILD, _TESTS_TO_RUN)
def Main(): if not ctypes.windll.shell32.IsUserAnAdmin(): print ("Please run the smoke tests in an admin prompt " "(or AppVerifier won't work).") return 1 runner = TestRunner(_CHROME_SOLUTION, _PROJECTS_TO_BUILD, _TESTS_TO_RUN) failures = 0 for config in _CONFIGURATIONS: failures += runner.BuildConfig(config) if failures != 0: print '%d build errors' % failures return failures for config in _CONFIGURATIONS: failures += runner.RunConfigTests(config) if failures != 0: print '%d unittests failed' % failures return failures
f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/f88982b8c53b8b5b6e0a2bf8165f4eb217dca08d/smoke_test.py
if name == 'BufferData':
if name == 'BufferData' or name == 'BufferSubData':
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D':
elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'):
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n")
elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size; if (!GLES2Util::ComputeImageDataSize( width, height, format, type, unpack_alignment_, &data_size)) { return error::kOutOfBounds; } """ file.Write(code)
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
code = """ uint32 data_size; if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { return error::kOutOfBounds; } """ file.Write(code)
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
code = """ uint32 data_size; if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { return error::kOutOfBounds; } """ file.Write(code)
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
file.Write(" %s params;\n" % last_arg.type) file.Write(" GLsizei num_values = util_.GLGetNumValuesReturned(pname);\n") file.Write(" uint32 params_size = num_values * sizeof(*params);\n") file.Write(" params = GetSharedMemoryAs<%s>(\n" % last_arg.type) file.Write(" c.params_shm_id, c.params_shm_offset, params_size);\n")
code = """ %(last_arg_type)s params; GLsizei num_values = util_.GLGetNumValuesReturned(pname); uint32 params_size; if (!SafeMultiplyUint32(num_values, sizeof(*params), &params_size)) { return error::kOutOfBounds; } params = GetSharedMemoryAs<%(last_arg_type)s>( c.params_shm_id, c.params_shm_offset, params_size); """ file.Write(code % {'last_arg_type': last_arg.type})
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg()
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
code = """ uint32 data_size; if (!ComputeDataSize(1, sizeof(%s), %d, &data_size)) { return error::kOutOfBounds; } """ file.Write(code % (func.info.data_type, func.info.count)) if func.is_immediate: file.Write(" if (data_size > immediate_data_size) {\n") file.Write(" return error::kOutOfBounds;\n") file.Write(" }\n")
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
code = """ uint32 data_size; if (!ComputeDataSize(1, sizeof(%s), %d, &data_size)) { return error::kOutOfBounds; } """ file.Write(code % (func.info.data_type, func.info.count)) if func.is_immediate: file.Write(" if (data_size > immediate_data_size) {\n") file.Write(" return error::kOutOfBounds;\n") file.Write(" }\n")
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
std::string str; if (GetBucketAsString(kResultBucketId, &str)) { GLsizei max_size = std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size()); if (%(length_name)s != NULL) { *%(length_name)s = max_size;
if (bufsize > 0) { std::string str; if (GetBucketAsString(kResultBucketId, &str)) { GLsizei max_size = std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size()); if (%(length_name)s != NULL) { *%(length_name)s = max_size; } memcpy(%(dest_name)s, str.c_str(), max_size); %(dest_name)s[max_size] = '\\0';
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
memcpy(%(dest_name)s, str.c_str(), max_size); %(dest_name)s[max_size] = '\\0';
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
1f35d386075e8cecf4b328e98191a11effa0fd1a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/1f35d386075e8cecf4b328e98191a11effa0fd1a/build_gles2_cmd_buffer.py
self.DownloadAndWaitForStart(file_url) self.WaitForAllDownloadsToComplete() unzip_file_name = os.path.join(self.GetDownloadDirectory().value(), 'a_file.txt')
file_url2 = self.GetFileURLForDataPath(os.path.join('zip', 'test.zip')) unzip_path = os.path.join(self.GetDownloadDirectory().value(), 'test', 'foo') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) os.path.exists(unzip_path) and pyauto_utils.RemovePath(unzip_path) self.DownloadAndWaitForStart(file_url2) self.WaitForAllDownloadsToComplete()
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
397f4abe32055ca0ed405c500388524c05c9fd8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/397f4abe32055ca0ed405c500388524c05c9fd8d/downloads.py
self.assertTrue(self.WaitUntil(lambda: os.path.exists(unzip_file_name)),
self.assertTrue(self.WaitUntil(lambda: os.path.exists(unzip_path)),
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
397f4abe32055ca0ed405c500388524c05c9fd8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/397f4abe32055ca0ed405c500388524c05c9fd8d/downloads.py
os.path.exists(unzip_file_name) and os.remove(unzip_file_name)
os.path.exists(unzip_path) and pyauto_utils.RemovePath(unzip_path)
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
397f4abe32055ca0ed405c500388524c05c9fd8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/397f4abe32055ca0ed405c500388524c05c9fd8d/downloads.py
time.sleep(1) downloads = self.GetDownloadsInfo().Downloads() percentage = downloads[0]['PercentComplete'] self.assertTrue(percentage > old_percentage, 'Download percentage value is not increasing')
def _PercentInc(): percent = self.GetDownloadsInfo().Downloads()[0]['PercentComplete'] return old_percentage == 100 or percent > old_percentage, self.assertTrue(self.WaitUntil(_PercentInc), msg='Download percentage value is not increasing')
def testDownloadPercentage(self): """Verify that during downloading, % values increases, and once download is over, % value is 100""" file_path = self._MakeFile(2**24) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) downloads = self.GetDownloadsInfo().Downloads() old_percentage = downloads[0]['PercentComplete'] # Wait for some time again re-check the download percentage time.sleep(1) downloads = self.GetDownloadsInfo().Downloads() percentage = downloads[0]['PercentComplete'] self.assertTrue(percentage > old_percentage, 'Download percentage value is not increasing') # Once download is completed, percentage is 100 self.WaitForAllDownloadsToComplete() downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(downloads[0]['PercentComplete'], 100, 'Download percentage should be 100 after download completed') os.path.exists(file_path) and os.remove(file_path) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
397f4abe32055ca0ed405c500388524c05c9fd8d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/397f4abe32055ca0ed405c500388524c05c9fd8d/downloads.py
license_path = os.path.join(path, filename)
if filename.startswith('/'): license_path = os.path.join(os.getcwd(), filename[1:]) else: license_path = os.path.join(path, filename)
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Parse metadata fields out of README.chromium. # We examine "LICENSE" for the license file by default. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } if path in SPECIAL_CASES: metadata.update(SPECIAL_CASES[path]) else: # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") for line in open(readme_path): line = line.strip() if not line: break for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium or licences.py " "SPECIAL_CASES") # Check that the license file exists. for filename in (metadata["License File"], "COPYING"): license_path = os.path.join(path, filename) if os.path.exists(license_path): metadata["License File"] = filename break license_path = None if not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to README.chromium " "with the appropriate path.") return metadata
8283b10cafab170f6dfd7f266163aefc223892fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/8283b10cafab170f6dfd7f266163aefc223892fe/licenses.py
metadata["License File"] = filename
metadata["License File"] = license_path
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Parse metadata fields out of README.chromium. # We examine "LICENSE" for the license file by default. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } if path in SPECIAL_CASES: metadata.update(SPECIAL_CASES[path]) else: # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") for line in open(readme_path): line = line.strip() if not line: break for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium or licences.py " "SPECIAL_CASES") # Check that the license file exists. for filename in (metadata["License File"], "COPYING"): license_path = os.path.join(path, filename) if os.path.exists(license_path): metadata["License File"] = filename break license_path = None if not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to README.chromium " "with the appropriate path.") return metadata
8283b10cafab170f6dfd7f266163aefc223892fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/8283b10cafab170f6dfd7f266163aefc223892fe/licenses.py
def ScanThirdPartyDirs(third_party_dirs):
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] if path in PRUNE_PATHS: dirs[:] = [] continue for skip in PRUNE_DIRS: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': for dir in dirs: dirpath = os.path.join(path, dir) if dirpath not in PRUNE_PATHS: third_party_dirs.append(dirpath) dirs[:] = [] continue return third_party_dirs def ScanThirdPartyDirs():
def ScanThirdPartyDirs(third_party_dirs): """Scan a list of directories and report on any problems we find.""" errors = [] for path in sorted(third_party_dirs): try: metadata = ParseDir(path) except LicenseError, e: errors.append((path, e.args[0])) continue for path, error in sorted(errors): print path + ": " + error
8283b10cafab170f6dfd7f266163aefc223892fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/8283b10cafab170f6dfd7f266163aefc223892fe/licenses.py
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] if path in PRUNE_PATHS: dirs[:] = [] continue for skip in PRUNE_DIRS: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': for dir in dirs: dirpath = os.path.join(path, dir) if dirpath not in PRUNE_PATHS: third_party_dirs.append(dirpath) dirs[:] = [] continue return third_party_dirs
return len(errors) == 0 def GenerateCredits(): """Generate about:credits, dumping the result to stdout.""" def EvaluateTemplate(template, env, escape=True): """Expand a template with variables like {{foo}} using a dictionary of expansions.""" for key, val in env.items(): if escape: val = cgi.escape(val) template = template.replace('{{%s}}' % key, val) return template third_party_dirs = FindThirdPartyDirs() entry_template = open('chrome/browser/resources/about_credits_entry.tmpl', 'rb').read() entries = [] for path in sorted(third_party_dirs): metadata = ParseDir(path) env = { 'name': metadata['Name'], 'url': metadata['URL'], 'license': open(metadata['License File'], 'rb').read(), } entries.append(EvaluateTemplate(entry_template, env)) file_template = open('chrome/browser/resources/about_credits.tmpl', 'rb').read() print EvaluateTemplate(file_template, {'entries': '\n'.join(entries)}, escape=False)
def ScanThirdPartyDirs(third_party_dirs): """Scan a list of directories and report on any problems we find.""" errors = [] for path in sorted(third_party_dirs): try: metadata = ParseDir(path) except LicenseError, e: errors.append((path, e.args[0])) continue for path, error in sorted(errors): print path + ": " + error
8283b10cafab170f6dfd7f266163aefc223892fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5060/8283b10cafab170f6dfd7f266163aefc223892fe/licenses.py