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' ] return [ 'true' ]
if istry and istry == 'yes': 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: else:
to_path = os.path.join (get_web_base (), builder, rev[:2], rev) 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. # the tests matters to us.
from collections import OrderedDict from collections import OrderedDict
import lzma import lzma
import sqlite3
# Helper regex for parse_sum_line. # Helper regex for parse_sum_line.
sum_matcher = re.compile('^(.?(PASS|FAIL)): (.*)$') sum_matcher = re.compile('^(.?(PASS|FAIL)): (.*)$')
@ -69,11 +70,19 @@ class DejaResults(object):
# and to the set. # and to the set.
out_dict[1][result].add (test_name) 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 global gdb_web_base
if istry: 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: else:
bdir = os.path.join (gdb_web_base, builder, rev[:2], rev) bdir = os.path.join (gdb_web_base, builder, rev[:2], rev)
@ -95,17 +104,26 @@ class DejaResults(object):
os.umask (old_umask) os.umask (old_umask)
def write_sum_file(self, sum_dict, builder, branch, rev, istry): 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): def write_try_build_sum_file (self, sum_dict, builder, branch, rev):
self._write_sum_file (sum_dict, builder, rev, 'trybuild_gdb.sum', self._write_sum_file (sum_dict, builder, rev, 'trybuild_gdb.sum',
header = "### THIS SUM FILE WAS GENERATED BY A TRY BUILD ###\n\n", 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): def write_baseline(self, sum_dict, builder, branch, rev, istry):
if istry:
return
else:
self._write_sum_file(sum_dict, builder, rev, 'baseline', self._write_sum_file(sum_dict, builder, rev, 'baseline',
header = "### THIS BASELINE WAS LAST UPDATED BY COMMIT %s ###\n\n" % rev, header = "### THIS BASELINE WAS LAST UPDATED BY COMMIT %s ###\n\n" % rev,
istry = istry) istry = False,
branch = branch)
# Read a .sum file. # Read a .sum file.
# The builder name is BUILDER. # The builder name is BUILDER.

View file

@ -33,6 +33,7 @@ from json import load
import re import re
import jinja2 import jinja2
import git import git
import sqlite3
#################################### ####################################
#################################### ####################################
@ -142,11 +143,12 @@ from email.mime.text import MIMEText
def SendRootMessageGDBTesters (branch, change, rev, def SendRootMessageGDBTesters (branch, change, rev,
istrysched = False, istrysched = False,
try_to = None): try_to = None,
try_count = 0)
global GDB_MAIL_TO, GDB_MAIL_FROM global GDB_MAIL_TO, GDB_MAIL_FROM
if istrysched: if istrysched:
f = "/tmp/gdb-buildbot-%s-try.lock" % rev f = "/tmp/gdb-buildbot-%s-try-%d.lock" % (rev, try_count)
else: else:
f = "/tmp/gdb-buildbot-%s.lock" % rev f = "/tmp/gdb-buildbot-%s.lock" % rev
@ -172,15 +174,17 @@ def SendRootMessageGDBTesters (branch, change, rev,
text = text.encode ('ascii', 'ignore').decode ('ascii') text = text.encode ('ascii', 'ignore').decode ('ascii')
else: else:
text = "" 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 += "Branch: %s\n" % branch
text += "Commit tested against: %s\n\n" % rev 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 += "Patch tested:\n\n"
text += change 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') text = text.encode ('ascii', 'ignore').decode ('ascii')
mail = MIMEText (text) mail = MIMEText (text)
@ -198,7 +202,7 @@ def SendRootMessageGDBTesters (branch, change, rev,
else: else:
mail['To'] = try_to mail['To'] = try_to
mailto = 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 = smtplib.SMTP ('localhost')
s.sendmail (GDB_MAIL_FROM, [ mailto ], mail.as_string ()) 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] cur_change = sourcestamp.patch[1]
properties = build.getProperties () properties = build.getProperties ()
isrebuild = properties.getProperty ('isRebuild') 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 ") try_to = build.getReason ().strip ("'try' job by user ")
# Sending the root message to gdb-testers. # Sending the root message to gdb-testers.
SendRootMessageGDBTesters (branch, cur_change, properties.getProperty ('revision'), SendRootMessageGDBTesters (branch, cur_change, properties.getProperty ('revision'),
istrysched = True, try_to = try_to) istrysched = True, try_to = try_to, try_count = count)
# Subject # Subject
subj = "Try Build on %s, branch %s" % (name, branch) 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. # URL to find more info about what went wrong.
text += "\nTestsuite log (gdb.sum and gdb.log) URL(s):\n" 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], text += "\t<%s/%s/try/%s/%s/%d/>\n\n" % (res_url, name, sourcestamp.revision[:2],
sourcestamp.revision) sourcestamp.revision, count)
# commit_id = get_builder_commit_id (name, sourcestamp.revision, # commit_id = get_builder_commit_id (name, sourcestamp.revision,
# sourcestamp.branch) # sourcestamp.branch)