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

Unified Diff: ctest/ctest.py

Issue 6677165: Add feature to ctest that allows it to run against the latest image if no latest candidate exists. (Closed) Base URL: http://git.chromium.org/git/crostestutils.git@master
Patch Set: Created 9 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ctest/ctest.py
diff --git a/ctest/ctest.py b/ctest/ctest.py
index f7653ee86753f6544ceef3fb3bd20220e7e4c9cb..7a6443549c89f5f94675baf237cfd3444da6ffce 100755
--- a/ctest/ctest.py
+++ b/ctest/ctest.py
@@ -143,7 +143,8 @@ def GetNewestLinkFromZipBase(board, channel, zip_server_base):
def GetLatestZipUrl(board, channel, zip_server_base):
"""Returns the url of the latest image zip for the given arguments.
- If the latest does not exist, tries to find the rc equivalent.
+ If the latest does not exist, tries to find the rc equivalent. If neither
+ exist, returns None.
Args:
board: board for the image zip.
@@ -153,8 +154,12 @@ def GetLatestZipUrl(board, channel, zip_server_base):
try:
return GetNewestLinkFromZipBase(board, channel, zip_server_base)
except:
- cros_lib.Warning('Failed to get url from standard zip base. Trying rc.')
+ cros_lib.Warning('Failed to get url from zip base.')
+ try:
return GetNewestLinkFromZipBase(board + '-rc', channel, zip_server_base)
+ except:
dgarrett 2011/04/05 23:36:38 I know you're just following pattern, but these re
+ cros_lib.Warning('Failed to get url from zip base for release candidates.')
+ return None
def GrabZipAndExtractImage(zip_url, download_folder, image_name) :
@@ -242,16 +247,26 @@ def RunAUTestHarness(board, channel, zip_server_base,
test_results_root: Root directory to store au_test_harness results.
"""
crosutils_root = os.path.join(constants.SOURCE_ROOT, 'src', 'scripts')
- download_folder = os.path.abspath('latest_download')
- zip_url = GetLatestZipUrl(board, channel, zip_server_base)
- GrabZipAndExtractImage(zip_url, download_folder, _IMAGE_TO_EXTRACT)
- # Tests go here.
+ # Grab the latest image we've built.
return_object = cros_lib.RunCommand(
- ['./get_latest_image.sh', '--board=%s' % board], cwd=crosutils_root,
- redirect_stdout=True, print_cmd=True)
+ ['./get_latest_image.sh', '--board=%s' % board], cwd=crosutils_root,
+ redirect_stdout=True, print_cmd=True)
+
+ latest_image_dir = return_object.output.strip()
+ target_image = os.path.join(latest_image_dir, _IMAGE_TO_EXTRACT)
+
+ # Grab the latest official build for this board to use as the base image.
+ # If it doesn't exist, run the update test against itself.
+ download_folder = os.path.abspath('latest_download')
+ zip_url = GetLatestZipUrl(board, channel, zip_server_base)
- latest_image = return_object.output.strip()
+ base_image = None
+ if zip_url:
+ GrabZipAndExtractImage(zip_url, download_folder, _IMAGE_TO_EXTRACT)
+ base_image = os.path.join(download_folder, _IMAGE_TO_EXTRACT)
+ else:
+ base_image = target_image
update_engine_path = os.path.join(crosutils_root, '..', 'platform',
'update_engine')
@@ -260,10 +275,8 @@ def RunAUTestHarness(board, channel, zip_server_base,
public_key_path = GeneratePublicKey(private_key_path)
cmd = ['bin/cros_au_test_harness',
- '--base_image=%s' % os.path.join(download_folder,
- _IMAGE_TO_EXTRACT),
- '--target_image=%s' % os.path.join(latest_image,
- _IMAGE_TO_EXTRACT),
+ '--base_image=%s' % base_image,
+ '--target_image=%s' % target_image,
'--board=%s' % board,
'--type=%s' % type,
'--remote=%s' % remote,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698