forked from sandialabs/Albany
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdash_all.py
53 lines (49 loc) · 1.76 KB
/
cdash_all.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import requests
from bs4 import BeautifulSoup
import sys
import re
not_configured_regex = 'SCOREC'
not_tested_regex = 'Cori|Edison|Trilinos|SCOREC|Peridigm'
sites = [
'http://my.cdash.org/index.php?project=Albany',
'http://cdash.sandia.gov/CDash-2-3-0/index.php?project=Albany']
all_good = True
for site in sites:
page = requests.get(site)
soup = BeautifulSoup(page.content, 'html.parser')
past_subprojects = False
for tag in soup.find_all('tr'):
if past_subprojects:
try:
build_name = tag.td.a.get_text()
children = list(tag.children)
number_texts = []
for i in range(2, 10):
number_texts.append(children[2 * i - 1].get_text())
if not re.search(not_configured_regex, build_name, re.IGNORECASE):
if not number_texts[0].isdecimal():
print("Configure not reported for", build_name)
elif int(number_texts[0]) > 0:
print(build_name, "had", int(number_texts[0]), "configure errors")
all_good = False
if not number_texts[3].isdecimal():
print("Build not reported for", build_name)
elif int(number_texts[3]) > 0:
print(build_name, "had", int(number_texts[3]), "compile errors")
all_good = False
if not re.search(not_tested_regex, build_name, re.IGNORECASE):
if not number_texts[7].isdecimal():
print("Tests not reported for", build_name)
elif int(number_texts[7]) > 0:
print(build_name, "had", int(number_texts[7]), "test failures")
all_good = False
except AttributeError:
pass
else:
try:
if 'SubProjects' == tag.td.h3.get_text():
past_subprojects = True
except AttributeError:
pass
if not all_good:
sys.exit(42)