don't deploy yet...mods are underwaygit add topfails
This commit is contained in:
BIN
topfails/dbschema.pyc
Normal file
BIN
topfails/dbschema.pyc
Normal file
Binary file not shown.
BIN
topfails/topfails/__init__.pyc
Normal file
BIN
topfails/topfails/__init__.pyc
Normal file
Binary file not shown.
BIN
topfails/topfails/settings.pyc
Normal file
BIN
topfails/topfails/settings.pyc
Normal file
Binary file not shown.
BIN
topfails/topfails/urls.pyc
Normal file
BIN
topfails/topfails/urls.pyc
Normal file
Binary file not shown.
BIN
topfails/topfails/viewer/__init__.pyc
Normal file
BIN
topfails/topfails/viewer/__init__.pyc
Normal file
Binary file not shown.
BIN
topfails/topfails/viewer/models.pyc
Normal file
BIN
topfails/topfails/viewer/models.pyc
Normal file
Binary file not shown.
BIN
topfails/topfails/viewer/views.pyc
Normal file
BIN
topfails/topfails/viewer/views.pyc
Normal file
Binary file not shown.
@@ -184,6 +184,7 @@ def UpdateLogfile(conn, treeid, os, starttime, logfile):
|
|||||||
UPDATE viewer_build SET logfile = %s WHERE tree_id = %s AND os = %s AND starttime = %s AND logfile IS NULL
|
UPDATE viewer_build SET logfile = %s WHERE tree_id = %s AND os = %s AND starttime = %s AND logfile IS NULL
|
||||||
""", (logfile, treeid, os, starttime))
|
""", (logfile, treeid, os, starttime))
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
|
||||||
def InsertBuild(conn, treeid, os, starttime, status, logfile, changeset):
|
def InsertBuild(conn, treeid, os, starttime, status, logfile, changeset):
|
||||||
"""Insert a build into the builds table and return the id."""
|
"""Insert a build into the builds table and return the id."""
|
||||||
conn.execute("""
|
conn.execute("""
|
||||||
@@ -192,6 +193,13 @@ def InsertBuild(conn, treeid, os, starttime, status, logfile, changeset):
|
|||||||
connection.commit()
|
connection.commit()
|
||||||
return conn.lastrowid
|
return conn.lastrowid
|
||||||
|
|
||||||
|
def HaveFailRecord(conn,buildid, result, testnames_id):
|
||||||
|
"""See if we already have this failRecord in our database."""
|
||||||
|
conn.execute("""
|
||||||
|
SELECT COUNT(*) FROM viewer_testfailure WHERE build_id = %s AND test_id = %s
|
||||||
|
""", (buildid, testnames_id))
|
||||||
|
return conn.fetchone()[0] == 1
|
||||||
|
|
||||||
def InsertTest(conn, buildid, result, testnames_id, description):
|
def InsertTest(conn, buildid, result, testnames_id, description):
|
||||||
# ToDo: Add column to save result.
|
# ToDo: Add column to save result.
|
||||||
conn.execute("""
|
conn.execute("""
|
||||||
@@ -290,7 +298,12 @@ parser.add_option("-p", "--passwd", action="store",
|
|||||||
parser.add_option("-v", "--verbose", action="store_true",
|
parser.add_option("-v", "--verbose", action="store_true",
|
||||||
dest="verbose", default="False",
|
dest="verbose", default="False",
|
||||||
help="Enable verbose logging")
|
help="Enable verbose logging")
|
||||||
|
parser.add_option("--debug", action='store_true',
|
||||||
|
dest='debug', default=False,
|
||||||
|
help="enable interactive debugger on exceptions (pdb)")
|
||||||
|
parser.add_option("--die", action='store_true',
|
||||||
|
dest='die', default=False,
|
||||||
|
help="enable application to die on error")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
logging.basicConfig(level=options.verbose and logging.DEBUG or logging.WARNING)
|
logging.basicConfig(level=options.verbose and logging.DEBUG or logging.WARNING)
|
||||||
@@ -377,7 +390,7 @@ while curtime < endtime and chunk < totalchunks:
|
|||||||
if (endtime - curtime) < chunksize:
|
if (endtime - curtime) < chunksize:
|
||||||
chunksize = endtime - curtime
|
chunksize = endtime - curtime
|
||||||
|
|
||||||
tboxurl = "http://tinderbox.mozilla.org/showbuilds.cgi?tree=%(tree)s&maxdate=%(maxdate)d&noignore=1&hours=%(hours)d&json=1" \
|
tboxurl = "http://tinderbox.mozilla.org/showbuilds.cgi?tree=%(tree)s&maxdate=%(maxdate)d&noignore=1&hours=%(hours)d&json=1&noignore=1" \
|
||||||
% {'tree': options.tree,
|
% {'tree': options.tree,
|
||||||
'maxdate': curtime + chunksize, # tbox wants the end time
|
'maxdate': curtime + chunksize, # tbox wants the end time
|
||||||
'hours': int(chunksize / S_IN_H)}
|
'hours': int(chunksize / S_IN_H)}
|
||||||
@@ -395,7 +408,7 @@ while curtime < endtime and chunk < totalchunks:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# we only care about unit test boxes
|
# we only care about unit test boxes
|
||||||
unittest_indices = [tboxdata['build_name_index'][x] for x in tboxdata['build_name_index'] if re.search("test|xpc|check", x)]
|
unittest_indices = [tboxdata['build_name_index'][x] for x in tboxdata['build_name_index'] if re.search("ref|mochi|test|xpc|check", x)]
|
||||||
# read build table
|
# read build table
|
||||||
# 'TestFailed' expected log format is "result | test | optional text".
|
# 'TestFailed' expected log format is "result | test | optional text".
|
||||||
testfailedRe = re.compile(r"(TEST-UNEXPECTED-.*) \| (.*) \|(.*)")
|
testfailedRe = re.compile(r"(TEST-UNEXPECTED-.*) \| (.*) \|(.*)")
|
||||||
@@ -443,15 +456,40 @@ while curtime < endtime and chunk < totalchunks:
|
|||||||
try:
|
try:
|
||||||
# Grab the build log.
|
# Grab the build log.
|
||||||
log, headers = urllib.urlretrieve("http://tinderbox.mozilla.org/%s/%s" % (options.tree, build['logfile']))
|
log, headers = urllib.urlretrieve("http://tinderbox.mozilla.org/%s/%s" % (options.tree, build['logfile']))
|
||||||
gz = GzipFile(log)
|
gz = GzipFile(log).readlines() # I need a list of lines from the build log
|
||||||
# Look for test failures.
|
# Look for test failures.
|
||||||
for line in gz:
|
for line in gz:
|
||||||
|
# Check all lines if they have INFO Running or url=file:/// stuff.
|
||||||
|
# If it is mochitest, we see the former string pattern
|
||||||
|
# If it is jsreftest,crashtest we see the later string pattern.
|
||||||
|
if "INFO Running" in line or "[url = file:///" in line or "INFO | Loading" in line:
|
||||||
|
potentialTestName=line
|
||||||
|
if "[url = file:///" in line:
|
||||||
|
if "?test=" in line:
|
||||||
|
potentialTestName = potentialTestName.split('?test=')[1][0:-2]
|
||||||
|
else:
|
||||||
|
potentialTestName = potentialTestName.split('url = ')[1][0:-1]
|
||||||
|
elif "INFO Running" in line:
|
||||||
|
potentialTestName = potentialTestName.split('INFO Running ')[1][0:-4]
|
||||||
|
elif "INFO | Loading" in line:
|
||||||
|
potentialTestName = potentialTestName.split('INFO | Loading ')[1]
|
||||||
|
else :
|
||||||
|
potentialTestName= "[unittest-log.py: no logged test]"
|
||||||
|
|
||||||
m = testfailedRe.match(line)
|
m = testfailedRe.match(line)
|
||||||
if m:
|
if m:
|
||||||
test = rawtest = m.group(2).strip() or "[unittest-log.py: no logged test]"
|
test = rawtest = m.group(2).strip() or "[unittest-log.py: no logged test]"
|
||||||
|
if 'automation.py' in test or 'automationutils.processLeakLog' in test:
|
||||||
|
if potentialTestName != "":
|
||||||
|
#import pdb; pdb.set_trace()
|
||||||
|
test = rawtest = potentialTestName
|
||||||
|
potentialTestName=""
|
||||||
|
|
||||||
|
# Code bits below try to change back slash to forward slash
|
||||||
|
# and get rid of varibale prepends to the /test/../.. names
|
||||||
|
|
||||||
if rawtest.find('\\') != -1:
|
if rawtest.find('\\') != -1:
|
||||||
test = rawtest.replace('\\','/')
|
test = rawtest.replace('\\','/')
|
||||||
|
|
||||||
if test.find('/') != -1:
|
if test.find('/') != -1:
|
||||||
tup=test.partition('build/')
|
tup=test.partition('build/')
|
||||||
if len(tup[2]) > 2:
|
if len(tup[2]) > 2:
|
||||||
@@ -461,10 +499,19 @@ while curtime < endtime and chunk < totalchunks:
|
|||||||
|
|
||||||
text = m.group(3).strip() or "[unittest-log.py: no logged text]"
|
text = m.group(3).strip() or "[unittest-log.py: no logged text]"
|
||||||
testnames_id=GetOrInsertTest(conn,test)
|
testnames_id=GetOrInsertTest(conn,test)
|
||||||
InsertTest(conn, buildid, m.group(1).rstrip(), testnames_id, text)
|
if HaveFailRecord(conn,buildid, m.group(1).rstrip(), testnames_id):
|
||||||
except:
|
logging.info("Skipping already recorded failure '%s' in build with id '%s' with failure record '%s' " % (test, buildid, text))
|
||||||
logging.error("Unexpected error: %s" % sys.exc_info()[0])
|
else:
|
||||||
#XXX: handle me?
|
InsertTest(conn, buildid, m.group(1).rstrip(), testnames_id, text)
|
||||||
|
except Exception, e:
|
||||||
|
errstring = "Unexpected error: %s" % e
|
||||||
|
if options.debug:
|
||||||
|
print errstring
|
||||||
|
import pdb; pdb.set_trace()
|
||||||
|
elif options.die:
|
||||||
|
raise
|
||||||
|
else:
|
||||||
|
logging.error(errstring)
|
||||||
|
|
||||||
# Ignore 'Burning' builds: tests may have run nontheless, but it's safer to discard them :-|
|
# Ignore 'Burning' builds: tests may have run nontheless, but it's safer to discard them :-|
|
||||||
elif status == BuildStatus.Burning:
|
elif status == BuildStatus.Burning:
|
||||||
|
|||||||
Reference in New Issue
Block a user