aboutsummaryrefslogtreecommitdiff
path: root/tools/buildman/test.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-08-05 13:22:44 -0400
committerTom Rini <trini@konsulko.com>2022-08-05 13:22:44 -0400
commit56edbb5eafc53cd7b34cd231ec11c7e5eb576c9f (patch)
tree2dd1ae00ca6f61d0efda20d930c2f33bdbb23457 /tools/buildman/test.py
parent46b5c8ed017958fc387ab86c71ae6c90abb6793c (diff)
parentff75d6e03ee4346bbe9614f10949649bb704a7e9 (diff)
Merge branch '2022-08-05-buildman-integrate-boardscfg'
To quote Simon: This series drops the need for the genboardscfg.py script, so that the boards.cfg file is produced (and consumed) entirely within buildman. The file is not entirely removed since it does have some uses and we need some sort of cache for the information. The genboardscfg.py script is effectively incorporated in buildman. It also improves operation from an IDE with a new -I option and fixes up some of the pylint warnings in buildman. Finally, this series also fixes a bug which allows use to drop support for CONFIG_SYS_EXTRA_OPTIONS which is long-standing desire. It also fixes a minor bug that causes 'Invalid line' spam when checking for function bloat with the -B option.
Diffstat (limited to 'tools/buildman/test.py')
-rw-r--r--tools/buildman/test.py45
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):