MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / parse_test_comment

Function parse_test_comment

test/diff/diff_files/generate_tests.py:153–170  ·  view source on GitHub ↗
(src_spirv_file_name, src_spirv)

Source from the content-addressed store, hash-verified

151 return content
152
153def parse_test_comment(src_spirv_file_name, src_spirv):
154 src_spirv_lines = src_spirv.splitlines()
155 comment_line_count = 0
156 while comment_line_count < len(src_spirv_lines):
157 if not src_spirv_lines[comment_line_count].strip().startswith(';;'):
158 break
159 comment_line_count += 1
160
161 if comment_line_count == 0:
162 print("Expected comment on test file '{}'. See README.md next to this file.".format(src_spirv_file_name))
163 sys.exit(1)
164
165 comment_block = src_spirv_lines[:comment_line_count]
166 spirv_block = src_spirv_lines[comment_line_count:]
167
168 comment_block = ['// ' + line.replace(';;', '').strip() for line in comment_block]
169
170 return '\n'.join(spirv_block), '\n'.join(comment_block)
171
172def run_diff_tool(diff_tool, src_file, dst_file, variant):
173 args = [diff_tool]

Callers 1

generate_testFunction · 0.85

Calls 1

formatMethod · 0.80

Tested by

no test coverage detected