Bug 1593779 - Bail out of test-verify tasks faster when there is no work to do; r=bc

This minor optimization is easily implemented: If there are no tests to verify, call fatal(0).
However, I encountered a minor obstacle: If the task exits before creating the upload directory,
the task fails, regardless of exit value; the remaining changes overcome this by creating the
upload directory earlier.

Differential Revision: https://phabricator.services.mozilla.com/D51684

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Geoff Brown 2019-11-04 21:46:57 +00:00
parent 02c8846b1d
commit 38dd21ea87
3 changed files with 11 additions and 8 deletions

View File

@ -269,6 +269,9 @@ class SingleTestMixin(object):
# chunk files
total_tests = sum([len(self.suites[x]) for x in self.suites])
if total_tests == 0:
self.fatal("No tests to verify: exiting.", 0)
files_per_chunk = total_tests / float(self.config.get('total_chunks', 1))
files_per_chunk = int(math.ceil(files_per_chunk))

View File

@ -569,6 +569,9 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin,
@PreScriptAction('download-and-extract')
def _pre_download_and_extract(self, action):
"""Abort if --artifact try syntax is used with compiled-code tests"""
dir = self.query_abs_dirs()['abs_blob_upload_dir']
self.mkdir_p(dir)
if not self.try_message_has_flag('artifact'):
return
self.info('Artifact build requested in try syntax.')
@ -778,8 +781,6 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin,
"""
try:
import psutil
dir = self.query_abs_dirs()['abs_blob_upload_dir']
self.mkdir_p(dir)
path = os.path.join(dir, "system-info.log")
with open(path, "w") as f:
f.write("System info collected at %s\n\n" % datetime.now())

View File

@ -213,11 +213,6 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM
cmd = [self.query_python_path('python'), '-u']
cmd.append(os.path.join(dirs["abs_wpttest_dir"], run_file_name))
# Make sure that the logging directory exists
if self.mkdir_p(dirs["abs_blob_upload_dir"]) == -1:
self.fatal("Could not create blobber upload directory")
# Exit
mozinfo.find_and_update_from_json(dirs['abs_test_install_dir'])
cmd += ["--log-raw=-",
@ -318,9 +313,13 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM
"mozpack/*",
"mozbuild/*"],
suite_categories=["web-platform"])
dirs = self.query_abs_dirs()
if self.is_android:
dirs = self.query_abs_dirs()
self.xre_path = self.download_hostutils(dirs['abs_xre_dir'])
# Make sure that the logging directory exists
if self.mkdir_p(dirs["abs_blob_upload_dir"]) == -1:
self.fatal("Could not create blobber upload directory")
# Exit
def install(self):
if self.is_android: