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>
This commit is contained in:
Trevor Gamblin
2023-09-13 13:00:46 -04:00
committed by Richard Purdie
parent e12e6d94ec
commit 4a6f38c532
60 changed files with 2921 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
# common pyparsing variables
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0
import pyparsing
# general
colon = pyparsing.Literal(":")
start = pyparsing.LineStart()
end = pyparsing.LineEnd()
at = pyparsing.Literal("@")
lessthan = pyparsing.Literal("<")
greaterthan = pyparsing.Literal(">")
opensquare = pyparsing.Literal("[")
closesquare = pyparsing.Literal("]")
inappropriate = pyparsing.CaselessLiteral("Inappropriate")
submitted = pyparsing.CaselessLiteral("Submitted")
# word related
nestexpr = pyparsing.nestedExpr(opener='[', closer=']')
inappropriateinfo = pyparsing.Literal("Inappropriate") + nestexpr
submittedinfo = pyparsing.Literal("Submitted") + nestexpr
word = pyparsing.Word(pyparsing.alphas)
worddot = pyparsing.Word(pyparsing.alphas+".")

View File

@@ -0,0 +1,18 @@
# signed-off-by pyparsing definition
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0
import pyparsing
import common
name = pyparsing.Regex('\S+.*(?= <)')
username = pyparsing.OneOrMore(common.worddot)
domain = pyparsing.OneOrMore(common.worddot)
cve = pyparsing.Regex('CVE\-\d{4}\-\d+')
cve_mark = pyparsing.Literal("CVE:")
cve_tag = pyparsing.AtLineStart(cve_mark + cve)
patch_cve_tag = pyparsing.AtLineStart("+" + cve_mark + cve)

View File

@@ -0,0 +1,14 @@
# subject pyparsing definition
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0
# NOTE:This is an oversimplified syntax of the mbox's summary
import pyparsing
import common
target = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables.replace(':','')))
summary = pyparsing.OneOrMore(pyparsing.Word(pyparsing.printables))
shortlog = common.start + target + common.colon + summary + common.end

View File

@@ -0,0 +1,22 @@
# signed-off-by pyparsing definition
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0
import pyparsing
import common
name = pyparsing.Regex('\S+.*(?= <)')
username = pyparsing.OneOrMore(common.worddot)
domain = pyparsing.OneOrMore(common.worddot)
# taken from https://pyparsing-public.wikispaces.com/Helpful+Expressions
email = pyparsing.Regex(r"(?P<user>[A-Za-z0-9._%+-]+)@(?P<hostname>[A-Za-z0-9.-]+)\.(?P<domain>[A-Za-z]{2,})")
email_enclosed = common.lessthan + email + common.greaterthan
signed_off_by_mark = pyparsing.Literal("Signed-off-by:")
signed_off_by = pyparsing.AtLineStart(signed_off_by_mark + name + email_enclosed)
patch_signed_off_by = pyparsing.AtLineStart("+" + signed_off_by_mark + name + email_enclosed)

View File

@@ -0,0 +1,24 @@
# upstream-status pyparsing definition
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0
import common
import pyparsing
upstream_status_literal_valid_status = ["Pending", "Accepted", "Backport", "Denied", "Inappropriate", "Submitted"]
upstream_status_nonliteral_valid_status = ["Pending", "Accepted", "Backport", "Denied", "Inappropriate [reason]", "Submitted [where]"]
upstream_status_valid_status = pyparsing.Or(
[pyparsing.Literal(status) for status in upstream_status_literal_valid_status]
)
upstream_status_mark = pyparsing.Literal("Upstream-Status")
inappropriate_status_mark = common.inappropriate
submitted_status_mark = common.submitted
upstream_status = common.start + upstream_status_mark + common.colon + upstream_status_valid_status
upstream_status_inappropriate_info = common.start + upstream_status_mark + common.colon + common.inappropriateinfo
upstream_status_submitted_info = common.start + upstream_status_mark + common.colon + common.submittedinfo