diff options
author | Trevor Gamblin <tgamblin@baylibre.com> | 2023-09-13 13:00:46 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-14 15:20:08 +0100 |
commit | 4a6f38c5327b40a45c340af49fee9a0d5cc890bd (patch) | |
tree | 669ae555ecc031990579baa207d40f38ab7e1335 /meta/lib/patchtest/tests/test_metadata_max_length.py | |
parent | e12e6d94ecbea6e0dafc080f2f196e12228730eb (diff) | |
download | poky-4a6f38c5327b40a45c340af49fee9a0d5cc890bd.tar.gz |
patchtest: Add tests from patchtest oe repo
Copy the core components of the patchtest-oe repo into
meta/lib/patchtest in oe-core.
(From OE-Core rev: 257f64f4e4414b78981104aec132b067beb5a92a)
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/patchtest/tests/test_metadata_max_length.py')
-rw-r--r-- | meta/lib/patchtest/tests/test_metadata_max_length.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/meta/lib/patchtest/tests/test_metadata_max_length.py b/meta/lib/patchtest/tests/test_metadata_max_length.py new file mode 100644 index 0000000000..04a5e23469 --- /dev/null +++ b/meta/lib/patchtest/tests/test_metadata_max_length.py | |||
@@ -0,0 +1,26 @@ | |||
1 | # Checks related to patch line lengths | ||
2 | # | ||
3 | # Copyright (C) 2016 Intel Corporation | ||
4 | # | ||
5 | # SPDX-License-Identifier: GPL-2.0 | ||
6 | |||
7 | import base | ||
8 | import re | ||
9 | |||
10 | class MaxLength(base.Base): | ||
11 | add_mark = re.compile('\+ ') | ||
12 | max_length = 200 | ||
13 | |||
14 | def test_max_line_length(self): | ||
15 | for patch in self.patchset: | ||
16 | # for the moment, we are just interested in metadata | ||
17 | if patch.path.endswith('.patch'): | ||
18 | continue | ||
19 | payload = str(patch) | ||
20 | for line in payload.splitlines(): | ||
21 | if self.add_mark.match(line): | ||
22 | current_line_length = len(line[1:]) | ||
23 | if current_line_length > self.max_length: | ||
24 | self.fail('Patch line too long (current length %s)' % current_line_length, | ||
25 | 'Shorten the corresponding patch line (max length supported %s)' % self.max_length, | ||
26 | data=[('Patch', patch.path), ('Line', '%s ...' % line[0:80])]) | ||