Chromium Code Reviews| 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, |