Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1446)

Unified Diff: bin/au_test_harness/real_au_worker.py

Issue 6597122: Refactor au_test_harness into modules and refactor to use worker design. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Nit party Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bin/au_test_harness/parallel_test_job.py ('k') | bin/au_test_harness/update_exception.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/au_test_harness/real_au_worker.py
diff --git a/bin/au_test_harness/real_au_worker.py b/bin/au_test_harness/real_au_worker.py
new file mode 100644
index 0000000000000000000000000000000000000000..492d2e24c9fafb877fe4b813c46e3c47b539ecf8
--- /dev/null
+++ b/bin/au_test_harness/real_au_worker.py
@@ -0,0 +1,61 @@
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Module containing class that implements an au_worker for a test device."""
+
+import unittest
+
+import cros_build_lib as cros_lib
+
+import au_worker
+
+class RealAUWorker(au_worker.AUWorker):
+ """Test harness for updating real images."""
+
+ def __init__(self, options):
+ """Processes non-vm-specific options."""
+ au_worker.AUWorker.__init__(self, options)
+ self.remote = options.remote
+ if not self.remote: cros_lib.Die('We require a remote address for tests.')
+
+ def PrepareBase(self, image_path):
+ """Auto-update to base image to prepare for test."""
+ self.PrepareRealBase(image_path)
+
+ def UpdateImage(self, image_path, src_image_path='', stateful_change='old',
+ proxy_port=None, private_key_path=None):
+ """Updates a remote image using image_to_live.sh."""
+ stateful_change_flag = self.GetStatefulChangeFlag(stateful_change)
+ cmd = ['%s/image_to_live.sh' % self.crosutils,
+ '--remote=%s' % self.remote,
+ stateful_change_flag,
+ '--verify',
+ ]
+ self.AppendUpdateFlags(cmd, image_path, src_image_path, proxy_port,
+ private_key_path)
+ self.RunUpdateCmd(cmd)
+
+ def UpdateUsingPayload(self, update_path, stateful_change='old',
+ proxy_port=None):
+ """Updates a remote image using image_to_live.sh."""
+ stateful_change_flag = self.GetStatefulChangeFlag(stateful_change)
+ cmd = ['%s/image_to_live.sh' % self.crosutils,
+ '--payload=%s' % update_path,
+ '--remote=%s' % self.remote,
+ stateful_change_flag,
+ '--verify',
+ ]
+ if proxy_port: cmd.append('--proxy_port=%s' % proxy_port)
+ self.RunUpdateCmd(cmd)
+
+ def VerifyImage(self, unittest, percent_required_to_pass=100):
+ """Verifies an image using run_remote_tests.sh with verification suite."""
+ output = cros_lib.RunCommand(
+ ['%s/run_remote_tests.sh' % self.crosutils,
+ '--remote=%s' % self.remote,
+ self.verify_suite,
+ ], error_ok=True, enter_chroot=False, redirect_stdout=True)
+ return self.AssertEnoughTestsPassed(unittest, output,
+ percent_required_to_pass)
+
« no previous file with comments | « bin/au_test_harness/parallel_test_job.py ('k') | bin/au_test_harness/update_exception.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698