From efbce1e26194e70b3fe9049db567c4f437cf597e Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Mon, 10 Jan 2011 09:56:34 -0800 Subject: [PATCH] Add simple update test to pfq. This CL also fixes the outstanding issue where to won't report progress in image_to_live on updates. Change-Id: I1efaf17f0fd5ebb367ae0872377b4d5d0bf5dbf6 BUG=chromium-os:8680,chromium-os:8901 TEST=Ran it with --debug on the x86 pfq locally. Review URL: http://codereview.chromium.org/6135002 --- bin/cbuildbot.py | 21 +++++++++++++++++++-- bin/cbuildbot_config.py | 14 +++++++------- bin/cros_au_test_harness.py | 4 ++-- image_to_live.sh | 30 +++++++++++++++++++----------- 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/bin/cbuildbot.py b/bin/cbuildbot.py index ff3fb8a94c..bb9e0cc23d 100755 --- a/bin/cbuildbot.py +++ b/bin/cbuildbot.py @@ -415,6 +415,22 @@ def _RunSmokeSuite(buildroot, results_dir): ], cwd=cwd, error_ok=False) +def _RunAUTest(buildroot, board): + """Runs a basic update test from the au test harness.""" + cwd = os.path.join(buildroot, 'src', 'scripts') + image_path = os.path.join(buildroot, 'src', 'build', 'images', board, + 'latest', 'chromiumos_test_image.bin') + RunCommand(['bin/cros_au_test_harness', + '--no_graphics', + '--no_delta', + '--board=%s' % board, + '--test_prefix=SimpleTest', + '--verbose', + '--base_image=%s' % image_path, + '--target_image=%s' % image_path, + ], cwd=cwd, error_ok=False) + + def _UprevPackages(buildroot, tracking_branch, revisionfile, board, overlays): """Uprevs a package based on given revisionfile. @@ -695,15 +711,16 @@ def main(): _BuildImage(buildroot) - if buildconfig['smoke_bvt'] and options.tests: + if buildconfig['tests'] and options.tests: _BuildVMImageForTesting(buildroot) test_results_dir = '/tmp/run_remote_tests.%s' % options.buildnumber try: _RunSmokeSuite(buildroot, test_results_dir) + _RunAUTest(buildroot, buildconfig['board']) finally: if not options.debug: archive_full_path = os.path.join(options.gsutil_archive, - str(options.buildnumber)) + str(options.buildnumber)) _ArchiveTestResults(buildroot, buildconfig['board'], test_results_dir=test_results_dir, gsutil=options.gsutil, diff --git a/bin/cbuildbot_config.py b/bin/cbuildbot_config.py index 2f7b6361dd..c13d3626cd 100644 --- a/bin/cbuildbot_config.py +++ b/bin/cbuildbot_config.py @@ -18,7 +18,7 @@ important -- Master bot uses important bots to determine overall status. hostname -- Needed for 'important' slaves. The hostname of the bot. Should match hostname in slaves.cfg in buildbot checkout. unittests -- Runs unittests for packages. -smoke_bvt -- Runs the test smoke suite in a qemu-based VM using KVM. +tests -- Runs the smoke suite and au test harness in a qemu-based VM using KVM. rev_overlays -- Select what overlays to look at for revving. This can be 'public', 'private' or 'both'. push_overlays -- Select what overlays to push at. This should be a subset of @@ -35,7 +35,7 @@ config['default'] = { 'master' : False, 'important' : False, 'unittests' : False, - 'smoke_bvt' : False, + 'tests' : False, 'rev_overlays': 'public', 'push_overlays': None, } @@ -46,7 +46,7 @@ config['x86-generic-pre-flight-queue'] = { 'important' : False, 'hostname' : 'chromeosbuild2', 'unittests' : True, - 'smoke_bvt' : True, + 'tests' : True, 'rev_overlays': 'public', 'push_overlays': 'public', } @@ -56,7 +56,7 @@ config['x86-mario-pre-flight-queue'] = { 'master' : True, 'important' : False, 'unittests' : True, - 'smoke_bvt' : True, + 'tests' : True, 'rev_overlays': 'both', 'push_overlays': 'private', } @@ -66,7 +66,7 @@ config['x86-mario-pre-flight-branch'] = { 'master' : True, 'important' : False, 'unittests' : True, - 'smoke_bvt' : True, + 'tests' : True, 'rev_overlays': 'both', 'push_overlays': 'both', } @@ -76,7 +76,7 @@ config['x86_agz_bin'] = { 'master' : False, 'important' : False, 'unittests' : True, - 'smoke_bvt' : True, + 'tests' : True, 'rev_overlays': 'both', 'push_overlays': None, } @@ -86,7 +86,7 @@ config['x86_dogfood_bin'] = { 'master' : False, 'important' : False, 'unittests' : True, - 'smoke_bvt' : True, + 'tests' : True, 'rev_overlays': 'both', 'push_overlays': None, } diff --git a/bin/cros_au_test_harness.py b/bin/cros_au_test_harness.py index 5d5b221760..aa9f77da12 100755 --- a/bin/cros_au_test_harness.py +++ b/bin/cros_au_test_harness.py @@ -358,12 +358,12 @@ class AUTest(object): self._AttemptUpdateWithFilter(DelayedFilter()) def SimpleTest(self): - """A simple update that updates the target image to itself. + """A simple update that updates once from a base image to a target. We explicitly don't use test prefix so that isn't run by default. Can be run using test_prefix option. """ - self.PrepareBase(target_image_path) + self.PrepareBase(base_image_path) self.UpdateImage(target_image_path) self.VerifyImage(100) diff --git a/image_to_live.sh b/image_to_live.sh index 553cd4d21d..bbb5ec904d 100755 --- a/image_to_live.sh +++ b/image_to_live.sh @@ -241,7 +241,6 @@ function get_update_log { echo "${REMOTE_OUT}" > "${FLAGS_update_log}" } - # Returns ${1} reported by the update client e.g. PROGRESS, CURRENT_OP. function get_update_var { remote_sh "${UPDATER_BIN} --status 2> /dev/null | @@ -254,21 +253,30 @@ function get_update_var { # This is expected to run in its own thread. function status_thread { local timeout=5 - # Let update engine receive call to ping the dev server. + info "Devserver handling ping. Check ${FLAGS_server_log} for more info." sleep ${timeout} - # The devserver generates images when the update engine checks for updates. - while [ $(get_update_var CURRENT_OP) = ${UPDATER_UPDATE_CHECK} ]; do - echo -n "." && sleep ${timeout} - done + local current_state="" + local next_state="$(get_update_var CURRENT_OP)" - info "Update generated. Update engine downloading update." - while [ $(get_update_var CURRENT_OP) = ${UPDATER_DOWNLOADING} ]; do - echo "Download progress $(get_update_var PROGRESS)" && sleep ${timeout} - done + # For current status, only print out status changes. + # For download, show progress. + # Finally if no status change print out .'s to keep dev informed. + while [ "${current_state}" != "${UPDATER_NEED_REBOOT}" ] && \ + [ "${current_state}" != "${UPDATER_IDLE}" ]; do + if [ "${current_state}" != "${next_state}" ]; then + info "State of updater has changed to: ${next_state}" + elif [ "${next_state}" = "${UPDATER_DOWNLOADING}" ]; then + echo "Download progress $(get_update_var PROGRESS)" + else + echo -n "." + fi - info "Download complete." + sleep ${timeout} + current_state="${next_state}" + next_state="$(get_update_var CURRENT_OP)" + done }