rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
with codecs.open(expectations_file, "r", "utf-8") as file: | with codecs.open(expectations_path, "r", "utf-8") as file: | def test_expectations(self): """Returns the test expectations for this port. |
overrides_file = self.path_from_chromium_base('webkit', 'tools', | overrides_path = self.path_from_chromium_base('webkit', 'tools', | def test_expectations_overrides(self): try: overrides_file = self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt') except AssertionError: return None if not os.path.exists(overrides_file): return None with codecs.open(overrides_file, "r", "utf-8") as file return file.read() |
if not os.path.exists(overrides_file): | if not os.path.exists(overrides_path): | def test_expectations_overrides(self): try: overrides_file = self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt') except AssertionError: return None if not os.path.exists(overrides_file): return None with codecs.open(overrides_file, "r", "utf-8") as file return file.read() |
with codecs.open(overrides_file, "r", "utf-8") as file | with codecs.open(overrides_path, "r", "utf-8") as file: | def test_expectations_overrides(self): try: overrides_file = self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt') except AssertionError: return None if not os.path.exists(overrides_file): return None with codecs.open(overrides_file, "r", "utf-8") as file return file.read() |
return self._executive.run_command(command) | try: return self._executive.run_command(command) except OSError, e: _pretty_patch_available = False return "Failed to run PrettyPatch: %s" % e | def pretty_patch_text(self, diff_path): pretty_patch_path = self.path_from_webkit_base("BugsSite", "PrettyPatch") prettify_path = os.path.join(pretty_patch_path, "prettify.rb") command = ["ruby", "-I", pretty_patch_path, prettify_path, diff_path] return self._executive.run_command(command) |
gl_func_name = func.GetGLFunctionName() if gl_func_name.startswith("gl"): gl_func_name = gl_func_name[2:] else: gl_func_name = func.name | gl_func_name = func.GetGLTestFunctionName() | def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues() for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" count = 0 for arg in func.GetOrigina... |
def _write_into_file_at_path(self, file_path, byte_array): """This method assumes that byte_array is already encoded into the right format.""" with open(file_path, "wb") as file: file.write(byte_array) | def _write_into_file_at_path(self, file_path, contents, encoding=None): """Writes contents at file_path, using encoding.""" with codecs.open(file_path, "w", encoding) as file: file.write(contents) | def _write_into_file_at_path(self, file_path, byte_array): """This method assumes that byte_array is already encoded into the right format.""" with open(file_path, "wb") as file: file.write(byte_array) |
self._write_into_file_at_path(actual_filename, output) | self._write_into_file_at_path(actual_filename, output, encoding) | def write_output_files(self, port, filename, file_type, output, expected, print_text_diffs=False): """Writes the test output, the expected output and optionally the diff between the two to files in the results directory. |
self._write_into_file_at_path(expected_filename, expected) | self._write_into_file_at_path(expected_filename, expected, encoding) | def write_output_files(self, port, filename, file_type, output, expected, print_text_diffs=False): """Writes the test output, the expected output and optionally the diff between the two to files in the results directory. |
self._write_into_file_at_path(diff_filename, diff.encode("utf-8")) | self._write_into_file_at_path(diff_filename, diff, encoding="utf-8") | def write_output_files(self, port, filename, file_type, output, expected, print_text_diffs=False): """Writes the test output, the expected output and optionally the diff between the two to files in the results directory. |
self._write_into_file_at_path(wdiff_filename, wdiff.encode("utf-8")) | self._write_into_file_at_path(wdiff_filename, wdiff, encoding="utf-8") | def write_output_files(self, port, filename, file_type, output, expected, print_text_diffs=False): """Writes the test output, the expected output and optionally the diff between the two to files in the results directory. |
self._write_into_file_at_path(pretty_patch_filename, pretty_patch.encode("utf-8")) | self._write_into_file_at_path(pretty_patch_filename, pretty_patch, encoding="utf-8") | def write_output_files(self, port, filename, file_type, output, expected, print_text_diffs=False): """Writes the test output, the expected output and optionally the diff between the two to files in the results directory. |
class _GTestTextTestResult(unittest._TextTestResult): """A test result class that can print formatted text results to a stream. Results printed in conformance with gtest output format, like: [ RUN ] autofill.AutoFillTest.testAutofillInvalid: "test desc." [ OK ] autofill.AutoFillTest.testAutofillInvalid ... | def __del__(self): # python unittest module is setup such that the suite gets deleted before # the test cases, which is odd because our test cases depend on # initializtions like exitmanager, autorelease pool provided by the # suite. Forcibly delete the test cases before the suite. del self._tests pyautolib.PyUITestSui... | |
result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) | result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) | def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid()) |
def __init__(self): | def __init__(self, path): | def __init__(self): MultiCommandTool.__init__(self) |
return __file__ | return self._path | def path(self): return __file__ |
result = unittest.TextTestRunner(verbosity=verbosity).run(pyauto_suite) | result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) | def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid()) |
if index or self.crashed or self.timed_out: | if index > 0 or self.crashed or self.timed_out: | def _read(self, timeout, size): """Internal routine that actually does the read.""" index = -1 out_fd = self._proc.stdout.fileno() err_fd = self._proc.stderr.fileno() select_fds = (out_fd, err_fd) deadline = time.time() + timeout while not self.timed_out and not self.crashed: # poll() is not threadsafe and can throw OS... |
def __init__(self, port, platform, options): self._file_dir = port.path_from_chromium_base('webkit', 'tools', 'layout_tests') self._port = port | def __init__(self, running_port, platform, options): self._file_dir = running_port.path_from_chromium_base( 'webkit', 'tools', 'layout_tests') | def __init__(self, port, platform, options): self._file_dir = port.path_from_chromium_base('webkit', 'tools', 'layout_tests') self._port = port self._platform = platform self._options = options self._rebaselining_tests = [] self._rebaselined_tests = [] |
expectations_str = self._port.test_expectations() | expectations_str = self._rebaseline_port.test_expectations() | def __init__(self, port, platform, options): self._file_dir = port.path_from_chromium_base('webkit', 'tools', 'layout_tests') self._port = port self._platform = platform self._options = options self._rebaselining_tests = [] self._rebaselined_tests = [] |
test_expectations.TestExpectations(self._port, | test_expectations.TestExpectations(self._rebaseline_port, | def __init__(self, port, platform, options): self._file_dir = port.path_from_chromium_base('webkit', 'tools', 'layout_tests') self._port = port self._platform = platform self._options = options self._rebaselining_tests = [] self._rebaselined_tests = [] |
platform = self._port.test_platform_name_to_name(self._platform) | platform = self._rebaseline_port.test_platform_name_to_name( self._platform) | def _extract_and_add_new_baselines(self, archive_file): """Extract new baselines from archive and add them to SVN repository. |
all_baselines = self._port.expected_baselines(test_filepath, suffix, True) | all_baselines = self._rebaseline_port.expected_baselines( test_filepath, suffix, True) | def _is_dup_baseline(self, new_baseline, baseline_path, test, suffix, platform): """Check whether a baseline is duplicate and can fallback to same baseline for another platform. For example, if a test has same baseline on linux and windows, then we only store windows baseline and linux baseline will fallback to the win... |
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.appe... | 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))... | def testPerfExpectations(self): perf_data = LoadData() |
self._source_dir = layout_package.path_utils.GetAbsolutePath( | self._source_dir = layout_package.path_utils.get_absolute_path( | def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestG... |
file_path = os.path.join(output_dir, ARCHIVE_DIR) | prefixed_archive_dir = (options.archive_prefix or "") + ARCHIVE_DIR file_path = os.path.join(output_dir, prefixed_archive_dir) | def MakeStagingDirectories(output_dir): """Creates a staging path for installer archive. If directory exists already, deletes the existing directory. """ file_path = os.path.join(output_dir, ARCHIVE_DIR) if os.path.exists(file_path): shutil.rmtree(file_path) os.makedirs(file_path) temp_file_path = os.path.join(output_... |
temp_file_path = os.path.join(output_dir, TEMP_ARCHIVE_DIR) | prefixed_temp_archive_dir = (options.archive_prefix or "") + TEMP_ARCHIVE_DIR temp_file_path = os.path.join(output_dir, prefixed_temp_archive_dir) | def MakeStagingDirectories(output_dir): """Creates a staging path for installer archive. If directory exists already, deletes the existing directory. """ file_path = os.path.join(output_dir, ARCHIVE_DIR) if os.path.exists(file_path): shutil.rmtree(file_path) os.makedirs(file_path) temp_file_path = os.path.join(output_... |
ret[new_name] = (correct_semantic_case(semantic) if semantic else old_name_and_type.split(' ')[2]) | if semantic: ret[new_name] = correct_semantic_case(semantic) else: ret[new_name] = old_name_and_type.split(' ')[2] | def get_input_mapping(header): ret = dict() for l in header.splitlines(): if not l.startswith('//var'): continue old_name_and_type, semantic, new_name, _, _ = l.split(' : ') if '[' in new_name: new_name = new_name[:new_name.index('[')] if new_name.startswith('$'): new_name = new_name[1:] ret[new_name] = (correct_semant... |
header, body = re.split(os.linesep*2, glsl_shader, 1) assert all(l.startswith('//') for l in header.splitlines()) | if '\r\n' in glsl_shader: header, body = re.split('\r\n'*2, glsl_shader, 1) else: header, body = re.split(os.linesep*2, glsl_shader, 1) for l in header.splitlines(): assert l.startswith('//') | def fix_glsl(glsl_shader): header, body = re.split(os.linesep*2, glsl_shader, 1) assert all(l.startswith('//') for l in header.splitlines()) input_mapping = get_input_mapping(header) return header + '\n\n' + fix_glsl_body(body, input_mapping) |
f = sys.stdin if options.file is None else open(options.file) | if options.file is None: f = sys.stdin else: f = open(options.file) | def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
("PageLoadTests", []), | ("PerformanceTests", []), | def _should_file_trigger_build(target_platform, file): # The directories and patterns lists below map directory names or # regexp patterns to the bot platforms for which they should trigger a # build. Mapping to the empty list means that no builds should be # triggered on any platforms. Earlier directories/patterns tak... |
src_dir = sys.argv[0]; if sys.platform != 'cygwin': src_dir = os.path.abspath(sys.argv[0]) print src_dir src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(src_dir))))) | src_dir = os.path.abspath(os.path.join(sys.path[0], '..', '..', '..')) | def main(): cmd = [sys.executable] src_dir = sys.argv[0]; if sys.platform != 'cygwin': src_dir = os.path.abspath(sys.argv[0]) print src_dir src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(src_dir))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts... |
startup_pipe.write(struct.pack('@H', listen_port)) | startup_pipe.write(struct.pack('=L', server_data_len)) startup_pipe.write(server_data_json) | def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): pr... |
return self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt') | return self.path_from_webkit_base('LayoutTests', 'platform', 'chromium', 'test_expectations.txt') | def path_to_test_expectations_file(self): return self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt') |
if splitter >= 0 and not string[splitter + 1] == '=': | if splitter >= 0 and not string[splitter + 1] == '=' and splitter < 80: | def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') if splitter >= 0 and not string[splitter + 1] == '=': return splitter parts = string.split('(') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): if not parts[ii - 1][-3:] == "if ": return splitte... |
if not parts[ii - 1][-3:] == "if ": | if (not parts[ii - 1][-3:] == "if " and (len(parts[ii]) > 0 and not parts[ii][0] == ")") and splitter < 80): | def __FindSplit(self, string): """Finds a place to split a string.""" splitter = string.find('=') if splitter >= 0 and not string[splitter + 1] == '=': return splitter parts = string.split('(') if len(parts) > 1: splitter = len(parts[0]) for ii in range(1, len(parts)): if not parts[ii - 1][-3:] == "if ": return splitte... |
file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n") | file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u);\n") | def WriteCmdSizeTest(self, func, file): """Writes the size test for a command.""" file.Write(" EXPECT_EQ(sizeof(cmd), cmd.header.size * 4u); // NOLINT\n") |
file.Write(" void Init(%s) {\n" % func.MakeTypedCmdArgString("_")) file.Write(" SetHeader(0); // TODO(gman): pass in correct size\n") args = func.GetCmdArgs() for arg in args: file.Write(" %s = _%s;\n" % (arg.name, arg.name)) file.Write(" }\n") file.Write("\n") | raise Error | def WriteImmediateCmdInit(self, func, file): """Writes the Init function for the immediate version of a command.""" file.Write(" void Init(%s) {\n" % func.MakeTypedCmdArgString("_")) file.Write(" SetHeader(0); // TODO(gman): pass in correct size\n") args = func.GetCmdArgs() for arg in args: file.Write(" %s = _%... |
copy_args = func.MakeCmdArgString("_", False) file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedCmdArgString("_", True)) file.Write(" // TODO(gman): compute correct size.\n") file.Write(" const uint32 size = ComputeSize(0);\n") file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % copy_args) file.W... | raise Error | def WriteImmediateCmdSet(self, func, file): """Writes the Set function for the immediate version of a command.""" copy_args = func.MakeCmdArgString("_", False) file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedCmdArgString("_", True)) file.Write(" // TODO(gman): compute correct size.\n") file.Write(" cons... |
file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % | file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n" " return parse_error::kParseInvalidArguments;\n" " }\n" % | def WriteHandlerImplementation (self, func, file): """Overrriden from TypeHandler.""" file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % (func.name, func.GetLastOriginalArg().name)) |
file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % | file.Write(" if (!GenGLObjects<GL%sHelper>(n, %s)) {\n" " return parse_error::kParseInvalidArguments;\n" " }\n" % | def WriteImmediateHandlerImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write(" GenGLObjects<GL%sHelper>(n, %s);\n" % (func.original_name, func.GetLastOriginalArg().name)) |
file.Write(" cmd.header.size * 4u); // NOLINT\n") | file.Write(" cmd.header.size * 4u);\n") | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" static GLuint ids[] = { 12, 23, 34, };\n") file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.na... |
file.Write(" cmd.header.size * 4u); // NOLINT\n") | file.Write(" cmd.header.size * 4u);\n") | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" const int kSomeBaseValueToTestWith = 51;\n") file.Write(" static %s data[] = {\n" % func.info.data_type) for v in range(0, func.info.count): file.Write(" static_ca... |
file.Write(" cmd.header.size * 4u); // NOLINT\n") | file.Write(" cmd.header.size * 4u);\n") | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" const int kSomeBaseValueToTestWith = 51;\n") file.Write(" static %s data[] = {\n" % func.info.data_type) for v in range(0, func.info.count * 2): file.Write(" stati... |
file.Write(" static uint32 ComputeDataSize(const char* s) {\n") file.Write(" return strlen(s);\n") file.Write(" }\n") file.Write("\n") file.Write(" static uint32 ComputeSize(const char* s) {\n") | file.Write(" static uint32 ComputeSize(uint32 data_size) {\n") | def WriteImmediateCmdComputeSize(self, func, file): """Overrriden from TypeHandler.""" file.Write(" static uint32 ComputeDataSize(const char* s) {\n") file.Write(" return strlen(s);\n") file.Write(" }\n") file.Write("\n") file.Write(" static uint32 ComputeSize(const char* s) {\n") file.Write(" return static_ca... |
file.Write(" sizeof(ValueType) + ComputeDataSize(s)); // NOLINT\n") file.Write(" }\n") file.Write("\n") | file.Write(" sizeof(ValueType) + data_size); // NOLINT\n") file.Write(" }\n") | def WriteImmediateCmdComputeSize(self, func, file): """Overrriden from TypeHandler.""" file.Write(" static uint32 ComputeDataSize(const char* s) {\n") file.Write(" return strlen(s);\n") file.Write(" }\n") file.Write("\n") file.Write(" static uint32 ComputeSize(const char* s) {\n") file.Write(" return static_ca... |
file.Write(" void SetHeader(const char* s) {\n") file.Write(" header.SetCmdByTotalSize<ValueType>(ComputeSize(s));\n") file.Write(" }\n") file.Write("\n") | code = """ void SetHeader(uint32 data_size) { header.SetCmdBySize<ValueType>(data_size); } """ file.Write(code) | def WriteImmediateCmdSetHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write(" void SetHeader(const char* s) {\n") file.Write(" header.SetCmdByTotalSize<ValueType>(ComputeSize(s));\n") file.Write(" }\n") file.Write("\n") |
file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) file.Write(" SetHeader(_%s);\n" % last_arg.name) args = func.GetCmdArgs()[:-1] | args = func.GetCmdArgs() set_code = [] | def WriteImmediateCmdInit(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) file.Write(" SetHeader(_%s);\n" % last_arg.name) args = func.GetCmdArgs()[:-1] for arg in args: file.Write(" %s = _%s;\n" % ... |
file.Write(" %s = _%s;\n" % (arg.name, arg.name)) file.Write(" data_size = strlen(_%s);\n" % last_arg.name) file.Write(" memcpy(ImmediateDataAddress(this), _%s, data_size);\n" % last_arg.name) file.Write(" }\n") file.Write("\n") | set_code.append(" %s = _%s;" % (arg.name, arg.name)) code = """ void Init(%(typed_args)s, uint32 _data_size) { SetHeader(_data_size); %(set_code)s memcpy(ImmediateDataAddress(this), _%(last_arg)s, _data_size); } """ file.Write(code % { "typed_args": func.MakeTypedOriginalArgString("_"), "set_code": "\n".join(set_co... | def WriteImmediateCmdInit(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void Init(%s) {\n" % func.MakeTypedOriginalArgString("_")) file.Write(" SetHeader(_%s);\n" % last_arg.name) args = func.GetCmdArgs()[:-1] for arg in args: file.Write(" %s = _%s;\n" % ... |
file.Write(" void* Set(void* cmd%s) {\n" % | file.Write(" void* Set(void* cmd%s, uint32 _data_size) {\n" % | def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedOriginalArgString("_", True)) file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % func.MakeOriginalArgString("_")) file.Write(" const ... |
file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % | file.Write(" static_cast<ValueType*>(cmd)->Init(%s, _data_size);\n" % | def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedOriginalArgString("_", True)) file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % func.MakeOriginalArgString("_")) file.Write(" const ... |
file.Write(" const uint32 size = ComputeSize(_%s);\n" % last_arg.name) file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>(" "cmd, size);\n") | file.Write(" return NextImmediateCmdAddress<ValueType>(" "cmd, _data_size);\n") | def WriteImmediateCmdSet(self, func, file): """Overrriden from TypeHandler.""" last_arg = func.GetLastOriginalArg() file.Write(" void* Set(void* cmd%s) {\n" % func.MakeTypedOriginalArgString("_", True)) file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" % func.MakeOriginalArgString("_")) file.Write(" const ... |
file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % (func.name, last_arg.name)) file.Write(" gles2::%s& c = GetImmediateCmdSpaceTotalSize<gles2::%s>(" "size);\n" % | file.Write(" const uint32 data_size = strlen(name);\n") file.Write(" gles2::%s& c = GetImmediateCmdSpace<gles2::%s>(" "data_size);\n" % | def WriteImmediateCmdHelper(self, func, file): """Overrriden from TypeHandler.""" args = func.MakeOriginalArgString("") last_arg = func.GetLastOriginalArg() file.Write(" void %s(%s) {\n" % (func.name, func.MakeTypedOriginalArgString(""))) file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % (func.name,... |
file.Write(" c.Init(%s);\n" % args) | file.Write(" c.Init(%s, data_size);\n" % args) | def WriteImmediateCmdHelper(self, func, file): """Overrriden from TypeHandler.""" args = func.MakeOriginalArgString("") last_arg = func.GetLastOriginalArg() file.Write(" void %s(%s) {\n" % (func.name, func.MakeTypedOriginalArgString(""))) file.Write(" const uint32 size = gles2::%s::ComputeSize(%s);\n" % (func.name,... |
file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const test_str = \"test string\";\n") file.Write(" void* next_cmd = cmd.Set(\n") file.Writ... | init_code = [] check_code = [] | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const te... |
file.Write(",\n static_cast<%s>(%d)" % (arg.type, value)) | init_code.append(" static_cast<%s>(%d)," % (arg.type, value)) | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const te... |
file.Write(",\n test_str);\n") | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const te... | |
file.Write(" EXPECT_EQ(static_cast<uint32>(%s::kCmdId),\n" % func.name) file.Write(" cmd.header.command);\n") file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") file.Write(" RoundSizeToMultipleOfEntries(strlen(test_str)),\n") file.Write(" cmd.header.size * 4u);\n") file.Write(" EXPE... | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const te... | |
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" % (arg.type, value, arg.name)) | check_code.append(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);" % (arg.type, value, arg.name)) | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const te... |
file.Write(" // TODO(gman): check that string got copied.\n") file.Write("}\n") file.Write("\n") | code = """ TEST(GLES2FormatTest, %(func_name)s) { int8 buf[256] = { 0, }; %(func_name)s& cmd = *static_cast<%(func_name)s*>(static_cast<void*>(&buf)); static const char* const test_str = \"test string\"; void* next_cmd = cmd.Set( &cmd, %(init_code)s test_str, strlen(test_str)); EXPECT_EQ(static_cast<uint32>(%(func_name... | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const te... |
file.Write(" EXPECT_EQ(sizeof(cmd) + // NOLINT\n") | file.Write(" EXPECT_EQ(sizeof(cmd)\n") | def WriteImmediateFormatTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("TEST(GLES2FormatTest, %s) {\n" % func.name) file.Write(" int8 buf[256] = { 0, };\n") file.Write(" %s& cmd = *static_cast<%s*>(static_cast<void*>(&buf));\n" % (func.name, func.name)) file.Write(" static const char* const te... |
class EnumArgument(Argument): | class EnumBaseArgument(Argument): """Base calss for EnumArgument, IntArgument and BoolArgument""" def __init__(self, name, gl_type, type, gl_error): Argument.__init__(self, name, gl_type) self.local_type = type self.gl_error = gl_error name = type[len(gl_type):] self.enum_info = _ENUM_LISTS[name] def WriteValidation... | def GetImmediateVersion(self): """Gets the immediate version of this argument.""" return self |
Argument.__init__(self, name, "GLenum") self.enum_type = type def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.enum_type, self.name)) file.Write(" SetGLError(GL_INVALID_ENUM);\n") file.Write(" return parse_error::kParseNoError;\n") file.Write(" }\n") class IntArgument(Argu... | EnumBaseArgument.__init__(self, name, "GLenum", type, "GL_INVALID_ENUM") class IntArgument(EnumBaseArgument): | def __init__(self, name, type): Argument.__init__(self, name, "GLenum") |
Argument.__init__(self, name, "GLint") self.int_type = type def WriteValidationCode(self, file): file.Write(" if (!Validate%s(%s)) {\n" % (self.int_type, self.name)) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return parse_error::kParseNoError;\n") file.Write(" }\n") | EnumBaseArgument.__init__(self, name, "GLint", type, "GL_INVALID_VALUE") class BoolArgument(EnumBaseArgument): """A class for a GLboolean argument that can only except specific values. For example glUniformMatrix takes a GLboolean for it's transpose but it must be false. """ def __init__(self, name, type): EnumBase... | def __init__(self, name, type): Argument.__init__(self, name, "GLint") |
type = type.replace("GLResourceId", "GLuint") | match = re.match("(GLid\w+)", type) self.resource_type = match.group(1)[4:] type = type.replace(match.group(1), "GLuint") | def __init__(self, name, type): type = type.replace("GLResourceId", "GLuint") Argument.__init__(self, name, type) |
elif arg_parts[0] == 'GLResourceId': return ResourceIdArgument( arg_parts[-1], " ".join(arg_parts[0:-1])) | elif arg_parts[0].startswith('GLid'): return ResourceIdArgument(arg_parts[-1], " ".join(arg_parts[0:-1])) | def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1]... |
_non_alnum_re = re.compile(r'[^a-zA-Z0-9]') | def CreateArg(arg_string): """Creates an Argument.""" arg_parts = arg_string.split() if len(arg_parts) == 1 and arg_parts[0] == 'void': return None # Is this a pointer argument? elif arg_string.find('*') >= 0: if arg_parts[0] == 'NonImmediate': return NonImmediatePointerArgument( arg_parts[-1], " ".join(arg_parts[1:-1]... | |
def WriteHeader(self, file): """Writes header to file""" file.Write( "// This file is auto-generated. DO NOT EDIT!\n" "\n") | def WriteHeader(self, file): """Writes header to file""" file.Write( "// This file is auto-generated. DO NOT EDIT!\n" "\n") | |
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") | |
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... |
file = CWriter(filename) self.WriteHeader(file) | file = CHeaderWriter(filename) | def WriteFormat(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file) |
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") |
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") |
file = CWriter(filename) | file = CHeaderWriter(filename) | def WriteCmdHelperHeader(self, filename): """Writes the gles2 command helper.""" file = CWriter(filename) |
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") |
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") |
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.WriteGLES2Implementa... |
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\"\... |
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\"\... | |
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() |
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() |
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_... |
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_... |
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_... |
self._lock.acquire() self._messages.append(message) self._lock.release() | with self._lock: self._messages.append(message) | def post(self, message): self._lock.acquire() self._messages.append(message) self._lock.release() |
self._lock.acquire() self._is_running = False self._lock.release() | with self._lock: self._is_running = False | def stop(self): self._lock.acquire() self._is_running = False self._lock.release() |
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 + "/" +... |
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 + "/" +... |
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 + "/" +... |
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")) |
"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... |
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... |
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... |
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... |
"Chromium", | "Chromium.*Release$", | def test_builder_name_regexps(self): buildbot = BuildBot() |
if (%(name)s != 0u && !id_manager()->GetServiceId(%(name)s, &%(name)s)) { SetGLError(GL_INVALID_VALUE); return error::kNoError; } | def WriteGetCode(self, file): """Overridden from Argument.""" code = """ %(type)s %(name)s = c.%(name)s; | |
archive = tarfile.open(output_fullname, 'w:bz2') | archive = MyTarFile.open(output_fullname, 'w:bz2') | def ShouldExcludePath(path): head, tail = os.path.split(path) if tail in ('.svn', '.git'): return True |
def cg_to_glsl(cg_shader): | def cg_to_glsl(cg_shader, CGC): | def cg_to_glsl(cg_shader): cg_shader = cg_rename_attributes(cg_shader) vertex_entry = re.search(r'#o3d\s+VertexShaderEntryPoint\s+(\w+)', cg_shader).group(1) p = subprocess.Popen([CGC]+('-profile glslv -entry %s' % vertex_entry).split(' '), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) glsl_ve... |
def check_cg(): if not os.path.exists(CGC): print >>sys.stderr, CGC+' is not found, use --cgc option to specify its' print >>sys.stderr, 'location. You may need to install nvidia cg toolkit.' sys.exit(1) def main(cg_shader): | def main(cg_shader, CGC): | def check_cg(): if not os.path.exists(CGC): print >>sys.stderr, CGC+' is not found, use --cgc option to specify its' print >>sys.stderr, 'location. You may need to install nvidia cg toolkit.' sys.exit(1) |
glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) | glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader, CGC) | def main(cg_shader): matrixloadorder = get_matrixloadorder(cg_shader) glsl_vertex, glsl_fragment, log = cg_to_glsl(cg_shader) print log print fix_glsl(glsl_vertex) print print '// #o3d SplitMarker' print get_matrixloadorder(cg_shader).strip() print print fix_glsl(glsl_fragment) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.