Commit Graph

44 Commits

Author SHA1 Message Date
Trevor Gamblin
4c378fc895 patchtest: simplify, rename modules
- simplify base.py, data.py
- move some leftover regex patterns to patterns.py
- remove pyparsing path logic, since this is no longer needed
- rename PatchTestInput class to PatchtestParser
- data.py: rename to patchtest_parser.py
- patterns.py: rename to patchtest_patterns.py
- move PatchTestDataStore to test_metadata.py since that's the only
  place it's used
- remove unused logger code

(From OE-Core rev: 1e971b05b036b0b1eb0bdbd9b26b54d06e74294c)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-30 17:00:50 +01:00
Trevor Gamblin
18a65c77c0 patchtest: test_mbox: change ismerged -> canbemerged
The merge logic is a bit weird as-is. Remove the ismerged() method and
replace it where appropriate with canbemerged().

(From OE-Core rev: c5f5686f20b13d635a461d4cc353563f9c886f5f)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-30 17:00:50 +01:00
Trevor Gamblin
d6ede9c73b patchtest: mbox.py: new data implementation
Consolidate and improve some objects:

- absorb utils.py functionality
- repo.py: use mbox.py
- repo.py: remove some cruft
- utils.py: replace with logs.py
- utils.py: delete
- patch.py: delete
- scripts/patchtest: use logging directly
- general cleanup

(From OE-Core rev: d4fbdb1d15f281b236137d63710c73bca8911a36)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-30 17:00:50 +01:00
Trevor Gamblin
bb0f1625d7 patchtest: patterns: add module, refactor
Currently, patchtest has a lot of spread-out definitions for patterns
used in various setup and test functions. Organize these by putting them
all into a new patterns.py module. This allows the tests/pyparsing
directory to be removed, as it is now redundant. Also remove some
definitions where they were duplicated or unused, and perform some
renames to improve readability and avoid collisions. Many of these
variables are composed from others, so the file is only partially
sorted.

(From OE-Core rev: 1ab55d495957918be532a36224b5598c9955a44d)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-30 17:00:50 +01:00
Trevor Gamblin
bd2159719c patchtest: test_non_auh_upgrade: improve parse logic
The AUH email address used for matching was outdated. Fix it so that it
correctly identifies emails using the new one.

Also make sure to only scan the commit message and not the body, since
it's possible (like in this patch) that the user may be editing actual
code that checks for AUH-related strings.

