diff options
author | Simon Glass <sjg@chromium.org> | 2021-04-11 16:27:28 +1200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-04-29 03:23:39 -0700 |
commit | f1a83abe60b4ef8b2652e4c8e1d11a9afc909b71 (patch) | |
tree | 8662ba525e762bee6b1a6e13b490c733387d37f9 /tools/buildman/func_test.py | |
parent | 8116c78ffddc71dec8f793339648a5239a5d9643 (diff) |
buildman: Use bytes for the environment
At present we sometimes see problems in gitlab where the environment has
0x80 characters or sequences which are not valid UTF-8.
Avoid this by using bytes for the environment, both internal to buildman
and when writing out the 'env' file. Add a test to make sure this works
as expected.
Reported-by: Marek Vasut <marex@denx.de>
Fixes: e5fc79ea718 ("buildman: Write the environment out to an 'env' file")
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/buildman/func_test.py')
-rw-r--r-- | tools/buildman/func_test.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 61e3012d2b1..7edbee0652f 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -572,6 +572,18 @@ class TestFunctional(unittest.TestCase): self.assertTrue(os.path.exists(os.path.join(board0_dir, 'done'))) self.assertTrue(os.path.exists(os.path.join(board0_dir, 'out-env'))) + def testEnvironmentUnicode(self): + """Test there are no unicode errors when the env has non-ASCII chars""" + try: + varname = b'buildman_test_var' + os.environb[varname] = b'strange\x80chars' + self.assertEqual(0, self._RunControl('-o', self._output_dir)) + board0_dir = os.path.join(self._output_dir, 'current', 'board0') + self.assertTrue(os.path.exists(os.path.join(board0_dir, 'done'))) + self.assertTrue(os.path.exists(os.path.join(board0_dir, 'out-env'))) + finally: + del os.environb[varname] + def testWorkInOutput(self): """Test the -w option which should write directly to the output dir""" board_list = board.Boards() |