summaryrefslogtreecommitdiffstats
path: root/data/process.py
diff options
context:
space:
mode:
Diffstat (limited to 'data/process.py')
-rwxr-xr-xdata/process.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/data/process.py b/data/process.py
new file mode 100755
index 0000000..562a5d2
--- /dev/null
+++ b/data/process.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+
+import re
+import sys
+from itertools import groupby
+
+test_re = re.compile(r"^Test[ ]([0-9]+):[ ](.*)$")
+
+def parse_file_z(_file):
+ """Take a file and return all numbers corresponding to failures."""
+ r = []
+
+ with open(_file, "r") as f:
+ lines = f.readlines()
+
+ for l in lines:
+ match = test_re.match(l)
+ if match is None:
+ continue
+ value = match.group(2)
+ if value == "TIM":
+ r.append(int(match.group(1)))
+
+ return sorted(r)
+
+
+def parse_file_l(_file):
+ """Take a file consisting of lists of failures and return them all."""
+ r = []
+
+ with open(_file, "r") as f:
+ lines = f.readlines()
+
+ for l in lines:
+ r.append(int(l))
+
+ return sorted(r)
+
+
+def find_common(ls):
+ """Finds all common elements."""
+ d = {}
+ for i in range(1, 6701):
+ ret = list(map(lambda x: i in x, ls))
+ if any(ret):
+ d[i] = ret
+
+ return d
+
+
+def group_up(d):
+ """Group up all the elements."""
+ sorted_values = sorted(d.values())
+ for key, value in groupby(sorted_values):
+ print((len(list(value)), key), end = " ")
+ print()
+
+
+def main():
+ vivado191 = parse_file_z("./vivado191.txt")
+ intel = parse_file_z("./intel.txt")
+ legup = parse_file_z("./legup.txt")
+ bambu = parse_file_l("./bambu_timeout.txt")
+
+ common = find_common([vivado191, intel, legup, bambu])
+ group_up(common)
+
+
+if __name__ == "__main__":
+ main()