6 from concurrent
.futures
import ThreadPoolExecutor
, as_completed
9 def remove_prefix(i
, d
=0):
12 s
= os
.popen("llvm-lit -a " + i
).read()
13 r
= re
.search("no check strings found with (?:prefix|prefixes) '([^:]+)", s
)
14 with
open(i
, "r+") as f
:
18 s
= re
.sub("=" + p
+ ",", "=", s
)
19 s
= re
.sub("," + p
+ "([, \n])", "\\1", s
)
20 s
= re
.sub("\s+-?-check-prefix=" + p
+ "([ \n])", "\\1", s
)
23 "-?-check-prefixes=([\w-]+)(\Z|[ \t\n])", "--check-prefix=\\1\\2", s
26 "-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
31 t
.group(), "--check-prefixes=" + t
.group(1) + "," + t
.group(2), s
34 "-?-check-(?:prefix|prefixes)=([^ ]+)\s+-?-check-(?:prefix|prefixes)=([^ ]+)",
37 s
= re
.sub("\s+-?-check-prefix=CHECK[ \t]*\n", "\n", s
)
42 t
= re
.search("Assertions have been autogenerated by (.*)", s
)
44 s
= os
.popen("llvm/" + t
.group(1) + " " + i
+ " 2>&1").read()
45 if "had conflicting output from different RUN lines for all functions" in s
:
47 s
= os
.popen("git diff " + i
).read()
48 if re
.search("\n(?:-+)\n", s
) or re
.search("\n[+-].*(?<!RUN):", s
):
51 return remove_prefix(i
, d
+ 1)
54 with
ThreadPoolExecutor(max_workers
=32) as e
:
58 t
= {e
.submit(remove_prefix
, i
): i
for i
in sys
.argv
[1:]}
59 for i
in as_completed(t
):
61 print("DONE:", end
=" ")
62 elif i
.result() == -1:
63 print("FAIL:", end
=" ")
66 print("CHANGE:", end
=" ")
69 print("ABORT:", end
=" ")
72 for i
in [(f
, "Failed"), (c
, "Changed"), (a
, "Aborted")]:
74 print("********************\n%s Tests (%d):" % (i
[1], len(i
[0])))