buildman: Fix use of 'boards' in test

We want to create a module called 'boards' so avoid use of this variable
name in this module. Change the global to be capitalised, as required by
Python style.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2022-07-11 19:03:59 -06:00 committed by Tom Rini
parent 938fa37c81
commit fd1b507e60

View File

@ -94,7 +94,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 +131,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 = board.Boards()
for brd in BOARDS:
self.brds.AddBoard(board.Board(*brd))
self.brds.SelectBoards([])
# Add some test settings
bsettings.Setup(None)
@ -176,7 +176,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,7 +184,7 @@ class TestBuild(unittest.TestCase):
# TODO(sjg@chromium.org): If plus is '', we shouldn't need this
expect += ' ' + col.build(expected_colour, plus)
expect += ' '
for brd in boards:
for brd in brds:
expect += col.build(expected_colour, ' %s' % brd)
self.assertEqual(text, expect)
@ -203,7 +203,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.GetSelectedDict()
# 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 +217,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 +236,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 +253,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 +468,18 @@ class TestBuild(unittest.TestCase):
def testBoardSingle(self):
"""Test single board selection"""
self.assertEqual(self.boards.SelectBoards(['sandbox']),
self.assertEqual(self.brds.SelectBoards(['sandbox']),
({'all': ['board4'], 'sandbox': ['board4']}, []))
def testBoardArch(self):
"""Test single board selection"""
self.assertEqual(self.boards.SelectBoards(['arm']),
self.assertEqual(self.brds.SelectBoards(['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.SelectBoards(['arm sandbox']),
({'sandbox': ['board4'],
'all': ['board0', 'board1', 'board4'],
'arm': ['board0', 'board1']}, []))
@ -487,20 +487,20 @@ class TestBuild(unittest.TestCase):
def testBoardArchSingleMultiWord(self):
"""Test single board selection"""
self.assertEqual(self.boards.SelectBoards(['arm', 'sandbox']),
self.assertEqual(self.brds.SelectBoards(['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.SelectBoards(['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.SelectBoards(['Tester', '&', 'arm',
'Tester' '&', 'powerpc',
'sandbox']),
({'sandbox': ['board4'],
@ -511,19 +511,19 @@ class TestBuild(unittest.TestCase):
def testBoardAll(self):
"""Test single board selection"""
self.assertEqual(self.boards.SelectBoards([]),
self.assertEqual(self.brds.SelectBoards([]),
({'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.SelectBoards(['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.SelectBoards(['sandbox sandbox',
'sandbox']),
({'all': ['board4'], 'sandbox': ['board4']}, []))
def CheckDirs(self, build, dirname):