diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-27 10:12:06 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-01 08:49:37 +0100 |
commit | 58b0a65ada340fda3bc04fa9fcb648eb43246402 (patch) | |
tree | 982cfef481827b0f46d5bc753730604bb71323d8 /bitbake/lib/bb/tests/utils.py | |
parent | c02b7accd54ea657da9d771814b3dc92d0591127 (diff) | |
download | poky-58b0a65ada340fda3bc04fa9fcb648eb43246402.tar.gz |
bitbake: utils: Refactor filemode variable conversion to a function
We have other places in the code where we need to take filemode/mask
information from a bitbake variable and turn it into a real python
number. Turn this internal code into public API in bb.utils and
add some tests for it.
(Bitbake rev: d89e30fb2fb15b09f2cb95c4e5aa9f749ca257ea)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests/utils.py')
-rw-r--r-- | bitbake/lib/bb/tests/utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py index 48e61dfcea..52b7bf85bf 100644 --- a/bitbake/lib/bb/tests/utils.py +++ b/bitbake/lib/bb/tests/utils.py | |||
@@ -692,3 +692,14 @@ class EnvironmentTests(unittest.TestCase): | |||
692 | self.assertIn("A", os.environ) | 692 | self.assertIn("A", os.environ) |
693 | self.assertEqual(os.environ["A"], "this is A") | 693 | self.assertEqual(os.environ["A"], "this is A") |
694 | self.assertNotIn("B", os.environ) | 694 | self.assertNotIn("B", os.environ) |
695 | |||
696 | class FilemodeTests(unittest.TestCase): | ||
697 | def test_filemode_convert(self): | ||
698 | self.assertEqual(0o775, bb.utils.to_filemode("0o775")) | ||
699 | self.assertEqual(0o775, bb.utils.to_filemode(0o775)) | ||
700 | self.assertEqual(0o775, bb.utils.to_filemode("775")) | ||
701 | with self.assertRaises(ValueError): | ||
702 | bb.utils.to_filemode("xyz") | ||
703 | with self.assertRaises(ValueError): | ||
704 | bb.utils.to_filemode("999") | ||
705 | |||