diff options
author | Simon Glass <sjg@chromium.org> | 2023-07-19 17:48:28 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-07-24 09:34:10 -0600 |
commit | a1431e6c97ab0d3c7be4327c8089a501d80e2c77 (patch) | |
tree | c6b709b79e622824809c03ebe231675cb8b9c32c /tools/buildman/func_test.py | |
parent | 1b21842eab660ab1f80b89057abab99473b3bb5a (diff) |
buildman: Provide an argument to the -R option
Allow writing the file to a selected location, since otherwise this is
controlled by the buildman configuration, so cannot be determined by the
caller.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: https://source.denx.de/u-boot/u-boot/-/issues/17
Diffstat (limited to 'tools/buildman/func_test.py')
-rw-r--r-- | tools/buildman/func_test.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 7f3d54cc762..e6cdebdbd19 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -233,29 +233,33 @@ class TestFunctional(unittest.TestCase): return command.run_pipe([[self._buildman_pathname] + list(args)], capture=True, capture_stderr=True) - def _RunControl(self, *args, brds=None, clean_dir=False, - test_thread_exceptions=False): + def _RunControl(self, *args, brds=False, clean_dir=False, + test_thread_exceptions=False, get_builder=True): """Run buildman Args: args: List of arguments to pass - brds: Boards object + brds: Boards object, or False to pass self._boards, or None to pass + None 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 raise an exception instead of reporting their result. This simulates a failure in the code somewhere + get_builder (bool): Set self._builder to the resulting builder Returns: result code from buildman """ sys.argv = [sys.argv[0]] + list(args) options, args = cmdline.ParseArgs() + if brds == False: + brds = self._boards result = control.DoBuildman(options, args, toolchains=self._toolchains, - make_func=self._HandleMake, brds=brds or self._boards, - clean_dir=clean_dir, + make_func=self._HandleMake, brds=brds, clean_dir=clean_dir, test_thread_exceptions=test_thread_exceptions) - self._builder = control.builder + if get_builder: + self._builder = control.builder return result def testFullHelp(self): @@ -1002,3 +1006,12 @@ endif self.assertEquals(2, len(params_list)) self.assertFalse(warnings) + def testRegenBoards(self): + """Test that we can regenerate the boards.cfg file""" + outfile = os.path.join(self._output_dir, 'test-boards.cfg') + if os.path.exists(outfile): + os.remove(outfile) + with test_util.capture_sys_output() as (stdout, stderr): + result = self._RunControl('-R', outfile, brds=None, + get_builder=False) + self.assertTrue(os.path.exists(outfile)) |