Convert tests from jstd to Mocha.
[dygraphs.git] / auto_tests / misc / filter-lcov.py
CommitLineData
49cb8afc
DV
1#!/usr/bin/env python
2"""Remove unwanted files from LCOV data.
3
4jstd and node-coveralls won't do this themselves, so we have to!
5
6Usage:
7 cat lcov.dat | ./filter-lcov.py > filtered-lcov.dat
8"""
9
10import fileinput
11import re
12
13# Exclude paths which match any of these regular expressions.
14exclude_res = [
15 re.compile(r'auto_tests')
16]
17
18def is_ok(path):
19 for regex in exclude_res:
20 if re.search(regex, path):
21 return False
22 return True
23
24
25writing = False
26for 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