mirror of
https://git.yoctoproject.org/poky
synced 2026-09-16 09:49:35 +02:00
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:
committed by
Richard Purdie
parent
e12e6d94ec
commit
4a6f38c532
26
meta/lib/patchtest/tests/pyparsing/common.py
Normal file
26
meta/lib/patchtest/tests/pyparsing/common.py
Normal 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+".")
|
||||
18
meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py
Normal file
18
meta/lib/patchtest/tests/pyparsing/parse_cve_tags.py
Normal 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)
|
||||
14
meta/lib/patchtest/tests/pyparsing/parse_shortlog.py
Normal file
14
meta/lib/patchtest/tests/pyparsing/parse_shortlog.py
Normal 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
|
||||
22
meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py
Normal file
22
meta/lib/patchtest/tests/pyparsing/parse_signed_off_by.py
Normal 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)
|
||||
24
meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py
Normal file
24
meta/lib/patchtest/tests/pyparsing/parse_upstream_status.py
Normal 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
|
||||
Reference in New Issue
Block a user