llvm/test/tools/llvm-reduce/Inputs/reduce-distinct-metadata.py
raw| 1 | # Helper script for distinct metadata reduction test |
| 2 | |
| 3 | import sys |
| 4 | import re |
| 5 | |
| 6 | input = open(sys.argv[1], "r").read().splitlines() |
| 7 | |
| 8 | depth_map = {"0": 1, "1": 3, "2": 3, "3": 2, "4": 1} |
| 9 | |
| 10 | |
| 11 | for i in range(len(depth_map)): |
| 12 | counter = 0 |
| 13 | for line in input: |
| 14 | if re.match(rf".*interesting_{i}.*", line) != None: |
| 15 | counter += 1 |
| 16 | if counter != depth_map[str(i)]: |
| 17 | sys.exit(1) |
| 18 | |
| 19 | sys.exit(0) |