#!/usr/bin/python
-
# Copyright (c) 2012 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.
"""This module tests the cros image command."""
+from __future__ import print_function
+
import copy
import mock
import os
import sys
sys.path.insert(0, os.path.abspath('%s/../../..' % os.path.dirname(__file__)))
-from chromite.buildbot import constants
+from chromite.cbuildbot import constants
from chromite.cros.commands import cros_chrome_sdk
from chromite.cros.commands import init_unittest
from chromite.lib import cache
def testClang(self):
"""Verifies clang codepath."""
- with cros_test_lib.LoggingCapturer() as logs:
- cmd_cls = cros_chrome_sdk.ChromeSDKCommand
- update_sh = os.path.join(self.chrome_src_dir, cmd_cls._CLANG_UPDATE_SH)
- osutils.Touch(update_sh, makedirs=True)
- self.rc_mock.AddCmdResult(partial_mock.ListRegex('.*-gcc -dumpversion'),
- output='4.7.3')
- self.SetupCommandMock(extra_args=['--clang', '--make'])
+ with cros_test_lib.LoggingCapturer():
+ self.SetupCommandMock(extra_args=['--clang'])
self.cmd_mock.inst.Run()
- self.assertTrue(self.FindInPath(
- self.cmd_mock.env['PATH'], cmd_cls._CLANG_DIR))
- self.AssertLogsContain(logs, '%s not found.' % cmd_cls._CLANG_DIR)
class GomaTest(cros_test_lib.MockTempDirTestCase,
VERSION_BASE = ('gs://chromeos-image-archive/%s-release/LATEST-%s'
% (BOARD, VERSION))
- CAT_ERROR = ('InvalidUriError: Attempt to get key for '
- '%s failed.' % VERSION_BASE)
- LS_ERROR = 'CommandException: One or more URIs matched no objects.'
+ CAT_ERROR = 'CommandException: No URLs matched %s' % VERSION_BASE
+ LS_ERROR = 'CommandException: One or more URLs matched no objects.'
def setUp(self):
self.gs_mock = self.StartPatcher(gs_unittest.GSContextMock())
with cros_test_lib.LoggingCapturer() as logs:
cros_chrome_sdk.ChromeSDKCommand._VerifyGoma(None)
- cros_chrome_sdk.ChromeSDKCommand._VerifyClang(None)
cros_chrome_sdk.ChromeSDKCommand._VerifyChromiteBin(None)
- for msg in ['managed Goma', 'default Clang', 'default Chromite']:
+ for msg in ['managed Goma', 'default Chromite']:
self.AssertLogsMatch(logs, msg)