Fixes [YOCTO #15390].

(From OE-Core rev: 557400648b6f4f31176847f8a068d2e199b7793d)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-01 12:32:37 +01:00
Trevor Gamblin
3802372a2a patchtest: test_shortlog_length: omit shortlog prefixes
In certain cases, the shortlog for a patch would include branch and
'PATCH' tag information even after the repo tag got stripped out,
padding it with data that wouldn't actually be included with a merge.
This caused the patchtest test_shortlog_length test to erroneously
report a failure.

For example, a patch whose shortlog tags were:

[OE-core][master/scarthgap][PATCH]

would leave this behind in the shortlog, along with the actual content:

[master/scarthgap][PATCH]

Add a re.sub() call in the test to fix this by removing all square
bracket pairs that appear at the beginning of the string.

Fixes [YOCTO #15575].

(From OE-Core rev: 6e1ddadfe779291cf46fb88fb01769c022b733ac)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-01 12:28:10 +01:00
Trevor Gamblin
6f66cf7694 patchtest: test_mbox: remove duplicate regex definition
(From OE-Core rev: b350239ce1350ed61410431d30e938365d406db1)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-09-01 12:28:10 +01:00
Trevor Gamblin
4954be685f patchtest/patch.py: remove cruft
Remove some minor chunks of code in patch.py that serve no purpose.

(From OE-Core rev: e2146fe0cb8b3c22d2df1cda5a36f458b7313280)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-08-05 14:31:57 +01:00
Trevor Gamblin
7040223b09 patchtest: selftest: fix patch files
Recent changes to the selftest-hello recipe caused the patchtest
selftest patches to not apply cleanly, which in turn meant several tests
weren't being fully executed or were reporting unexpected PASS/SKIP.

Update all of the test patch files to use a newer baseline and apply
cleanly again.

(From OE-Core rev: d73373d8a590d68e448af2e9ac600adc85777604)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-06-05 16:47:58 +01:00
Trevor Gamblin
cec77d941e patchtest: utils: remove unused functions
Specifically, remove four things:

- get_subject_prefix(): This function is only being used once (in the next
function found in the module), so remove it for easier
comprehension/maintenance.
- exec_cmd: the backend for executing a custom command
- exec_cmds: for running multiple calls to exec_cmd
- CmdException: A custom exception class specifically for exec_cmd

These are only used to execute git commands, but GitPython can be used
to handle all of that more efficiently, so remove them.

(From OE-Core rev: e2fabdd6d53ee30a67992bd966961f423f18a388)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-13 16:28:35 +01:00
Trevor Gamblin
9c4e350797 patchtest: tests: update bugzilla_entry_format.fail testfile
Update the test file to target a more stable README file.

(From OE-Core rev: 3d0649ea8ca9dde982ee67aa866170ea4297ef4c)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-13 16:28:35 +01:00
Trevor Gamblin
9132e3904a patchtest: repo: refactor to use GitPython
The repo module currently uses a custom _exec() function in order to run
various git commands as part of the patchtest setup/test process. These
can more efficiently be done with the GitPython module, so use that
instead and reduce the amount of custom code to be maintained for
patchtest in the process. Some specifics replaced using GitPython:

- get branch list
- use repo.active_branch to determine current branch
- use execute() for checkout, merge check, abort, rev-parse, reset

The _exec() function is removed entirely with this change.

(From OE-Core rev: 8ab3a0d7cb68746d7b7e1c7ff8bdf9a84a4d075d)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-13 16:28:35 +01:00
Trevor Gamblin
e73ea1a868 patchtest: requirements.txt: add GitPython
GitPython provides some simple utilities for retrieving repo
configurations that can replace the manual work that patchtest currently
does. Add it to the requirements so that the source can make use of it.

(From OE-Core rev: dd4e4adfe91333fbd52d1441e2864a570e0dd073)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-05-13 16:28:35 +01:00
Trevor Gamblin
f15ea3ad06 patchtest: test_metadata: fix invalid escape sequences
Clear up the following warnings seen during patchtest runs:

|/workspace/yocto/poky/meta/lib/patchtest/tests/test_metadata.py:21: SyntaxWarning: invalid escape sequence '\+'
|  add_mark = pyparsing.Regex('\+ ')
|/workspace/yocto/poky/meta/lib/patchtest/tests/test_metadata.py:26: SyntaxWarning: invalid escape sequence '\:'
|  git_regex = pyparsing.Regex('^git\:\/\/.*')

(From OE-Core rev: 2d64317835a768898aac592b24fcbdfaf6c8357a)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-23 13:40:24 +01:00
Simone Weiß
e8ea8695e1 patchtest: Skip test for CVE_CHECK_IGNORE for older branches
Skip the test for checking if CVE_CHECK_IGNORE is not used.
It is deprecated now, but was not deprecated for kirkstone and dunfell.
Skip it therefore if a patch is intended for those branches.

(From OE-Core rev: e9b04664b1b2ba6aa1fa7318e3d4174b9cdb19da)

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-24 16:10:23 +00:00
Simone Weiß
728b9ba88e patchtest: Add selftest for test cve_check_ignore
Add a selftest for the recently introduced check for CVE_CHECK_IGNORE.

(From OE-Core rev: dc6ebbbb94b162d8aa68e46d5a166606ace5e39c)

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-19 11:39:08 +00:00
Adrian Freihofer
fe58da1393 meta/lib/patchtest: python 3.12 regex
Python 3 interprets string literals as Unicode strings, and therefore
\s is treated as an escaped Unicode character which is not correct.
Declaring the RegEx pattern as a raw string instead of unicode is
required for Python 3.

(From OE-Core rev: 329a555f7b8f00c648c44b01f423e6da33a46245)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-13 13:51:41 +00:00
Simone Weiß
70a92a2f8b patchtest: Add test for deprecated CVE_CHECK_IGNORE
If a recipes was modified recommand the use of `CVE_STATUS` instead if
`CVE_CHECK_IGNORE` is used. This is a depreacted variable and will
result in a warning from the cve-check.class and should hence not be
used anymore. [YOCTO #15311]

(From OE-Core rev: 5c264063f6363e5ff88146125217b6089eb22f12)

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-02 22:51:01 +00:00
Trevor Gamblin
5c1070e258 patchtest: shorten patch signed-off-by test output
The patch Signed-off-by test's output line is excessively long, and can
trigger a failsafe in the patchtest automated service's email content
generation. Shorten the output by reducing redundant phrasing and using
os.path.basename to get only the failing patch's name, not the entire
path, as the submitter should have a good idea of where it is located
regardless.

(From OE-Core rev: cc7546ded87dd44a988d7a23f1d7645094b5cdd4)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-12-04 11:23:37 +00:00
Trevor Gamblin
1c135f1d7a patchtest: rework license checksum tests
Remove the pretest_lic_files_chksum_modified_not_mentioned test entirely
and use pyparsing in test_lic_files_chksum_modified_not_mentioned to
scan the patches for lines starting with either "+LIC_FILES_CHKSUM" or
"-LIC_FILES_CHKSUM".  If either is found but no "License-Update" tag is
present in the commit, fail the test.

(From OE-Core rev: 8e1bda0eb225ada22fdf5990edfec512be1d6629)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-08 11:00:09 +00:00
Trevor Gamblin
06a7e7a14d patchtest: remove test for CVE tag in mbox
After patchtest went live it was determined that testing for a CVE tag
in the mbox commit message is unnecessary, since it will already be in
the shortlog and in any carried patches. Remove the test and the
associated selftest files so that its absence isn't flagged in future
test results.

(From OE-Core rev: 54690f18f04a2ab993a85d551ce4f8d0fa56618a)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-01 19:19:40 +00:00
Trevor Gamblin
3ad5aa3f16 patchtest: make pylint tests compatible with 3.x
pylint 3.x has removed epylint, which is now a separate module. To avoid
adding another recipe or using outdated modules, modify the
test_python_pylint tests so that they use the standard pylint API.

(From OE-Core rev: 72be3d6a116febf46130cccbe12afe5ad93779b5)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-11-01 19:19:40 +00:00
Trevor Gamblin
9b22a5aa8c patchtest: shorten test result outputs
Some test result lines in TestMbox and TestPatch are still too long to
avoid being flagged by the mailer script. Clean them up by removing
redundant information, so that they are all under the length limit of
220 characters.

(From OE-Core rev: c10d0bb542b23fbdc14d76dfa8e5885aa4d33083)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-29 22:39:17 +00:00
Trevor Gamblin
631d19ed6c patchtest: reduce checksum test output length
The test_lic_files_chksum_modified_not_mentioned test in TestMetadata is
outputting very long lines that fail the maximum length check when
sending email results, preventing the actual errors from being
displayed. Reduce the length of the failure message by rewording and
removing redundant information.

(From OE-Core rev: 2e2625735181160e9760a6f3af4955bda2ea6d4d)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-27 17:48:11 +01:00
Trevor Gamblin
207a5a21d3 patchtest: simplify test directory structure
Consolidate the various mbox tests into a new TestMbox class, metadata
tests into TestMetadata, and patch tests into TestPatch. Also update the
selftest filenames to match the changes. The test contents are not
significantly changed (other than to reference the new class names).
While this doesn't improve overall readability, it does result in more
obvious categorization, and more importantly reduces the number of calls
to setup tinfoil in the tests, resulting in a roughly 25% reduction in
runtime.

Before:

[tgamblin@megalith poky]$ time ./meta/lib/patchtest/selftest/selftest
XPASS: PatchSignedOffBy.test_signed_off_by_presence (file: PatchSignedOffBy.test_signed_off_by_presence.pass)
XFAIL: Shortlog.test_shortlog_format (file: Shortlog.test_shortlog_format.fail)
XFAIL: MboxFormat.test_mbox_format (file: MboxFormat.test_mbox_format.1.fail)
XPASS: Shortlog.test_shortlog_length (file: Shortlog.test_shortlog_length.pass)
XFAIL: CommitMessage.test_commit_message_presence (file: CommitMessage.test_commit_message_presence.fail)
XFAIL: SrcUri.test_src_uri_left_files (file: SrcUri.test_src_uri_left_files.fail)
XPASS: Author.test_author_valid (file: Author.test_author_valid.1.pass)
XFAIL: LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned (file: LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.fail)
XPASS: CVE.test_cve_tag_format (file: CVE.test_cve_tag_format.pass)
XPASS: CVE.test_cve_presence_in_commit_message (file: CVE.test_cve_presence_in_commit_message.pass)
XFAIL: CVE.test_cve_tag_format (file: CVE.test_cve_tag_format.fail)
XFAIL: Author.test_author_valid (file: Author.test_author_valid.1.fail)
XFAIL: LicFilesChkSum.test_lic_files_chksum_presence (file: LicFilesChkSum.test_lic_files_chksum_presence.fail)
XSKIP: Merge.test_series_merge_on_head (file: Merge.test_series_merge_on_head.2.skip)
XPASS: MboxFormat.test_mbox_format (file: MboxFormat.test_mbox_format.pass)
XFAIL: SignedOffBy.test_signed_off_by_presence (file: SignedOffBy.test_signed_off_by_presence.1.fail)
XPASS: Shortlog.test_shortlog_format (file: Shortlog.test_shortlog_format.pass)
XFAIL: SignedOffBy.test_signed_off_by_presence (file: SignedOffBy.test_signed_off_by_presence.2.fail)
XFAIL: MboxFormat.test_mbox_format (file: MboxFormat.test_mbox_format.2.fail)
XFAIL: Summary.test_summary_presence (file: Summary.test_summary_presence.fail)
XPASS: Author.test_author_valid (file: Author.test_author_valid.2.pass)
XSKIP: Merge.test_series_merge_on_head (file: Merge.test_series_merge_on_head.1.skip)
XPASS: Bugzilla.test_bugzilla_entry_format (file: Bugzilla.test_bugzilla_entry_format.pass)
XFAIL: CVE.test_cve_presence_in_commit_message (file: CVE.test_cve_presence_in_commit_message.fail)
XPASS: SignedOffBy.test_signed_off_by_presence (file: SignedOffBy.test_signed_off_by_presence.pass)
XPASS: LicFilesChkSum.test_lic_files_chksum_presence (file: LicFilesChkSum.test_lic_files_chksum_presence.pass)
XPASS: CommitMessage.test_commit_message_presence (file: CommitMessage.test_commit_message_presence.pass)
XPASS: Summary.test_summary_presence (file: Summary.test_summary_presence.pass)
XPASS: LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned (file: LicFilesChkSum.test_lic_files_chksum_modified_not_mentioned.pass)
XFAIL: Shortlog.test_shortlog_length (file: Shortlog.test_shortlog_length.fail)
XFAIL: PatchSignedOffBy.test_signed_off_by_presence (file: PatchSignedOffBy.test_signed_off_by_presence.fail)
XFAIL: Bugzilla.test_bugzilla_entry_format (file: Bugzilla.test_bugzilla_entry_format.fail)
XPASS: SrcUri.test_src_uri_left_files (file: SrcUri.test_src_uri_left_files.pass)
XFAIL: Author.test_author_valid (file: Author.test_author_valid.2.fail)
============================================================================
Testsuite summary for patchtest
============================================================================
============================================================================

real    24m14.386s
user    1m13.599s
sys     0m21.477s

After:

[tgamblin@megalith poky]$ time ./meta/lib/patchtest/selftest/selftest
XFAIL: TestMbox.test_bugzilla_entry_format (file: TestMbox.test_bugzilla_entry_format.fail)
XPASS: TestMetadata.test_summary_presence (file: TestMetadata.test_summary_presence.pass)
XFAIL: TestMbox.test_mbox_format (file: TestMbox.test_mbox_format.1.fail)
XFAIL: TestMetadata.test_src_uri_left_files (file: TestMetadata.test_src_uri_left_files.fail)
XSKIP: TestMbox.test_series_merge_on_head (file: TestMbox.test_series_merge_on_head.2.skip)
XPASS: TestMbox.test_commit_message_presence (file: TestMbox.test_commit_message_presence.pass)
XFAIL: TestMbox.test_commit_message_presence (file: TestMbox.test_commit_message_presence.fail)
XPASS: TestMbox.test_signed_off_by_presence (file: TestMbox.test_signed_off_by_presence.pass)
XFAIL: TestPatch.test_cve_tag_format (file: TestPatch.test_cve_tag_format.fail)
XFAIL: TestMbox.test_author_valid (file: TestMbox.test_author_valid.1.fail)
XFAIL: TestMbox.test_shortlog_length (file: TestMbox.test_shortlog_length.fail)
XPASS: TestMbox.test_mbox_format (file: TestMbox.test_mbox_format.pass)
XFAIL: TestPatch.test_signed_off_by_presence (file: TestPatch.test_signed_off_by_presence.fail)
XFAIL: TestMbox.test_shortlog_format (file: TestMbox.test_shortlog_format.fail)
XFAIL: TestMbox.test_mbox_format (file: TestMbox.test_mbox_format.2.fail)
XPASS: TestPatch.test_cve_tag_format (file: TestPatch.test_cve_tag_format.pass)
XSKIP: TestMbox.test_series_merge_on_head (file: TestMbox.test_series_merge_on_head.1.skip)
XPASS: TestMbox.test_author_valid (file: TestMbox.test_author_valid.2.pass)
XPASS: TestMetadata.test_lic_files_chksum_modified_not_mentioned (file: TestMetadata.test_lic_files_chksum_modified_not_mentioned.pass)
XPASS: TestMbox.test_bugzilla_entry_format (file: TestMbox.test_bugzilla_entry_format.pass)
XPASS: TestMetadata.test_src_uri_left_files (file: TestMetadata.test_src_uri_left_files.pass)
XPASS: TestMetadata.test_lic_files_chksum_presence (file: TestMetadata.test_lic_files_chksum_presence.pass)
XPASS: TestMbox.test_cve_presence_in_commit_message (file: TestMbox.test_cve_presence_in_commit_message.pass)
XFAIL: TestMbox.test_signed_off_by_presence (file: TestMbox.test_signed_off_by_presence.2.fail)
XFAIL: TestMbox.test_author_valid (file: TestMbox.test_author_valid.2.fail)
XFAIL: TestMetadata.test_lic_files_chksum_presence (file: TestMetadata.test_lic_files_chksum_presence.fail)
XPASS: TestMbox.test_shortlog_format (file: TestMbox.test_shortlog_format.pass)
XPASS: TestMbox.test_author_valid (file: TestMbox.test_author_valid.1.pass)
XPASS: TestPatch.test_signed_off_by_presence (file: TestPatch.test_signed_off_by_presence.pass)
XFAIL: TestMetadata.test_lic_files_chksum_modified_not_mentioned (file: TestMetadata.test_lic_files_chksum_modified_not_mentioned.fail)
XPASS: TestMbox.test_shortlog_length (file: TestMbox.test_shortlog_length.pass)
XFAIL: TestMbox.test_signed_off_by_presence (file: TestMbox.test_signed_off_by_presence.1.fail)
XFAIL: TestMbox.test_cve_presence_in_commit_message (file: TestMbox.test_cve_presence_in_commit_message.fail)
XFAIL: TestMetadata.test_summary_presence (file: TestMetadata.test_summary_presence.fail)
============================================================================
Testsuite summary for patchtest
============================================================================
============================================================================
real    18m39.749s
user    0m41.857s
sys     0m14.708s

(From OE-Core rev: f788592da2fd0e21638ce2c3326675a060ba51cf)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-26 21:11:28 +01:00
Trevor Gamblin
71bf3fcf0f patchtest/selftest: add XSKIP, update test files
Since we are skipping the merge test, two of the selftests now report
SKIP instead of XPASS/XFAIL as expected. Adjust the two files to have
the right endings for XSKIP, and add the category so that it can be used
for more extensive testing in the future.

(From OE-Core rev: 3331f53c0be2575784a042bb2401eeba4f2a5a3e)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-25 23:10:19 +01:00
Trevor Gamblin
440c9f9b77 patchtest: disable merge test
Disable the merge-on-head test until patchtest properly handles merging
of series subsets and accounts for patches that are rapidly merged (i.e.
before patchtest is run).

(From OE-Core rev: e561c614dc72b7f8bf5e09a09bbe6ebc3cf500bb)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-24 21:41:58 +01:00
Trevor Gamblin
95a3f69be5 patchtest: fix lic_files_chksum test regex
the test_lic_files_chksum_modified_not_mentioned test in patchtest
wasn't picking up on 'License-Update:' tags correctly. Use pyparsing's
AtLineStart class to simplify the regex setup and search.

(From OE-Core rev: dc9126e45e74b915faaf296037e7ece41785bf4a)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-20 17:02:13 +01:00
Trevor Gamblin
8cea0676b7 patchtest: skip merge test if not targeting master
Avoid testing mergeability of a patch when not targeting master, so that
patches tested via other means (e.g. maintainer branches and AB runs)
don't get unnecessarily reviewed an extra time.

(From OE-Core rev: e6cf23e353f48c57249681bd0b12bd8494d4959a)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-19 22:25:23 +01:00
Trevor Gamblin
9b8b9a9fa3 patchtest: test regardless of mergeability
(From OE-Core rev: dc089073eb120de76c8907e476c341ed3e97c164)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-19 22:25:23 +01:00
Ross Burton
4cea51a9ad patchtest: remove unused imports
(From OE-Core rev: be8429d986335aae65c2426862b97836ba46e42a)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-19 14:53:45 +01:00
Trevor Gamblin
104decd489 patchtest/selftest: fix command arguments
Changes to patchtest's command-line arguments to work with oe-core by
default do not match the selftest script's argument list. Explicitly use
the --testdir and --repodir flags in selftest so that it is compatible
them.

(From OE-Core rev: 6cd547b24896596d4e0fe57f26f553842c5560b5)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-17 22:53:30 +01:00
Trevor Gamblin
b5a87b5f98 patchtest: update SPDX identifiers
Replace full license headers with SPDX identifiers and adjust all
patchtest-related code to use GPL-2.0-only.

(From OE-Core rev: 9bea6b39074296bb8d8719a3300636e316f19d1b)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-17 22:53:30 +01:00
Trevor Gamblin
26e3d58e71 patchtest: set default repo and testdir targets
Since patchtest is in oe-core, the Python os module's methods can be
used to retrieve the repository path and tests directory by default.
This reduces the number of mandatory arguments for invocation of
patchtest unless the user wants to use a custom test suite or test
patches against a different repo. The REPO and TESTDIR arguments are
likewise adjusted so that they are optional. Also, make it more obvious
what the --startdir flag is meant for on the command line by renaming it
to --testdir, and update the scripts/patchtest.README file to be
consistent with the new usage.

(From OE-Core rev: bae7421ece4806f5148f164293810b9fe75e0756)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-17 11:41:34 +01:00
Trevor Gamblin
9d137188ad patchtest: add supporting modules
Add modules that support core patchtest functionality to
meta/lib/patchtest. These include classes and functions for handling
repository and patch objects, parsing the patchtest CLI arguments, and
other utilities.

(From OE-Core rev: 499cdad7a16f6cc256837069c7add294132127a4)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-17 11:41:34 +01:00
Trevor Gamblin
790aa2096f patchtest/requirements.txt: update
Add git-pw and boto3 to the list of requirements for patchtest.

(From OE-Core rev: f88e295cb5034950e9a0899c1dc3ca685a30a176)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-10-17 11:41:34 +01:00
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
Trevor Gamblin
2fdabc368a patchtest: improve test issue messages
The patchtest tests provide vague feedback to the user, and many of them
also provide redundant 'fix' strings that could easily be incorporated
into the issue messages themselves. Simplify them so that it is more
clear what the errors are and how they can be addressed. No
recommendation is given when the issue string adequately conveys the
issue, e.g. with a missing "LICENSE" entry in a newly-created recipe.

(From OE-Core rev: 0bfb3614244ec7aa79b6424bc63f9f2bccdabe98)

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
Michael Opdenacker
79cd9301bd lib/oe/qa: remove obsolete "Accepted" string for Upstream-Status
Replaced by "Backport" since release 3.2
https://docs.yoctoproject.org/migration-guides/migration-3.2.html#miscellaneous-changes

(From OE-Core rev: 4053fa9184fd016cfa59a67ff7857e17d88bf25e)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-22 07:45:17 +01:00
Trevor Gamblin
882efa1e45 patchtest/selftest: only split resultlines once
selftest assumes that the test result output lines will consist of two
tokens separated by whitespace, which are the actual result and the name
of the test run. As a result, the script fails if any verbosity is added
to the output of patchtest itself (e.g. by including a failure reason).
Make the call to split() only do so once in order to ensure that two
tokens are obtained.

(From OE-Core rev: b7ff1e7363261780c015a3ee3b6d4bc69567f67f)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-22 07:45:17 +01:00
Trevor Gamblin
0f5691f23c patchtest: Add README.md for selftests
Add a short README describing how to setup patchtest's selftests for
oe-core.

(From OE-Core rev: afd4f3d9fa22dd0fbb0c30bbfc4a3de37d695c76)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-14 15:20:08 +01:00
Trevor Gamblin
9788cccca7 patchtest: add requirements.txt
Add a requirements.txt file with the Python modules needed for Patchtest
to run.

(From OE-Core rev: 2fd953ac5dd86d3045a6af240d61c6e36c62d133)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-14 15:20:08 +01:00
Trevor Gamblin
0cf17394f8 patchtest/selftest: remove configurable target
The ability to pass the target (i.e. oe-core) as an argument was a
testing mechanism and isn't needed when the tests are part of the repo,
so remove it and use os.path.dirname to get it instead.

(From OE-Core rev: 87c54eae350e358f32b12ae807719fa845fd54af)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-09-14 15:20:08 +01:00
Trevor Gamblin
4a6f38c532 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>
2023-09-14 15:20:08 +01:00