diff options
Diffstat (limited to 'tools/buildman/test.py')
-rw-r--r-- | tools/buildman/test.py | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 27287438ee..daf5467503 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -10,6 +10,7 @@ import time import unittest from buildman import board +from buildman import boards from buildman import bsettings from buildman import builder from buildman import cfgutil @@ -94,7 +95,7 @@ commits = [ [errors[4]]], ] -boards = [ +BOARDS = [ ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 1', 'board0', ''], ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 2', 'board1', ''], ['Active', 'powerpc', 'powerpc', '', 'Tester', 'PowerPC board 1', 'board2', ''], @@ -131,10 +132,10 @@ class TestBuild(unittest.TestCase): self.commits.append(comm) # Set up boards to build - self.boards = board.Boards() - for brd in boards: - self.boards.AddBoard(board.Board(*brd)) - self.boards.SelectBoards([]) + self.brds = boards.Boards() + for brd in BOARDS: + self.brds.add_board(board.Board(*brd)) + self.brds.select_boards([]) # Add some test settings bsettings.Setup(None) @@ -176,7 +177,7 @@ class TestBuild(unittest.TestCase): result.combined = result.stdout + result.stderr return result - def assertSummary(self, text, arch, plus, boards, outcome=OUTCOME_ERR): + def assertSummary(self, text, arch, plus, brds, outcome=OUTCOME_ERR): col = self._col expected_colour = (col.GREEN if outcome == OUTCOME_OK else col.YELLOW if outcome == OUTCOME_WARN else col.RED) @@ -184,8 +185,8 @@ class TestBuild(unittest.TestCase): # TODO(sjg@chromium.org): If plus is '', we shouldn't need this expect += ' ' + col.build(expected_colour, plus) expect += ' ' - for board in boards: - expect += col.build(expected_colour, ' %s' % board) + for brd in brds: + expect += col.build(expected_colour, ' %s' % brd) self.assertEqual(text, expect) def _SetupTest(self, echo_lines=False, threads=1, **kwdisplay_args): @@ -203,7 +204,7 @@ class TestBuild(unittest.TestCase): build = builder.Builder(self.toolchains, self.base_dir, None, threads, 2, checkout=False, show_unknown=False) build.do_make = self.Make - board_selected = self.boards.GetSelectedDict() + board_selected = self.brds.get_selected_dict() # Build the boards for the pre-defined commits and warnings/errors # associated with each. This calls our Make() to inject the fake output. @@ -217,7 +218,7 @@ class TestBuild(unittest.TestCase): # We should get two starting messages, an update for every commit built # and a summary message - self.assertEqual(count, len(commits) * len(boards) + 3) + self.assertEqual(count, len(commits) * len(BOARDS) + 3) build.SetDisplayOptions(**kwdisplay_args); build.ShowSummary(self.commits, board_selected) if echo_lines: @@ -236,7 +237,7 @@ class TestBuild(unittest.TestCase): filter_dtb_warnings: Adjust the check for output produced with the --filter-dtb-warnings flag """ - def add_line_prefix(prefix, boards, error_str, colour): + def add_line_prefix(prefix, brds, error_str, colour): """Add a prefix to each line of a string The training \n in error_str is removed before processing @@ -253,9 +254,9 @@ class TestBuild(unittest.TestCase): lines = error_str.strip().splitlines() new_lines = [] for line in lines: - if boards: + if brds: expect = self._col.build(colour, prefix + '(') - expect += self._col.build(self._col.MAGENTA, boards, + expect += self._col.build(self._col.MAGENTA, brds, bright=False) expect += self._col.build(colour, ') %s' % line) else: @@ -468,18 +469,18 @@ class TestBuild(unittest.TestCase): def testBoardSingle(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['sandbox']), + self.assertEqual(self.brds.select_boards(['sandbox']), ({'all': ['board4'], 'sandbox': ['board4']}, [])) def testBoardArch(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['arm']), + self.assertEqual(self.brds.select_boards(['arm']), ({'all': ['board0', 'board1'], 'arm': ['board0', 'board1']}, [])) def testBoardArchSingle(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['arm sandbox']), + self.assertEqual(self.brds.select_boards(['arm sandbox']), ({'sandbox': ['board4'], 'all': ['board0', 'board1', 'board4'], 'arm': ['board0', 'board1']}, [])) @@ -487,20 +488,20 @@ class TestBuild(unittest.TestCase): def testBoardArchSingleMultiWord(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['arm', 'sandbox']), + self.assertEqual(self.brds.select_boards(['arm', 'sandbox']), ({'sandbox': ['board4'], 'all': ['board0', 'board1', 'board4'], 'arm': ['board0', 'board1']}, [])) def testBoardSingleAnd(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['Tester & arm']), + self.assertEqual(self.brds.select_boards(['Tester & arm']), ({'Tester&arm': ['board0', 'board1'], 'all': ['board0', 'board1']}, [])) def testBoardTwoAnd(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['Tester', '&', 'arm', + self.assertEqual(self.brds.select_boards(['Tester', '&', 'arm', 'Tester' '&', 'powerpc', 'sandbox']), ({'sandbox': ['board4'], @@ -511,19 +512,19 @@ class TestBuild(unittest.TestCase): def testBoardAll(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards([]), + self.assertEqual(self.brds.select_boards([]), ({'all': ['board0', 'board1', 'board2', 'board3', 'board4']}, [])) def testBoardRegularExpression(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['T.*r&^Po']), + self.assertEqual(self.brds.select_boards(['T.*r&^Po']), ({'all': ['board2', 'board3'], 'T.*r&^Po': ['board2', 'board3']}, [])) def testBoardDuplicate(self): """Test single board selection""" - self.assertEqual(self.boards.SelectBoards(['sandbox sandbox', + self.assertEqual(self.brds.select_boards(['sandbox sandbox', 'sandbox']), ({'all': ['board4'], 'sandbox': ['board4']}, [])) def CheckDirs(self, build, dirname): |