buildman: Fix use of 'boards' in func_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>
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
index 0265286..812dc92 100644
--- a/tools/buildman/func_test.py
+++ b/tools/buildman/func_test.py
@@ -35,7 +35,7 @@
chromeos_peach=VBOOT=${chroot}/build/peach_pit/usr ${vboot}
'''
-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', ''],
@@ -188,13 +188,13 @@
self._toolchains.Add('arm-gcc', test=False)
self._toolchains.Add('powerpc-gcc', test=False)
self._boards = board.Boards()
- for brd in boards:
+ for brd in BOARDS:
self._boards.AddBoard(board.Board(*brd))
# Directories where the source been cloned
self._clone_dirs = []
self._commits = len(commit_shortlog.splitlines()) + 1
- self._total_builds = self._commits * len(boards)
+ self._total_builds = self._commits * len(BOARDS)
# Number of calls to make
self._make_calls = 0
@@ -220,13 +220,13 @@
return command.run_pipe([[self._buildman_pathname] + list(args)],
capture=True, capture_stderr=True)
- def _RunControl(self, *args, boards=None, clean_dir=False,
+ def _RunControl(self, *args, brds=None, clean_dir=False,
test_thread_exceptions=False):
"""Run buildman
Args:
args: List of arguments to pass
- boards:
+ brds: Boards object
clean_dir: Used for tests only, indicates that the existing output_dir
should be removed before starting the build
test_thread_exceptions: Uses for tests only, True to make the threads
@@ -239,7 +239,7 @@
sys.argv = [sys.argv[0]] + list(args)
options, args = cmdline.ParseArgs()
result = control.DoBuildman(options, args, toolchains=self._toolchains,
- make_func=self._HandleMake, boards=boards or self._boards,
+ make_func=self._HandleMake, boards=brds or self._boards,
clean_dir=clean_dir,
test_thread_exceptions=test_thread_exceptions)
self._builder = control.builder
@@ -451,7 +451,7 @@
self.setupToolchains();
self._RunControl('-o', self._output_dir)
lines = terminal.get_print_test_lines()
- self.assertIn('Building current source for %d boards' % len(boards),
+ self.assertIn('Building current source for %d boards' % len(BOARDS),
lines[0].text)
def testBadBranch(self):
@@ -467,7 +467,7 @@
# Buildman always builds the upstream commit as well
self.assertIn('Building %d commits for %d boards' %
- (self._commits, len(boards)), lines[0].text)
+ (self._commits, len(BOARDS)), lines[0].text)
self.assertEqual(self._builder.count, self._total_builds)
# Only sandbox should succeed, the others don't have toolchains
@@ -493,17 +493,17 @@
def testCount(self):
"""Test building a specific number of commitst"""
self._RunControl('-b', TEST_BRANCH, '-c2', '-o', self._output_dir)
- self.assertEqual(self._builder.count, 2 * len(boards))
+ self.assertEqual(self._builder.count, 2 * len(BOARDS))
self.assertEqual(self._builder.fail, 0)
# Each board has a config, and then one make per commit
- self.assertEqual(self._make_calls, len(boards) * (1 + 2))
+ self.assertEqual(self._make_calls, len(BOARDS) * (1 + 2))
def testIncremental(self):
"""Test building a branch twice - the second time should do nothing"""
self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir)
# Each board has a mrproper, config, and then one make per commit
- self.assertEqual(self._make_calls, len(boards) * (self._commits + 1))
+ self.assertEqual(self._make_calls, len(BOARDS) * (self._commits + 1))
self._make_calls = 0
self._RunControl('-b', TEST_BRANCH, '-o', self._output_dir, clean_dir=False)
self.assertEqual(self._make_calls, 0)
@@ -516,19 +516,19 @@
self._make_calls = 0
self._RunControl('-b', TEST_BRANCH, '-f', '-o', self._output_dir, clean_dir=False)
# Each board has a config and one make per commit
- self.assertEqual(self._make_calls, len(boards) * (self._commits + 1))
+ self.assertEqual(self._make_calls, len(BOARDS) * (self._commits + 1))
def testForceReconfigure(self):
"""The -f flag should force a rebuild"""
self._RunControl('-b', TEST_BRANCH, '-C', '-o', self._output_dir)
# Each commit has a config and make
- self.assertEqual(self._make_calls, len(boards) * self._commits * 2)
+ self.assertEqual(self._make_calls, len(BOARDS) * self._commits * 2)
def testMrproper(self):
"""The -f flag should force a rebuild"""
self._RunControl('-b', TEST_BRANCH, '-m', '-o', self._output_dir)
# Each board has a mkproper, config and then one make per commit
- self.assertEqual(self._make_calls, len(boards) * (self._commits + 2))
+ self.assertEqual(self._make_calls, len(BOARDS) * (self._commits + 2))
def testErrors(self):
"""Test handling of build errors"""
@@ -581,9 +581,9 @@
def testWorkInOutput(self):
"""Test the -w option which should write directly to the output dir"""
board_list = board.Boards()
- board_list.AddBoard(board.Board(*boards[0]))
+ board_list.AddBoard(board.Board(*BOARDS[0]))
self._RunControl('-o', self._output_dir, '-w', clean_dir=False,
- boards=board_list)
+ brds=board_list)
self.assertTrue(
os.path.exists(os.path.join(self._output_dir, 'u-boot')))
self.assertTrue(
@@ -600,14 +600,14 @@
os.path.exists(os.path.join(self._output_dir, 'u-boot')))
board_list = board.Boards()
- board_list.AddBoard(board.Board(*boards[0]))
+ board_list.AddBoard(board.Board(*BOARDS[0]))
with self.assertRaises(SystemExit) as e:
self._RunControl('-b', self._test_branch, '-o', self._output_dir,
- '-w', clean_dir=False, boards=board_list)
+ '-w', clean_dir=False, brds=board_list)
self.assertIn("single commit", str(e.exception))
board_list = board.Boards()
- board_list.AddBoard(board.Board(*boards[0]))
+ board_list.AddBoard(board.Board(*BOARDS[0]))
with self.assertRaises(SystemExit) as e:
self._RunControl('-w', clean_dir=False)
self.assertIn("specify -o", str(e.exception))