Fixing case when there are multiple tries to the same commit.

This commit is contained in:
Sergio Durigan Junior 2017-09-04 14:53:08 -04:00
parent 00f0744aeb
commit 69e0591220
3 changed files with 51 additions and 16 deletions

View file

@ -39,7 +39,13 @@ def create_copy_command (props):
return [ 'true' ]
if istry and istry == 'yes':
to_path = os.path.join (get_web_base (), builder, 'try', rev[:2], rev)
con = sqlite3.connect (db_file)
c = con.cursor ()
c.execute ('SELECT COUNT(*) FROM logs WHERE commitid = "%s" AND branch = "%s" AND trysched = 1' % (rev, branch))
count = int (c.fetchone ())
con.close ()
to_path = os.path.join (get_web_base (), builder, 'try', rev[:2], rev, count)
else:
to_path = os.path.join (get_web_base (), builder, rev[:2], rev)

View file

@ -7,6 +7,7 @@ from StringIO import StringIO
# the tests matters to us.
from collections import OrderedDict
import lzma
import sqlite3
# Helper regex for parse_sum_line.
sum_matcher = re.compile('^(.?(PASS|FAIL)): (.*)$')
@ -69,11 +70,19 @@ class DejaResults(object):
# and to the set.
out_dict[1][result].add (test_name)
def _write_sum_file(self, sum_dict, builder, rev, filename, header = None, istry = False):
def _write_sum_file(self, sum_dict, builder, rev, filename, header = None, istry = False, branch = "master"):
global gdb_web_base
if istry:
bdir = os.path.join (gdb_web_base, builder, 'try', rev[:2], rev)
db_file = os.path.join (get_web_base (), builder, builder + '.db')
con = sqlite3.connect (db_file)
c = con.cursor ()
c.execute ('SELECT COUNT(*) FROM logs WHERE commitid = "%s" AND branch = "%s" AND trysched = 1' % (rev, branch))
count = int (c.fetchone ())
con.close ()
bdir = os.path.join (gdb_web_base, builder, 'try', rev[:2], rev, count)
else:
bdir = os.path.join (gdb_web_base, builder, rev[:2], rev)
@ -95,17 +104,26 @@ class DejaResults(object):
os.umask (old_umask)
def write_sum_file(self, sum_dict, builder, branch, rev, istry):
self._write_sum_file (sum_dict, builder, rev, 'gdb.sum', istry = istry)
if istry:
self.write_try_build_sum_file (self, sum_dict, builder, branch, rev)
else:
self._write_sum_file (sum_dict, builder, rev, 'gdb.sum', istry = False,
branch = branch)
def write_try_build_sum_file (self, sum_dict, builder, branch, rev):
self._write_sum_file (sum_dict, builder, rev, 'trybuild_gdb.sum',
header = "### THIS SUM FILE WAS GENERATED BY A TRY BUILD ###\n\n",
istry = True)
istry = True,
branch = branch)
def write_baseline(self, sum_dict, builder, branch, rev, istry):
if istry:
return
else:
self._write_sum_file(sum_dict, builder, rev, 'baseline',
header = "### THIS BASELINE WAS LAST UPDATED BY COMMIT %s ###\n\n" % rev,
istry = istry)
istry = False,
branch = branch)
# Read a .sum file.
# The builder name is BUILDER.

View file

@ -33,6 +33,7 @@ from json import load
import re
import jinja2
import git
import sqlite3
####################################
####################################
@ -142,11 +143,12 @@ from email.mime.text import MIMEText
def SendRootMessageGDBTesters (branch, change, rev,
istrysched = False,
try_to = None):
try_to = None,
try_count = 0)
global GDB_MAIL_TO, GDB_MAIL_FROM
if istrysched:
f = "/tmp/gdb-buildbot-%s-try.lock" % rev
f = "/tmp/gdb-buildbot-%s-try-%d.lock" % (rev, try_count)
else:
f = "/tmp/gdb-buildbot-%s.lock" % rev
@ -172,15 +174,17 @@ def SendRootMessageGDBTesters (branch, change, rev,
text = text.encode ('ascii', 'ignore').decode ('ascii')
else:
text = ""
text += "*** TEST RESULTS FOR TRY BUILD ***\n\n"
text += "*** TEST RESULTS FOR TRY BUILD #%d ***\n\n" % try_count
text += "Branch: %s\n" % branch
text += "Commit tested against: %s\n\n" % rev
text += "There have been %d tries before this one.\n\n" % try_count
text += "Patch tested:\n\n"
text += change
chg_title = "Try Build against commit %s" % rev
chg_title = "Try Build #%d against commit %s" % (try_count, rev)
text = text.encode ('ascii', 'ignore').decode ('ascii')
mail = MIMEText (text)
@ -198,7 +202,7 @@ def SendRootMessageGDBTesters (branch, change, rev,
else:
mail['To'] = try_to
mailto = try_to
mail['Message-Id'] = "<%s-try@gdb-build>" % rev
mail['Message-Id'] = "<%s-try-%d@gdb-build>" % (rev, count)
s = smtplib.SMTP ('localhost')
s.sendmail (GDB_MAIL_FROM, [ mailto ], mail.as_string ())
@ -436,11 +440,18 @@ send to the gdb-testers mailing list."""
cur_change = sourcestamp.patch[1]
properties = build.getProperties ()
isrebuild = properties.getProperty ('isRebuild')
db_file = os.path.join (get_web_base (), name, name + '.db')
con = sqlite3.connect (db_file)
c = con.cursor ()
c.execute ('SELECT COUNT(*) FROM logs WHERE commitid = "%s" AND branch = "%s" AND trysched = 1' % (sourcestamp.revision, branch))
count = int (c.fetchone ())
con.close ()
try_to = build.getReason ().strip ("'try' job by user ")
# Sending the root message to gdb-testers.
SendRootMessageGDBTesters (branch, cur_change, properties.getProperty ('revision'),
istrysched = True, try_to = try_to)
istrysched = True, try_to = try_to, try_count = count)
# Subject
subj = "Try Build on %s, branch %s" % (name, branch)
@ -463,8 +474,8 @@ send to the gdb-testers mailing list."""
# URL to find more info about what went wrong.
text += "\nTestsuite log (gdb.sum and gdb.log) URL(s):\n"
text += "\t<%s/%s/try/%s/%s/>\n" % (res_url, name, sourcestamp.revision[:2],
sourcestamp.revision)
text += "\t<%s/%s/try/%s/%s/%d/>\n\n" % (res_url, name, sourcestamp.revision[:2],
sourcestamp.revision, count)
# commit_id = get_builder_commit_id (name, sourcestamp.revision,
# sourcestamp.branch)