aboutsummaryrefslogtreecommitdiff
path: root/buildbot_test_llvm.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildbot_test_llvm.py')
-rwxr-xr-xbuildbot_test_llvm.py277
1 files changed, 148 insertions, 129 deletions
diff --git a/buildbot_test_llvm.py b/buildbot_test_llvm.py
index 1c7bb199..57f029c7 100755
--- a/buildbot_test_llvm.py
+++ b/buildbot_test_llvm.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -16,7 +16,6 @@ well as copying the result into a directory.
# Script to test different toolchains against ChromeOS benchmarks.
-from __future__ import print_function
import argparse
import datetime
@@ -24,19 +23,19 @@ import os
import sys
import time
+from cros_utils import buildbot_utils
from cros_utils import command_executer
from cros_utils import logger
-from cros_utils import buildbot_utils
-CROSTC_ROOT = '/usr/local/google/crostc'
-ROLE_ACCOUNT = 'mobiletc-prebuild'
+CROSTC_ROOT = "/usr/local/google/crostc"
+ROLE_ACCOUNT = "mobiletc-prebuild"
TOOLCHAIN_DIR = os.path.dirname(os.path.realpath(__file__))
-MAIL_PROGRAM = '~/var/bin/mail-detective'
-VALIDATION_RESULT_DIR = os.path.join(CROSTC_ROOT, 'validation_result')
+MAIL_PROGRAM = "~/var/bin/mail-detective"
+VALIDATION_RESULT_DIR = os.path.join(CROSTC_ROOT, "validation_result")
START_DATE = datetime.date(2016, 1, 1)
TEST_PER_DAY = 4
-DATA_DIR = '/google/data/rw/users/mo/mobiletc-prebuild/waterfall-report-data/'
+DATA_DIR = "/google/data/rw/users/mo/mobiletc-prebuild/waterfall-report-data/"
# Information about Rotating Boards
# Board Arch Reference Platform Kernel
@@ -63,137 +62,157 @@ DATA_DIR = '/google/data/rw/users/mo/mobiletc-prebuild/waterfall-report-data/'
# winky x86_64 rambi baytrail 4.4.*
TEST_BOARD = [
- 'atlas',
- 'cave',
- 'coral',
- 'cyan',
- 'elm',
+ "atlas",
+ "cave",
+ "coral",
+ "cyan",
+ "elm",
# 'eve', tested by amd64-llvm-next-toolchain builder.
- 'gale',
- 'grunt',
- 'fizz-moblab',
+ "gale",
+ "grunt",
+ "fizz-moblab",
# 'kevin', tested by arm64-llvm-next-toolchain builder.
- 'kevin64',
- 'lakitu',
- 'nyan_kitty',
- 'octopus',
- 'sentry',
- 'tidus',
+ "kevin64",
+ "lakitu",
+ "nyan_kitty",
+ "octopus",
+ "sentry",
+ "tidus",
# 'veyron_mighty', tested by arm-llvm-next-toolchain builder.
- 'whirlwind',
- 'winky',
+ "whirlwind",
+ "winky",
]
class ToolchainVerifier(object):
- """Class for the toolchain verifier."""
-
- def __init__(self, board, chromeos_root, weekday, patches, compiler):
- self._board = board
- self._chromeos_root = chromeos_root
- self._base_dir = os.getcwd()
- self._ce = command_executer.GetCommandExecuter()
- self._l = logger.GetLogger()
- self._compiler = compiler
- self._build = '%s-%s-toolchain-tryjob' % (board, compiler)
- self._patches = patches.split(',') if patches else []
- self._patches_string = '_'.join(str(p) for p in self._patches)
-
- if not weekday:
- self._weekday = time.strftime('%a')
- else:
- self._weekday = weekday
- self._reports = os.path.join(VALIDATION_RESULT_DIR, compiler, board)
-
- def DoAll(self):
- """Main function inside ToolchainComparator class.
-
- Launch trybot, get image names, create crosperf experiment file, run
- crosperf, and copy images into seven-day report directories.
- """
- buildbucket_id, _ = buildbot_utils.GetTrybotImage(
- self._chromeos_root,
- self._build,
- self._patches,
- tryjob_flags=['--hwtest'],
- asynchronous=True)
-
- return buildbucket_id
+ """Class for the toolchain verifier."""
+
+ def __init__(self, board, chromeos_root, weekday, patches, compiler):
+ self._board = board
+ self._chromeos_root = chromeos_root
+ self._base_dir = os.getcwd()
+ self._ce = command_executer.GetCommandExecuter()
+ self._l = logger.GetLogger()
+ self._compiler = compiler
+ self._build = "%s-%s-toolchain-tryjob" % (board, compiler)
+ self._patches = patches.split(",") if patches else []
+ self._patches_string = "_".join(str(p) for p in self._patches)
+
+ if not weekday:
+ self._weekday = time.strftime("%a")
+ else:
+ self._weekday = weekday
+ self._reports = os.path.join(VALIDATION_RESULT_DIR, compiler, board)
+
+ def DoAll(self):
+ """Main function inside ToolchainComparator class.
+
+ Launch trybot, get image names, create crosperf experiment file, run
+ crosperf, and copy images into seven-day report directories.
+ """
+ buildbucket_id, _ = buildbot_utils.GetTrybotImage(
+ self._chromeos_root,
+ self._build,
+ self._patches,
+ tryjob_flags=["--hwtest"],
+ asynchronous=True,
+ )
+
+ return buildbucket_id
def WriteRotatingReportsData(results_dict, date):
- """Write data for waterfall report."""
- fname = '%d-%02d-%02d.builds' % (date.year, date.month, date.day)
- filename = os.path.join(DATA_DIR, 'rotating-builders', fname)
- with open(filename, 'w', encoding='utf-8') as out_file:
- for board in results_dict.keys():
- buildbucket_id = results_dict[board]
- out_file.write('%s,%s\n' % (buildbucket_id, board))
+ """Write data for waterfall report."""
+ fname = "%d-%02d-%02d.builds" % (date.year, date.month, date.day)
+ filename = os.path.join(DATA_DIR, "rotating-builders", fname)
+ with open(filename, "w", encoding="utf-8") as out_file:
+ for board in results_dict.keys():
+ buildbucket_id = results_dict[board]
+ out_file.write("%s,%s\n" % (buildbucket_id, board))
def Main(argv):
- """The main function."""
-
- # Common initializations
- command_executer.InitCommandExecuter()
- parser = argparse.ArgumentParser()
- parser.add_argument('--chromeos_root',
- dest='chromeos_root',
- help='The chromeos root from which to run tests.')
- parser.add_argument('--weekday',
- default='',
- dest='weekday',
- help='The day of the week for which to run tests.')
- parser.add_argument('--board',
- default='',
- dest='board',
- help='The board to test.')
- parser.add_argument('--patch',
- dest='patches',
- default='',
- help='The patches to use for the testing, '
- "seprate the patch numbers with ',' "
- 'for more than one patches.')
- parser.add_argument(
- '--compiler',
- dest='compiler',
- help='Which compiler (llvm, llvm-next or gcc) to use for '
- 'testing.')
-
- options = parser.parse_args(argv[1:])
- if not options.chromeos_root:
- print('Please specify the ChromeOS root directory.')
- return 1
- if not options.compiler:
- print('Please specify which compiler to test (gcc, llvm, or llvm-next).')
- return 1
-
- if options.board:
- fv = ToolchainVerifier(options.board, options.chromeos_root,
- options.weekday, options.patches, options.compiler)
- return fv.DoAll()
-
- today = datetime.date.today()
- delta = today - START_DATE
- days = delta.days
-
- start_board = (days * TEST_PER_DAY) % len(TEST_BOARD)
- results_dict = dict()
- for i in range(TEST_PER_DAY):
- try:
- board = TEST_BOARD[(start_board + i) % len(TEST_BOARD)]
- fv = ToolchainVerifier(board, options.chromeos_root, options.weekday,
- options.patches, options.compiler)
- buildbucket_id = fv.DoAll()
- if buildbucket_id:
- results_dict[board] = buildbucket_id
- except SystemExit:
- logfile = os.path.join(VALIDATION_RESULT_DIR, options.compiler, board)
- with open(logfile, 'w', encoding='utf-8') as f:
- f.write('Verifier got an exception, please check the log.\n')
- WriteRotatingReportsData(results_dict, today)
-
-
-if __name__ == '__main__':
- retval = Main(sys.argv)
- sys.exit(retval)
+ """The main function."""
+
+ # Common initializations
+ command_executer.InitCommandExecuter()
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "--chromeos_root",
+ dest="chromeos_root",
+ help="The chromeos root from which to run tests.",
+ )
+ parser.add_argument(
+ "--weekday",
+ default="",
+ dest="weekday",
+ help="The day of the week for which to run tests.",
+ )
+ parser.add_argument(
+ "--board", default="", dest="board", help="The board to test."
+ )
+ parser.add_argument(
+ "--patch",
+ dest="patches",
+ default="",
+ help="The patches to use for the testing, "
+ "seprate the patch numbers with ',' "
+ "for more than one patches.",
+ )
+ parser.add_argument(
+ "--compiler",
+ dest="compiler",
+ help="Which compiler (llvm, llvm-next or gcc) to use for " "testing.",
+ )
+
+ options = parser.parse_args(argv[1:])
+ if not options.chromeos_root:
+ print("Please specify the ChromeOS root directory.")
+ return 1
+ if not options.compiler:
+ print(
+ "Please specify which compiler to test (gcc, llvm, or llvm-next)."
+ )
+ return 1
+
+ if options.board:
+ fv = ToolchainVerifier(
+ options.board,
+ options.chromeos_root,
+ options.weekday,
+ options.patches,
+ options.compiler,
+ )
+ return fv.DoAll()
+
+ today = datetime.date.today()
+ delta = today - START_DATE
+ days = delta.days
+
+ start_board = (days * TEST_PER_DAY) % len(TEST_BOARD)
+ results_dict = dict()
+ for i in range(TEST_PER_DAY):
+ try:
+ board = TEST_BOARD[(start_board + i) % len(TEST_BOARD)]
+ fv = ToolchainVerifier(
+ board,
+ options.chromeos_root,
+ options.weekday,
+ options.patches,
+ options.compiler,
+ )
+ buildbucket_id = fv.DoAll()
+ if buildbucket_id:
+ results_dict[board] = buildbucket_id
+ except SystemExit:
+ logfile = os.path.join(
+ VALIDATION_RESULT_DIR, options.compiler, board
+ )
+ with open(logfile, "w", encoding="utf-8") as f:
+ f.write("Verifier got an exception, please check the log.\n")
+ WriteRotatingReportsData(results_dict, today)
+
+
+if __name__ == "__main__":
+ retval = Main(sys.argv)
+ sys.exit(retval)