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