func_test.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. # SPDX-License-Identifier: GPL-2.0+
  2. # Copyright (c) 2014 Google, Inc
  3. #
  4. import os
  5. import shutil
  6. import sys
  7. import tempfile
  8. import unittest
  9. from buildman import board
  10. from buildman import bsettings
  11. from buildman import cmdline
  12. from buildman import control
  13. from buildman import toolchain
  14. from patman import command
  15. from patman import gitutil
  16. from patman import terminal
  17. from patman import tools
  18. settings_data = '''
  19. # Buildman settings file
  20. [toolchain]
  21. [toolchain-alias]
  22. [make-flags]
  23. src=/home/sjg/c/src
  24. chroot=/home/sjg/c/chroot
  25. vboot=VBOOT_DEBUG=1 MAKEFLAGS_VBOOT=DEBUG=1 CFLAGS_EXTRA_VBOOT=-DUNROLL_LOOPS VBOOT_SOURCE=${src}/platform/vboot_reference
  26. chromeos_coreboot=VBOOT=${chroot}/build/link/usr ${vboot}
  27. chromeos_daisy=VBOOT=${chroot}/build/daisy/usr ${vboot}
  28. chromeos_peach=VBOOT=${chroot}/build/peach_pit/usr ${vboot}
  29. '''
  30. boards = [
  31. ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 1', 'board0', ''],
  32. ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 2', 'board1', ''],
  33. ['Active', 'powerpc', 'powerpc', '', 'Tester', 'PowerPC board 1', 'board2', ''],
  34. ['Active', 'sandbox', 'sandbox', '', 'Tester', 'Sandbox board', 'board4', ''],
  35. ]
  36. commit_shortlog = """4aca821 patman: Avoid changing the order of tags
  37. 39403bb patman: Use --no-pager' to stop git from forking a pager
  38. db6e6f2 patman: Remove the -a option
  39. f2ccf03 patman: Correct unit tests to run correctly
  40. 1d097f9 patman: Fix indentation in terminal.py
  41. d073747 patman: Support the 'reverse' option for 'git log
  42. """
  43. commit_log = ["""commit 7f6b8315d18f683c5181d0c3694818c1b2a20dcd
  44. Author: Masahiro Yamada <yamada.m@jp.panasonic.com>
  45. Date: Fri Aug 22 19:12:41 2014 +0900
  46. buildman: refactor help message
  47. "buildman [options]" is displayed by default.
  48. Append the rest of help messages to parser.usage
  49. instead of replacing it.
  50. Besides, "-b <branch>" is not mandatory since commit fea5858e.
  51. Drop it from the usage.
  52. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
  53. """,
  54. """commit d0737479be6baf4db5e2cdbee123e96bc5ed0ba8
  55. Author: Simon Glass <sjg@chromium.org>
  56. Date: Thu Aug 14 16:48:25 2014 -0600
  57. patman: Support the 'reverse' option for 'git log'
  58. This option is currently not supported, but needs to be, for buildman to
  59. operate as expected.
  60. Series-changes: 7
  61. - Add new patch to fix the 'reverse' bug
  62. Series-version: 8
  63. Change-Id: I79078f792e8b390b8a1272a8023537821d45feda
  64. Reported-by: York Sun <yorksun@freescale.com>
  65. Signed-off-by: Simon Glass <sjg@chromium.org>
  66. """,
  67. """commit 1d097f9ab487c5019152fd47bda126839f3bf9fc
  68. Author: Simon Glass <sjg@chromium.org>
  69. Date: Sat Aug 9 11:44:32 2014 -0600
  70. patman: Fix indentation in terminal.py
  71. This code came from a different project with 2-character indentation. Fix
  72. it for U-Boot.
  73. Series-changes: 6
  74. - Add new patch to fix indentation in teminal.py
  75. Change-Id: I5a74d2ebbb3cc12a665f5c725064009ac96e8a34
  76. Signed-off-by: Simon Glass <sjg@chromium.org>
  77. """,
  78. """commit f2ccf03869d1e152c836515a3ceb83cdfe04a105
  79. Author: Simon Glass <sjg@chromium.org>
  80. Date: Sat Aug 9 11:08:24 2014 -0600
  81. patman: Correct unit tests to run correctly
  82. It seems that doctest behaves differently now, and some of the unit tests
  83. do not run. Adjust the tests to work correctly.
  84. ./tools/patman/patman --test
  85. <unittest.result.TestResult run=10 errors=0 failures=0>
  86. Series-changes: 6
  87. - Add new patch to fix patman unit tests
  88. Change-Id: I3d2ca588f4933e1f9d6b1665a00e4ae58269ff3b
  89. """,
  90. """commit db6e6f2f9331c5a37647d6668768d4a40b8b0d1c
  91. Author: Simon Glass <sjg@chromium.org>
  92. Date: Sat Aug 9 12:06:02 2014 -0600
  93. patman: Remove the -a option
  94. It seems that this is no longer needed, since checkpatch.pl will catch
  95. whitespace problems in patches. Also the option is not widely used, so
  96. it seems safe to just remove it.
  97. Series-changes: 6
  98. - Add new patch to remove patman's -a option
  99. Suggested-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
  100. Change-Id: I5821a1c75154e532c46513486ca40b808de7e2cc
  101. """,
  102. """commit 39403bb4f838153028a6f21ca30bf100f3791133
  103. Author: Simon Glass <sjg@chromium.org>
  104. Date: Thu Aug 14 21:50:52 2014 -0600
  105. patman: Use --no-pager' to stop git from forking a pager
  106. """,
  107. """commit 4aca821e27e97925c039e69fd37375b09c6f129c
  108. Author: Simon Glass <sjg@chromium.org>
  109. Date: Fri Aug 22 15:57:39 2014 -0600
  110. patman: Avoid changing the order of tags
  111. patman collects tags that it sees in the commit and places them nicely
  112. sorted at the end of the patch. However, this is not really necessary and
  113. in fact is apparently not desirable.
  114. Series-changes: 9
  115. - Add new patch to avoid changing the order of tags
  116. Series-version: 9
  117. Suggested-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
  118. Change-Id: Ib1518588c1a189ad5c3198aae76f8654aed8d0db
  119. """]
  120. TEST_BRANCH = '__testbranch'
  121. class TestFunctional(unittest.TestCase):
  122. """Functional test for buildman.
  123. This aims to test from just below the invocation of buildman (parsing
  124. of arguments) to 'make' and 'git' invocation. It is not a true
  125. emd-to-end test, as it mocks git, make and the tool chain. But this
  126. makes it easier to detect when the builder is doing the wrong thing,
  127. since in many cases this test code will fail. For example, only a
  128. very limited subset of 'git' arguments is supported - anything
  129. unexpected will fail.
  130. """
  131. def setUp(self):
  132. self._base_dir = tempfile.mkdtemp()
  133. self._output_dir = tempfile.mkdtemp()
  134. self._git_dir = os.path.join(self._base_dir, 'src')
  135. self._buildman_pathname = sys.argv[0]
  136. self._buildman_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
  137. command.test_result = self._HandleCommand
  138. self.setupToolchains()
  139. self._toolchains.Add('arm-gcc', test=False)
  140. self._toolchains.Add('powerpc-gcc', test=False)
  141. bsettings.Setup(None)
  142. bsettings.AddFile(settings_data)
  143. self._boards = board.Boards()
  144. for brd in boards:
  145. self._boards.AddBoard(board.Board(*brd))
  146. # Directories where the source been cloned
  147. self._clone_dirs = []
  148. self._commits = len(commit_shortlog.splitlines()) + 1
  149. self._total_builds = self._commits * len(boards)
  150. # Number of calls to make
  151. self._make_calls = 0
  152. # Map of [board, commit] to error messages
  153. self._error = {}
  154. self._test_branch = TEST_BRANCH
  155. # Avoid sending any output and clear all terminal output
  156. terminal.SetPrintTestMode()
  157. terminal.GetPrintTestLines()
  158. def tearDown(self):
  159. shutil.rmtree(self._base_dir)
  160. #shutil.rmtree(self._output_dir)
  161. def setupToolchains(self):
  162. self._toolchains = toolchain.Toolchains()
  163. self._toolchains.Add('gcc', test=False)
  164. def _RunBuildman(self, *args):
  165. return command.RunPipe([[self._buildman_pathname] + list(args)],
  166. capture=True, capture_stderr=True)
  167. def _RunControl(self, *args, clean_dir=False, boards=None):
  168. sys.argv = [sys.argv[0]] + list(args)
  169. options, args = cmdline.ParseArgs()
  170. result = control.DoBuildman(options, args, toolchains=self._toolchains,
  171. make_func=self._HandleMake, boards=boards or self._boards,
  172. clean_dir=clean_dir)
  173. self._builder = control.builder
  174. return result
  175. def testFullHelp(self):
  176. command.test_result = None
  177. result = self._RunBuildman('-H')
  178. help_file = os.path.join(self._buildman_dir, 'README')
  179. # Remove possible extraneous strings
  180. extra = '::::::::::::::\n' + help_file + '\n::::::::::::::\n'
  181. gothelp = result.stdout.replace(extra, '')
  182. self.assertEqual(len(gothelp), os.path.getsize(help_file))
  183. self.assertEqual(0, len(result.stderr))
  184. self.assertEqual(0, result.return_code)
  185. def testHelp(self):
  186. command.test_result = None
  187. result = self._RunBuildman('-h')
  188. help_file = os.path.join(self._buildman_dir, 'README')
  189. self.assertTrue(len(result.stdout) > 1000)
  190. self.assertEqual(0, len(result.stderr))
  191. self.assertEqual(0, result.return_code)
  192. def testGitSetup(self):
  193. """Test gitutils.Setup(), from outside the module itself"""
  194. command.test_result = command.CommandResult(return_code=1)
  195. gitutil.Setup()
  196. self.assertEqual(gitutil.use_no_decorate, False)
  197. command.test_result = command.CommandResult(return_code=0)
  198. gitutil.Setup()
  199. self.assertEqual(gitutil.use_no_decorate, True)
  200. def _HandleCommandGitLog(self, args):
  201. if args[-1] == '--':
  202. args = args[:-1]
  203. if '-n0' in args:
  204. return command.CommandResult(return_code=0)
  205. elif args[-1] == 'upstream/master..%s' % self._test_branch:
  206. return command.CommandResult(return_code=0, stdout=commit_shortlog)
  207. elif args[:3] == ['--no-color', '--no-decorate', '--reverse']:
  208. if args[-1] == self._test_branch:
  209. count = int(args[3][2:])
  210. return command.CommandResult(return_code=0,
  211. stdout=''.join(commit_log[:count]))
  212. # Not handled, so abort
  213. print('git log', args)
  214. sys.exit(1)
  215. def _HandleCommandGitConfig(self, args):
  216. config = args[0]
  217. if config == 'sendemail.aliasesfile':
  218. return command.CommandResult(return_code=0)
  219. elif config.startswith('branch.badbranch'):
  220. return command.CommandResult(return_code=1)
  221. elif config == 'branch.%s.remote' % self._test_branch:
  222. return command.CommandResult(return_code=0, stdout='upstream\n')
  223. elif config == 'branch.%s.merge' % self._test_branch:
  224. return command.CommandResult(return_code=0,
  225. stdout='refs/heads/master\n')
  226. # Not handled, so abort
  227. print('git config', args)
  228. sys.exit(1)
  229. def _HandleCommandGit(self, in_args):
  230. """Handle execution of a git command
  231. This uses a hacked-up parser.
  232. Args:
  233. in_args: Arguments after 'git' from the command line
  234. """
  235. git_args = [] # Top-level arguments to git itself
  236. sub_cmd = None # Git sub-command selected
  237. args = [] # Arguments to the git sub-command
  238. for arg in in_args:
  239. if sub_cmd:
  240. args.append(arg)
  241. elif arg[0] == '-':
  242. git_args.append(arg)
  243. else:
  244. if git_args and git_args[-1] in ['--git-dir', '--work-tree']:
  245. git_args.append(arg)
  246. else:
  247. sub_cmd = arg
  248. if sub_cmd == 'config':
  249. return self._HandleCommandGitConfig(args)
  250. elif sub_cmd == 'log':
  251. return self._HandleCommandGitLog(args)
  252. elif sub_cmd == 'clone':
  253. return command.CommandResult(return_code=0)
  254. elif sub_cmd == 'checkout':
  255. return command.CommandResult(return_code=0)
  256. elif sub_cmd == 'worktree':
  257. return command.CommandResult(return_code=0)
  258. # Not handled, so abort
  259. print('git', git_args, sub_cmd, args)
  260. sys.exit(1)
  261. def _HandleCommandNm(self, args):
  262. return command.CommandResult(return_code=0)
  263. def _HandleCommandObjdump(self, args):
  264. return command.CommandResult(return_code=0)
  265. def _HandleCommandObjcopy(self, args):
  266. return command.CommandResult(return_code=0)
  267. def _HandleCommandSize(self, args):
  268. return command.CommandResult(return_code=0)
  269. def _HandleCommand(self, **kwargs):
  270. """Handle a command execution.
  271. The command is in kwargs['pipe-list'], as a list of pipes, each a
  272. list of commands. The command should be emulated as required for
  273. testing purposes.
  274. Returns:
  275. A CommandResult object
  276. """
  277. pipe_list = kwargs['pipe_list']
  278. wc = False
  279. if len(pipe_list) != 1:
  280. if pipe_list[1] == ['wc', '-l']:
  281. wc = True
  282. else:
  283. print('invalid pipe', kwargs)
  284. sys.exit(1)
  285. cmd = pipe_list[0][0]
  286. args = pipe_list[0][1:]
  287. result = None
  288. if cmd == 'git':
  289. result = self._HandleCommandGit(args)
  290. elif cmd == './scripts/show-gnu-make':
  291. return command.CommandResult(return_code=0, stdout='make')
  292. elif cmd.endswith('nm'):
  293. return self._HandleCommandNm(args)
  294. elif cmd.endswith('objdump'):
  295. return self._HandleCommandObjdump(args)
  296. elif cmd.endswith('objcopy'):
  297. return self._HandleCommandObjcopy(args)
  298. elif cmd.endswith( 'size'):
  299. return self._HandleCommandSize(args)
  300. if not result:
  301. # Not handled, so abort
  302. print('unknown command', kwargs)
  303. sys.exit(1)
  304. if wc:
  305. result.stdout = len(result.stdout.splitlines())
  306. return result
  307. def _HandleMake(self, commit, brd, stage, cwd, *args, **kwargs):
  308. """Handle execution of 'make'
  309. Args:
  310. commit: Commit object that is being built
  311. brd: Board object that is being built
  312. stage: Stage that we are at (mrproper, config, build)
  313. cwd: Directory where make should be run
  314. args: Arguments to pass to make
  315. kwargs: Arguments to pass to command.RunPipe()
  316. """
  317. self._make_calls += 1
  318. if stage == 'mrproper':
  319. return command.CommandResult(return_code=0)
  320. elif stage == 'config':
  321. return command.CommandResult(return_code=0,
  322. combined='Test configuration complete')
  323. elif stage == 'build':
  324. stderr = ''
  325. out_dir = ''
  326. for arg in args:
  327. if arg.startswith('O='):
  328. out_dir = arg[2:]
  329. fname = os.path.join(cwd or '', out_dir, 'u-boot')
  330. tools.WriteFile(fname, b'U-Boot')
  331. if type(commit) is not str:
  332. stderr = self._error.get((brd.target, commit.sequence))
  333. if stderr:
  334. return command.CommandResult(return_code=1, stderr=stderr)
  335. return command.CommandResult(return_code=0)
  336. # Not handled, so abort
  337. print('make', stage)
  338. sys.exit(1)
  339. # Example function to print output lines
  340. def print_lines(self, lines):
  341. print(len(lines))
  342. for line in lines:
  343. print(line)
  344. #self.print_lines(terminal.GetPrintTestLines())
  345. def testNoBoards(self):
  346. """Test that buildman aborts when there are no boards"""
  347. self._boards = board.Boards()
  348. with self.assertRaises(SystemExit):
  349. self._RunControl()
  350. def testCurrentSource(self):
  351. """Very simple test to invoke buildman on the current source"""
  352. self.setupToolchains();
  353. self._RunControl('-o', self._output_dir)
  354. lines = terminal.GetPrintTestLines()
  355. self.assertIn('Building current source for %d boards' % len(boards),
  356. lines[0].text)
  357. def testBadBranch(self):
  358. """Test that we can detect an invalid branch"""
  359. with self.assertRaises(ValueError):
  360. self._RunControl('-b', 'badbranch')
  361. def testBadToolchain(self):
  362. """Test that missing toolchains are detected"""
  363. self.setupToolchains();
  364. ret_code = self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
  365. lines = terminal.GetPrintTestLines()
  366. # Buildman always builds the upstream commit as well
  367. self.assertIn('Building %d commits for %d boards' %
  368. (self._commits, len(boards)), lines[0].text)
  369. self.assertEqual(self._builder.count, self._total_builds)
  370. # Only sandbox should succeed, the others don't have toolchains
  371. self.assertEqual(self._builder.fail,
  372. self._total_builds - self._commits)
  373. self.assertEqual(ret_code, 100)
  374. for commit in range(self._commits):
  375. for board in self._boards.GetList():
  376. if board.arch != 'sandbox':
  377. errfile = self._builder.GetErrFile(commit, board.target)
  378. fd = open(errfile)
  379. self.assertEqual(fd.readlines(),
  380. ['No tool chain for %s\n' % board.arch])
  381. fd.close()
  382. def testBranch(self):
  383. """Test building a branch with all toolchains present"""
  384. self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
  385. self.assertEqual(self._builder.count, self._total_builds)
  386. self.assertEqual(self._builder.fail, 0)
  387. def testCount(self):
  388. """Test building a specific number of commitst"""
  389. self._RunControl('-b', TEST_BRANCH, '-c2', '-o', self._output_dir)
  390. self.assertEqual(self._builder.count, 2 * len(boards))
  391. self.assertEqual(self._builder.fail, 0)
  392. # Each board has a config, and then one make per commit
  393. self.assertEqual(self._make_calls, len(boards) * (1 + 2))
  394. def testIncremental(self):
  395. """Test building a branch twice - the second time should do nothing"""
  396. self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
  397. # Each board has a mrproper, config, and then one make per commit
  398. self.assertEqual(self._make_calls, len(boards) * (self._commits + 1))
  399. self._make_calls = 0
  400. self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir, clean_dir=False)
  401. self.assertEqual(self._make_calls, 0)
  402. self.assertEqual(self._builder.count, self._total_builds)
  403. self.assertEqual(self._builder.fail, 0)
  404. def testForceBuild(self):
  405. """The -f flag should force a rebuild"""
  406. self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
  407. self._make_calls = 0
  408. self._RunControl('-b', TEST_BRANCH, '-f', '-o', self._output_dir, clean_dir=False)
  409. # Each board has a config and one make per commit
  410. self.assertEqual(self._make_calls, len(boards) * (self._commits + 1))
  411. def testForceReconfigure(self):
  412. """The -f flag should force a rebuild"""
  413. self._RunControl('-b', TEST_BRANCH, '-C', '-o', self._output_dir)
  414. # Each commit has a config and make
  415. self.assertEqual(self._make_calls, len(boards) * self._commits * 2)
  416. def testForceReconfigure(self):
  417. """The -f flag should force a rebuild"""
  418. self._RunControl('-b', TEST_BRANCH, '-C', '-o', self._output_dir)
  419. # Each commit has a config and make
  420. self.assertEqual(self._make_calls, len(boards) * self._commits * 2)
  421. def testMrproper(self):
  422. """The -f flag should force a rebuild"""
  423. self._RunControl('-b', TEST_BRANCH, '-m', '-o', self._output_dir)
  424. # Each board has a mkproper, config and then one make per commit
  425. self.assertEqual(self._make_calls, len(boards) * (self._commits + 2))
  426. def testErrors(self):
  427. """Test handling of build errors"""
  428. self._error['board2', 1] = 'fred\n'
  429. self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
  430. self.assertEqual(self._builder.count, self._total_builds)
  431. self.assertEqual(self._builder.fail, 1)
  432. # Remove the error. This should have no effect since the commit will
  433. # not be rebuilt
  434. del self._error['board2', 1]
  435. self._make_calls = 0
  436. self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir, clean_dir=False)
  437. self.assertEqual(self._builder.count, self._total_builds)
  438. self.assertEqual(self._make_calls, 0)
  439. self.assertEqual(self._builder.fail, 1)
  440. # Now use the -F flag to force rebuild of the bad commit
  441. self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir, '-F', clean_dir=False)
  442. self.assertEqual(self._builder.count, self._total_builds)
  443. self.assertEqual(self._builder.fail, 0)
  444. self.assertEqual(self._make_calls, 2)
  445. def testBranchWithSlash(self):
  446. """Test building a branch with a '/' in the name"""
  447. self._test_branch = '/__dev/__testbranch'
  448. self._RunControl('-b', self._test_branch, clean_dir=False)
  449. self.assertEqual(self._builder.count, self._total_builds)
  450. self.assertEqual(self._builder.fail, 0)
  451. def testEnvironment(self):
  452. """Test that the done and environment files are written to out-env"""
  453. self._RunControl('-o', self._output_dir)
  454. board0_dir = os.path.join(self._output_dir, 'current', 'board0')
  455. self.assertTrue(os.path.exists(os.path.join(board0_dir, 'done')))
  456. self.assertTrue(os.path.exists(os.path.join(board0_dir, 'out-env')))
  457. def testWorkInOutput(self):
  458. """Test the -w option which should write directly to the output dir"""
  459. board_list = board.Boards()
  460. board_list.AddBoard(board.Board(*boards[0]))
  461. self._RunControl('-o', self._output_dir, '-w', clean_dir=False,
  462. boards=board_list)
  463. self.assertTrue(
  464. os.path.exists(os.path.join(self._output_dir, 'u-boot')))
  465. self.assertTrue(
  466. os.path.exists(os.path.join(self._output_dir, 'done')))
  467. self.assertTrue(
  468. os.path.exists(os.path.join(self._output_dir, 'out-env')))
  469. def testWorkInOutputFail(self):
  470. """Test the -w option failures"""
  471. with self.assertRaises(SystemExit) as e:
  472. self._RunControl('-o', self._output_dir, '-w', clean_dir=False)
  473. self.assertIn("single board", str(e.exception))
  474. self.assertFalse(
  475. os.path.exists(os.path.join(self._output_dir, 'u-boot')))
  476. board_list = board.Boards()
  477. board_list.AddBoard(board.Board(*boards[0]))
  478. with self.assertRaises(SystemExit) as e:
  479. self._RunControl('-b', self._test_branch, '-o', self._output_dir,
  480. '-w', clean_dir=False, boards=board_list)
  481. self.assertIn("single commit", str(e.exception))
  482. board_list = board.Boards()
  483. board_list.AddBoard(board.Board(*boards[0]))
  484. with self.assertRaises(SystemExit) as e:
  485. self._RunControl('-w', clean_dir=False)
  486. self.assertIn("specify -o", str(e.exception))