-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathregression.py
executable file
·36 lines (29 loc) · 1.05 KB
/
regression.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python
import re, os
from subprocess import Popen, PIPE
print ""
cmd = 'find . -name "*.test.js"';
files = Popen(cmd, shell=True, stdout=PIPE).communicate()[0].splitlines()
failed_list = []
for file in files:
output = Popen('node ' + file, shell=True, stdout=PIPE).communicate()[0].splitlines()
try:
result = [line for line in output if line.startswith('Total')][0]
except:
#bizarre, but sometimes popen apears to return empty strings
#I'm too tired to fix this right now, so for now just retry and hope for better results
output = Popen('node ' + file, shell=True, stdout=PIPE).communicate()[0].splitlines()
result = [line for line in output if line.startswith('Total')][0]
(total, failed, error) = re.split(r':|,', result)[1::2]
if int(failed) > 0 or int(error) > 0:
failed_list.append(file)
print file
print '\t', result
if failed_list:
print '\nWARNING! There were failed tests:'
for file in failed_list:
print file
print ""
exit(1)
print ""
exit(0)