Created
April 17, 2018 13:34
-
-
Save makuk66/2e450efb9b54af3544aeca8afc904f63 to your computer and use it in GitHub Desktop.
hung-clienttests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/python | |
""" | |
Match up tests starting and completing to find hung tests | |
""" | |
import re | |
import sys | |
STARTED_RE = re.compile(r'^.* > .*STARTED$') | |
PASSED_RE = re.compile(r'^.* > .*PASSED$') | |
SKIPPED_RE = re.compile(r'^.* > .*SKIPPED$') | |
FAILED_RE = re.compile(r'^.* > .*FAILED$') | |
MESS_RE = re.compile(r'^.*finished executing tests.') | |
CTRL_RE = re.compile(r'[\x00-\x1f\x7f-\x9f]') | |
SEEN = {} | |
def remove_seen(key): | |
""" remove key from SEEN if it was there """ | |
if key in SEEN: | |
# print "deleted " + key | |
del SEEN[key] | |
else: | |
# print "key not seen: " + key | |
pass | |
for line in sys.stdin.readlines(): | |
line = line.strip() | |
line = CTRL_RE.sub('', line) | |
line = MESS_RE.sub('', line) | |
#print "LINE " + line | |
started_match = STARTED_RE.match(line) | |
if started_match: | |
scanned_key = started_match.group(0).replace('STARTED', '') | |
#print "STORE " + key | |
SEEN[scanned_key] = True | |
continue | |
passed_match = PASSED_RE.match(line) | |
if passed_match: | |
remove_seen(passed_match.group(0).replace('PASSED', '')) | |
continue | |
skipped_match = SKIPPED_RE.match(line) | |
if skipped_match: | |
remove_seen(skipped_match.group(0).replace('SKIPPED', '')) | |
continue | |
failed_match = FAILED_RE.match(line) | |
if failed_match: | |
remove_seen(failed_match.group(0).replace('FAILED', '')) | |
continue | |
# print "ignoring " + line | |
print "LEFTOVERS" | |
for k in SEEN: | |
print k | |
print "total tests: " + str(len(SEEN)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment