Add ability for cbuildbot to only run unit tests for revved packages.

Change-Id: I6744aac09fb075f91f710f16343fab45b8dc8af9

BUG=chromium-os:7283
TEST=Ran it with cbuildbot through the unit tests phase and looked
at the file and saw it get parsed correctly.

Review URL: http://codereview.chromium.org/5124006
This commit is contained in:
Chris Sosa 2010-11-22 13:44:51 -08:00
parent d9360f12c3
commit e4836188a8
3 changed files with 25 additions and 7 deletions

View File

@ -22,6 +22,7 @@ from cros_build_lib import (Die, Info, ReinterpretPathForChroot, RunCommand,
Warning)
_DEFAULT_RETRIES = 3
_PACKAGE_FILE = '%(buildroot)s/src/scripts/cbuildbot_package.list'
ARCHIVE_BASE = '/var/www/archive'
ARCHIVE_COUNT = 10
@ -202,6 +203,8 @@ def _UprevFromRevisionList(buildroot, tracking_branch, revision_list, board,
'--tracking_branch=%s' % tracking_branch,
'--overlays=%s' % ':'.join(chroot_overlays),
'--packages=%s' % ':'.join(packages),
'--drop_file=%s' % ReinterpretPathForChroot(_PACKAGE_FILE %
{'buildroot': buildroot}),
'commit'],
cwd=cwd, enter_chroot=True)
@ -213,7 +216,10 @@ def _UprevAllPackages(buildroot, tracking_branch, board, overlays):
RunCommand(['./cros_mark_as_stable', '--all',
'--board=%s' % board,
'--overlays=%s' % ':'.join(chroot_overlays),
'--tracking_branch=%s' % tracking_branch, 'commit'],
'--tracking_branch=%s' % tracking_branch,
'--drop_file=%s' % ReinterpretPathForChroot(_PACKAGE_FILE %
{'buildroot': buildroot}),
'commit'],
cwd=cwd, enter_chroot=True)
@ -333,7 +339,10 @@ def _BuildVMImageForTesting(buildroot):
def _RunUnitTests(buildroot):
cwd = os.path.join(buildroot, 'src', 'scripts')
RunCommand(['./cros_run_unit_tests'], cwd=cwd, enter_chroot=True)
RunCommand(['./cros_run_unit_tests',
'--package_file=%s' % ReinterpretPathForChroot(_PACKAGE_FILE %
{'buildroot': buildroot}),
], cwd=cwd, enter_chroot=True)
def _RunSmokeSuite(buildroot, results_dir):

View File

@ -22,6 +22,8 @@ gflags.DEFINE_boolean('all', False,
'Mark all packages as stable.')
gflags.DEFINE_string('board', '',
'Board for which the package belongs.', short_name='b')
gflags.DEFINE_string('drop_file', None,
'File to list packages that were revved.')
gflags.DEFINE_boolean('dryrun', False,
'Passes dry-run to git push if pushing a change.')
gflags.DEFINE_string('overlays', '',
@ -569,6 +571,10 @@ def main(argv):
if revved_packages:
_CleanStalePackages(gflags.FLAGS.board, revved_packages)
if gflags.FLAGS.drop_file:
fh = open(gflags.FLAGS.drop_file, 'w')
fh.write(' '.join(revved_packages))
fh.close()
else:
work_branch.Delete()

View File

@ -19,6 +19,8 @@ DEFINE_string board "${DEFAULT_BOARD}" \
"Target board of which tests were built"
DEFINE_string build_root "${DEFAULT_BUILD_ROOT}" \
"Root of build output"
DEFINE_string package_file "" \
"File with space-separated list of packages to run unit tests" f
DEFINE_string packages "" \
"Optional space-separated list of packages to run unit tests" p
@ -55,11 +57,12 @@ set -e
[ -z "${FLAGS_board}" ] && die "--board required"
# If no packages are specified we run all unit tests for chromeos-base
# packages.
if [ -n "${FLAGS_packages}" ]; then
PACKAGE_LIST="${FLAGS_packages}"
else
# Create package list from package file and list of packages.
[ -n "${FLAGS_package_file}" ] && PACKAGE_LIST="$(cat ${FLAGS_package_file})"
[ -n "${FLAGS_packages}" ] && PACKAGE_LIST="${PACKAGE_LIST} ${FLAGS_packages}"
# If we didn't specify packages, find all packages.
if [ -z "${FLAGS_package_file}" -a -z "${FLAGS_packages}" ]; then
PACKAGE_LIST=$( ./get_package_list chromeos --board="${FLAGS_board}" |
egrep '^chromeos-base' )
fi