Index: au_test_harness/au_worker.py |
diff --git a/au_test_harness/au_worker.py b/au_test_harness/au_worker.py |
index a25de7fff749138b2d8feed80ab3d253ef9fa443..3375d9e1aa68d5932f6ad0cd72ff9c67d6fb69d7 100644 |
--- a/au_test_harness/au_worker.py |
+++ b/au_test_harness/au_worker.py |
@@ -48,6 +48,17 @@ class AUWorker(object): |
"""Called at the end of every test.""" |
pass |
+ def GetUpdateMessage(self, update_target, update_base, from_vm, proxy): |
+ if update_base: |
+ str = 'Performing a delta update from %s to %s' % ( |
+ update_base, update_target) |
+ else: |
+ str = 'Performing a full update to %s' % update_target |
+ |
+ if from_vm: str += ' in a VM' |
+ if proxy: ' using a proxy on port %s' % proxy |
+ return str |
+ |
def UpdateImage(self, image_path, src_image_path='', stateful_change='old', |
proxy_port=None, private_key_path=None): |
"""Implementation of an actual update. |
@@ -111,19 +122,14 @@ class AUWorker(object): |
private_key_path: Path to a private key to use with update payload. |
Raises an update_exception.UpdateException if _UpdateImage returns an error. |
""" |
- try: |
- if not self.use_delta_updates: src_image_path = '' |
- if private_key_path: |
- key_to_use = private_key_path |
- else: |
- key_to_use = self.private_key |
- |
- self.UpdateImage(image_path, src_image_path, stateful_change, |
- proxy_port, key_to_use) |
- except update_exception.UpdateException as err: |
- # If the update fails, print it out |
- Warning(err.stdout) |
- raise |
+ if not self.use_delta_updates: src_image_path = '' |
+ if private_key_path: |
+ key_to_use = private_key_path |
+ else: |
+ key_to_use = self.private_key |
+ |
+ self.UpdateImage(image_path, src_image_path, stateful_change, |
+ proxy_port, key_to_use) |
@classmethod |
def SetUpdateCache(cls, update_cache): |
@@ -179,7 +185,6 @@ class AUWorker(object): |
Modifies cmd in places by appending appropriate items given args. |
""" |
if proxy_port: cmd.append('--proxy_port=%s' % proxy_port) |
- |
# Get pregenerated update if we have one. |
update_id = dev_server_wrapper.GenerateUpdateId(image_path, src_image_path, |
private_key_path) |
@@ -200,15 +205,16 @@ class AUWorker(object): |
if self.verbose: |
try: |
if log_directory: |
- cros_lib.RunCommand(cmd, log_to_file=os.path.join(log_directory, |
- 'update.log')) |
+ cros_lib.RunCommand( |
+ cmd, log_to_file=os.path.join(log_directory, 'update.log'), |
davidjames
2011/04/15 17:52:09
I wish that there were only one version of cros_bu
|
+ print_cmd=False) |
else: |
- cros_lib.RunCommand(cmd) |
- except Exception as e: |
- Warning(str(e)) |
+ cros_lib.RunCommand(cmd, print_cmd=False) |
+ except cros_lib.RunCommandException as e: |
raise update_exception.UpdateException(1, str(e)) |
davidjames
2011/04/15 17:52:09
Since you're logging to a file, I think the output
sosa
2011/04/18 21:12:44
It doesn't, however the logs are archived or a dev
|
else: |
- (code, stdout, stderr) = cros_lib.RunCommandCaptureOutput(cmd) |
+ (code, stdout, stderr) = cros_lib.RunCommandCaptureOutput( |
davidjames
2011/04/15 17:52:09
Maybe rename stdout to 'output' and stderr to '_un
sosa
2011/04/18 21:12:44
Done.
|
+ cmd, print_cmd=False) |
if code != 0: |
Warning(stdout) |
raise update_exception.UpdateException(code, stdout) |
@@ -223,13 +229,14 @@ class AUWorker(object): |
Returns: |
percent that passed. |
""" |
- cros_lib.Info('Output from VerifyImage():') |
- print >> sys.stderr, output |
- sys.stderr.flush() |
percent_passed = self._ParseGenerateTestReportOutput(output) |
cros_lib.Info('Percent passed: %d vs. Percent required: %d' % ( |
percent_passed, percent_required_to_pass)) |
- unittest.assertTrue(percent_passed >= percent_required_to_pass) |
+ if percent_passed < percent_required_to_pass: |
+ print output |
+ unittest.fail('%d percent of tests are required to pass' % |
+ percent_required_to_pass) |
+ |
return percent_passed |
def Initialize(self, port): |
@@ -276,7 +283,6 @@ class AUWorker(object): |
if line.startswith("Total PASS:"): |
# FORMAT: ^TOTAL PASS: num_passed/num_total (percent%)$ |
percent_passed = line.split()[3].strip('()%') |
- cros_lib.Info('Percent of tests passed %s' % percent_passed) |
break |
return int(percent_passed) |