summaryrefslogtreecommitdiff
path: root/cbuildbot/stages/sdk_stages_unittest.py
diff options
context:
space:
mode:
authorGilad Arnold <garnold@chromium.org>2015-06-02 10:38:09 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-05 22:35:08 +0000
commitc6047c3318a0367bcb3b89a06676cd013d1a5064 (patch)
treeb5ababef4789bcd1bb3b524e3c13b3d90eaadb21 /cbuildbot/stages/sdk_stages_unittest.py
parent0ceb45b74143b785e1085e64b37e2abb28525f96 (diff)
downloadchromite-c6047c3318a0367bcb3b89a06676cd013d1a5064.tar.gz
sdk_stages: Create a single toolchain overlay for each toolchain combo.
The overlay generating stage now does things a bit differently: * It generates a single overlay for each unique combination of toolchains that may be required by any board we care about. As part of that, it now scans the complete set of known boards, as reported by the site_config. * Overlay tarballs are named after their toolchains content, rather than the board for which they were generated. This also renames the stage (now SDKPackageToolchainOverlaysStage) to reflect its new semantics. CQ-DEPEND=CL:275150 BUG=brillo:918 TEST=Unit tests TEST=External trybots (failed on early patchsets) Change-Id: I634131fe1c97feb748861dc93403867d1884ee11 Reviewed-on: https://chromium-review.googlesource.com/275005 Reviewed-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org> Tested-by: Gilad Arnold <garnold@chromium.org>
Diffstat (limited to 'cbuildbot/stages/sdk_stages_unittest.py')
-rw-r--r--cbuildbot/stages/sdk_stages_unittest.py39
1 files changed, 27 insertions, 12 deletions
diff --git a/cbuildbot/stages/sdk_stages_unittest.py b/cbuildbot/stages/sdk_stages_unittest.py
index f3f932482..c51a90a7a 100644
--- a/cbuildbot/stages/sdk_stages_unittest.py
+++ b/cbuildbot/stages/sdk_stages_unittest.py
@@ -17,6 +17,7 @@ from chromite.lib import cros_build_lib
from chromite.lib import osutils
from chromite.lib import perf_uploader
from chromite.lib import portage_util
+from chromite.lib import toolchain
class SDKBuildToolchainsStageTest(
@@ -177,7 +178,7 @@ class SDKPackageStageTest(generic_stages_unittest.AbstractStageTestCase):
self.assertEqual(kwargs['revision'], 123456)
-class SDKPackageBoardToolchainsStageTest(
+class SDKPackageToolchainOverlaysStageTest(
generic_stages_unittest.AbstractStageTestCase):
"""Tests board toolchain overlay installation and packaging."""
@@ -214,28 +215,42 @@ class SDKPackageBoardToolchainsStageTest(
osutils.Touch(os.path.join(merged_dir, board + '.tmp'))
def ConstructStage(self):
- return sdk_stages.SDKPackageBoardToolchainsStage(self._run)
+ return sdk_stages.SDKPackageToolchainOverlaysStage(self._run)
def testTarballCreation(self):
"""Tests that tarballs are created for all board toolchains."""
self._Prepare('chromiumos-sdk')
self.RunStage()
- # Check that a tarball was created correctly for all boards.
- for board in self._boards:
- overlay_tarball = os.path.join(self.build_root,
- constants.DEFAULT_CHROOT_DIR,
- constants.SDK_OVERLAYS_OUTPUT,
- 'built-sdk-overlay-%s.tar.xz' % board)
+ # Check that a tarball was created correctly for all toolchain sets.
+ all_toolchain_combos = set()
+ for board in self._run.site_config.GetBoards():
+ try:
+ all_toolchain_combos.add(
+ '-'.join(sorted(toolchain.GetToolchainsForBoard(board).iterkeys())))
+ except portage_util.MissingOverlayException:
+ pass
+
+ for toolchains in all_toolchain_combos:
+ overlay_tarball = os.path.join(
+ self.build_root, constants.DEFAULT_CHROOT_DIR,
+ constants.SDK_OVERLAYS_OUTPUT,
+ 'built-sdk-overlay-toolchains-%s.tar.xz' % toolchains)
output = cros_build_lib.RunCommand(
['tar', '-I', 'xz', '-tvf', overlay_tarball],
capture_output=True).output.splitlines()
- # First line is './', use it as an anchor, count the chars, and strip as
- # much from all other lines.
+ # First line is './', use it as an anchor, count the chars, and strip
+ # as much from all other lines.
stripchars = len(output[0]) - 1
tar_lines = [x[stripchars:] for x in output[1:]]
- # Check that the overlay tarball contains the marker file only.
- self.assertListEqual(['/%s.tmp' % board], tar_lines)
+ # Check that the overlay tarball contains a marker file only, and that
+ # the board recorded by this marker file indeed uses the toolchains for
+ # which the tarball was built.
+ self.assertEqual(1, len(tar_lines))
+ board = tar_lines[0].lstrip('/')[:-len('.tmp')]
+ board_toolchains = '-'.join(sorted(
+ toolchain.GetToolchainsForBoard(board).iterkeys()))
+ self.assertEqual(toolchains, board_toolchains)
class SDKTestStageTest(generic_stages_unittest.AbstractStageTestCase):