From f9caa5ef879c68252583501a5c277a550791d83f Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Wed, 4 Nov 2015 14:55:27 -0500 Subject: 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 Reviewed-on: http://review.gluster.org/12510 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- extras/failed-tests.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 extras/failed-tests.py (limited to 'extras') 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) -- cgit