Revamping the try_count approach

This commit is contained in:
Sergio Durigan Junior 2017-09-05 09:43:15 -04:00
parent 68a2361140
commit 2dc344d038
5 changed files with 44 additions and 36 deletions

View file

@ -17,4 +17,6 @@ class SaveGDBResults (steps.MasterShellCommand):
"--base-directory", get_web_base (), "--base-directory", get_web_base (),
"--branch", util.Property ('branch'), "--branch", util.Property ('branch'),
"--is-try-sched", util.Property ('isTrySched', "--is-try-sched", util.Property ('isTrySched',
default = 'no') ] default = 'no'),
"--try-count", util.Property ('try_count',
default = '0') ]

View file

@ -39,13 +39,8 @@ def create_copy_command (props):
return [ 'true' ] return [ 'true' ]
if istry and istry == 'yes': if istry and istry == 'yes':
con = sqlite3.connect (db_file) try_count = props.getProperty ('try_count')
c = con.cursor () to_path = os.path.join (get_web_base (), builder, 'try', rev[:2], rev, try_count)
c.execute ('SELECT COUNT(*) FROM logs WHERE commitid = "%s" AND branch = "%s" AND trysched = 1' % (rev, branch))
count = int (c.fetchone ()[0])
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)
@ -137,7 +132,9 @@ class GdbCatSumfileCommand(steps.ShellCommand):
result = FAILURE result = FAILURE
if istry: if istry:
parser.write_try_build_sum_file (cur_results, builder, branch, rev) try_count = self.getProperty ('try_count')
parser.write_try_build_sum_file (cur_results, builder, branch, rev,
try_count)
else: else:
parser.write_sum_file (cur_results, builder, branch, rev, istry) parser.write_sum_file (cur_results, builder, branch, rev, istry)
# If there was no previous baseline, then this run # If there was no previous baseline, then this run

View file

@ -7,7 +7,6 @@ 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)): (.*)$')
@ -70,19 +69,12 @@ 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, branch = "master"): def _write_sum_file(self, sum_dict, builder, rev, filename, header = None,
istry = False, branch = "master", try_count = 0):
global gdb_web_base global gdb_web_base
if istry: if istry:
db_file = os.path.join (get_web_base (), builder, builder + '.db') bdir = os.path.join (gdb_web_base, builder, 'try', rev[:2], rev, try_count)
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 ()[0])
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)
@ -110,11 +102,12 @@ class DejaResults(object):
self._write_sum_file (sum_dict, builder, rev, 'gdb.sum', istry = False, self._write_sum_file (sum_dict, builder, rev, 'gdb.sum', istry = False,
branch = branch) 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, try_count):
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) branch = branch,
try_count = try_count)
def write_baseline(self, sum_dict, builder, branch, rev, istry): def write_baseline(self, sum_dict, builder, branch, rev, istry):
if istry: if istry:

View file

@ -440,23 +440,17 @@ 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')
try_count = properties.getProperty ('try_count')
db_file = os.path.join (get_web_base (), name, name + '.db') 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))
# We subtract one here because the "try" has been already stored
# into the db.
count = int (c.fetchone ()[0]) - 1
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, try_count = count) istrysched = True, try_to = try_to,
try_count = try_count)
# Subject # Subject
subj = "Try Build #%d on %s, branch %s" % (count, name, branch) subj = "Try Build #%d on %s, branch %s" % (try_count, name, branch)
# Body # Body
text = "" text = ""
@ -477,7 +471,7 @@ 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/%d/>\n\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, count) sourcestamp.revision, try_count)
# commit_id = get_builder_commit_id (name, sourcestamp.revision, # commit_id = get_builder_commit_id (name, sourcestamp.revision,
# sourcestamp.branch) # sourcestamp.branch)
@ -611,7 +605,7 @@ mn_try = MyMailNotifier(fromaddr = GDB_MAIL_FROM,
lookup = LookupEmailTryBuild (), lookup = LookupEmailTryBuild (),
tags = [ "MAIL", "TRY" ], tags = [ "MAIL", "TRY" ],
extraHeaders = { 'X-GDB-Buildbot' : '1', extraHeaders = { 'X-GDB-Buildbot' : '1',
'In-Reply-To' : util.Interpolate ("<%(prop:got_revision)s-try@gdb-build>")}) 'In-Reply-To' : util.Interpolate ("<%(prop:got_revision)s-try-$(prop:try_count)s@gdb-build>")})
c['status'].append (mn) c['status'].append (mn)
c['status'].append (mn_try) c['status'].append (mn_try)
@ -814,6 +808,21 @@ def scheduler_is_not_racy_do (step):
def scheduler_is_not_racy_try_do (step): def scheduler_is_not_racy_try_do (step):
return scheduler_is_not_racy (step) and scheduler_is_not_try (step) return scheduler_is_not_racy (step) and scheduler_is_not_try (step)
@util.renderer
def compute_try_build_count (props):
istry = props.getProperty ('scheduler').startswith ('try')
if not istry:
return { "try_count" : "0" }
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 = c.fetchone ()[0]
con.close ()
return { "try_count" : count }
####################### #######################
#### Build Factory #### #### Build Factory ####
####################### #######################
@ -917,6 +926,10 @@ The parameters of the class are:
self.addStep (CloneOrUpdateGDBMasterRepo (hideStepIf = True)) self.addStep (CloneOrUpdateGDBMasterRepo (hideStepIf = True))
self.addStep (CloneOrUpdateGDBRepo ()) self.addStep (CloneOrUpdateGDBRepo ())
# Set the count of the try build
self.addStep (steps.SetProperties (properties = compute_try_build_count),
hideStepIf = scheduler_is_not_try)
if self.run_testsuite: if self.run_testsuite:
self.addStep (CopyOldGDBSumFile (doStepIf = scheduler_is_not_racy_try_do, self.addStep (CopyOldGDBSumFile (doStepIf = scheduler_is_not_racy_try_do,
hideStepIf = False)) hideStepIf = False))

View file

@ -50,6 +50,10 @@ while test "$1" != "" ; do
IS_TRY_SCHED=$2 IS_TRY_SCHED=$2
shift 2 shift 2
;; ;;
"--try-count")
TRY_COUNT=$2
shift 2
;;
"--branch") "--branch")
BRANCH=$2 BRANCH=$2
shift 2 shift 2
@ -82,8 +86,7 @@ COMMIT_2_DIG=`echo $COMMIT | sed 's/^\(..\).*$/\1/'`
CDIR=$COMMIT_2_DIG/$COMMIT/ CDIR=$COMMIT_2_DIG/$COMMIT/
ISTRY=0 ISTRY=0
if test "$IS_TRY_SCHED" = "yes" ; then if test "$IS_TRY_SCHED" = "yes" ; then
COUNT=`sqlite3 $DB_NAME "SELECT COUNT(*) FROM logs WHERE commitid = '${COMMIT}' AND trysched = 1"` CDIR=try/${CDIR}/${TRY_COUNT}
CDIR=try/${CDIR}/${COUNT}
ISTRY=1 ISTRY=1
fi fi