Commit | Line | Data |
---|---|---|
49cb8afc DV |
1 | #!/usr/bin/env python |
2 | """Remove unwanted files from LCOV data. | |
3 | ||
4 | jstd and node-coveralls won't do this themselves, so we have to! | |
5 | ||
6 | Usage: | |
7 | cat lcov.dat | ./filter-lcov.py > filtered-lcov.dat | |
8 | """ | |
9 | ||
10 | import fileinput | |
11 | import re | |
12 | ||
13 | # Exclude paths which match any of these regular expressions. | |
14 | exclude_res = [ | |
15 | re.compile(r'auto_tests') | |
16 | ] | |
17 | ||
18 | def is_ok(path): | |
19 | for regex in exclude_res: | |
20 | if re.search(regex, path): | |
21 | return False | |
22 | return True | |
23 | ||
24 | ||
25 | writing = False | |
26 | for line in fileinput.input(): | |
27 | line = line.strip(); | |
28 | if line.startswith('SF:'): | |
29 | path = line[3:] | |
30 | writing = is_ok(path) | |
31 | if writing: | |
32 | print line |