summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2015-11-04 14:55:27 -0500
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-01-08 03:35:10 -0800
commitf9caa5ef879c68252583501a5c277a550791d83f (patch)
tree3e22c14ed29e196f5c802be5f03165903f622808
parent6019e988a3ec40fb78127dce577be125ac23af98 (diff)
extras: add script to analyze regression-test failures
Often a test will fail quite frequently, but not so frequently that it will fail twice in a row for the same patch. This allows it to "fly beneath the radar" for quite a long time, slowing project-wide progress until somebody crawls through the logs looking for patterns. This patch adds a script to automate some of that process. Change-Id: Ic74fbf6b0bfa34bffd9cb109fd51db019053e2cc Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/12510 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
-rwxr-xr-xextras/failed-tests.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/extras/failed-tests.py b/extras/failed-tests.py
new file mode 100755
index 00000000000..4b21d132c1f
--- /dev/null
+++ b/extras/failed-tests.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+import blessings
+import HTMLParser
+import requests
+import sys
+
+BASE='https://build.gluster.org'
+TERM=blessings.Terminal()
+
+class FailureFinder (HTMLParser.HTMLParser):
+ def __init__ (*args):
+ apply(HTMLParser.HTMLParser.__init__,args)
+ self = args[0]
+ self.last_href = None
+ def handle_starttag (self, tag, attrs):
+ if tag == 'a':
+ return self.is_a_tag (attrs)
+ if tag == 'img':
+ return self.is_img_tag (attrs)
+ def is_a_tag (self, attrs):
+ attrs_dict = dict(attrs)
+ try:
+ if attrs_dict['class'] != 'build-status-link':
+ return
+ except KeyError:
+ return
+ self.last_href = attrs_dict['href']
+ def is_img_tag (self, attrs):
+ if self.last_href == None:
+ return
+ attrs_dict = dict(attrs)
+ try:
+ if attrs_dict['alt'].find('Failed') == -1:
+ return
+ except KeyError:
+ return
+ self.process_failure(self.last_href)
+ self.last_href = None
+ def process_failure (self, url):
+ text = requests.get(BASE+url+'Full',verify=False).text
+ accum = []
+ for t in text.split('\n'):
+ if t == 'Result: FAIL':
+ print TERM.red + ('FAILURE on %s' % BASE+url) + TERM.normal
+ for t2 in accum:
+ print t2.encode('utf-8')
+ accum = []
+ elif t == 'Result: PASS':
+ accum = []
+ else:
+ accum.append(t)
+
+def main (url):
+ parser = FailureFinder()
+ text = requests.get(url,verify=False).text
+ parser.feed(text)
+
+
+if len(sys.argv) < 2:
+ main(BASE+'/job/rackspace-regression-2GB-triggered/')
+else:
+ for u in sys.argv[1:]:
+ main(BASE+u)