deploy_chrome: Get the board name from --build-dir
The build directory generated by chrome-sdk (i.e. out_$BOARD/Release)
contains the board name.
If the build directory is specified, there is no need to specify the
board name separately.
BUG=None
TEST=deploy_chrome --build-dir=out_hatch/Release --device=$DUT
TEST=./run_tests
Change-Id: Ib3c8af99837b4f4dad398c0bb1ca66340bce429a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2830281
Tested-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
diff --git a/scripts/deploy_chrome_unittest.py b/scripts/deploy_chrome_unittest.py
index 3ba6340..7db5f00 100644
--- a/scripts/deploy_chrome_unittest.py
+++ b/scripts/deploy_chrome_unittest.py
@@ -51,6 +51,24 @@
list(_REGULAR_TO) + ['--board', _TARGET_BOARD],
check_attrs={'code': 2})
+ def testBuildDirSpecified(self):
+ """Test case of build dir specified."""
+ argv = list(_REGULAR_TO) + ['--board', _TARGET_BOARD, '--build-dir',
+ '/path/to/chrome']
+ _ParseCommandLine(argv)
+
+ def testBuildDirSpecifiedWithoutBoard(self):
+ """Test case of build dir specified without --board."""
+ argv = list(_REGULAR_TO) + [
+ '--build-dir', '/path/to/chrome/out_' + _TARGET_BOARD + '/Release']
+ options = _ParseCommandLine(argv)
+ self.assertEqual(options.board, _TARGET_BOARD)
+
+ def testBuildDirSpecifiedWithoutBoardError(self):
+ """Test case of irregular build dir specified without --board."""
+ argv = list(_REGULAR_TO) + ['--build-dir', '/path/to/chrome/foo/bar']
+ self.assertParseError(argv)
+
def testGsPathSpecified(self):
"""Test case of GS path specified."""
argv = list(_REGULAR_TO) + ['--board', _TARGET_BOARD, '--gs-path', _GS_PATH]
@@ -62,6 +80,11 @@
'/path/to/chrome']
_ParseCommandLine(argv)
+ def testNoBoard(self):
+ """Test no board specified."""
+ argv = list(_REGULAR_TO) + ['--gs-path', _GS_PATH]
+ self.assertParseError(argv)
+
def testNoTarget(self):
"""Test no target specified."""
argv = ['--board', _TARGET_BOARD, '--gs-path', _GS_PATH]