[llvm] [AMDGPU][test]added unique and sort options for update_mc_test_check script (PR #111769)
Brox Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 08:26:36 PDT 2024
================
@@ -298,23 +325,88 @@ def main():
else:
gen_prefix += getStdCheckLine(prefix, o, mc_mode)
- generated_prefixes.append(gen_prefix.rstrip("\n"))
+ generated_prefixes[input_line] = gen_prefix.rstrip("\n")
# write output
- prefix_id = 0
for input_info in ti.iterlines(output_lines):
input_line = input_info.line
- if isTestLine(input_line, mc_mode):
+ if input_line in testlines:
output_lines.append(input_line)
- output_lines.append(generated_prefixes[prefix_id])
- prefix_id += 1
+ output_lines.append(generated_prefixes[input_line])
elif should_add_line_to_output(input_line, prefix_set, mc_mode):
output_lines.append(input_line)
- elif input_line in ti.run_lines or input_line == "":
- output_lines.append(input_line)
+ if ti.args.unique or ti.args.sort:
+ # split with double newlines
+ test_units = "\n".join(output_lines).split("\n\n")
+
+ # select the key line for each test unit
+ test_dic = {}
+ for unit in test_units:
+ lines = unit.split("\n")
+ for l in lines:
+ # if contains multiple lines, use
+ # the first testline or runline as key
+ if isTestLine(l, mc_mode):
+ test_dic[unit] = l
+ break
+ elif isRunLine(l):
----------------
broxigarchen wrote:
done
https://github.com/llvm/llvm-project/pull/111769
More information about the llvm-commits
mailing list