poky/meta/lib/patchtest/tests/test_mbox_signed_off_by.py
Trevor Gamblin fd06e4f266 patchtest: clean up test suite
Various tweaks to make the test suite cleaner and more efficient:

- Replace use of "re" module with "pyparsing" in tests (but not base.py)
- Make test_mbox_cve only check for CVE tags in the commit if the added
  patch has them
- Make test_mbox_cve SKIP instead of PASS if there's no CVE tag
- Simplify the bugzilla tag checking test now that pyparsing is used
- Modify the selftest script to correctly parse the new result output

(From OE-Core rev: 7a187c2475aa762e2bc830950f608143f2535a72)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-13 11:53:06 +01:00

28 lines
933 B
Python

# Checks related to the patch's signed-off-by lines
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0
import base
import parse_signed_off_by
import pyparsing
class SignedOffBy(base.Base):
revert_shortlog_regex = pyparsing.Regex('Revert\s+".*"')
@classmethod
def setUpClassLocal(cls):
# match self.mark with no '+' preceding it
cls.prog = parse_signed_off_by.signed_off_by
def test_signed_off_by_presence(self):
for commit in SignedOffBy.commits:
# skip those patches that revert older commits, these do not required the tag presence
if self.revert_shortlog_regex.search_string(commit.shortlog):
continue
if not SignedOffBy.prog.search_string(commit.payload):
self.fail('Mbox is missing Signed-off-by. Add it manually or with "git commit --amend -s"',
commit=commit)