Patchtest

From Yocto Project
Revision as of 14:56, 30 October 2023 by Tgamblin (talk | contribs)
Jump to navigationJump to search

Patchtest

Patchtest is a tool designed for improving the quality of Yocto Project and OpenEmbedded contributors' patch submissions, while simultaneously reducing the level of review effort required from project maintainers. It does this by providing a set of scripts that users can test their patches with prior to submission ("host" mode), and which can be used as part of an automated service that provides periodic feedback for patches received by Patchwork ("guest" mode).

Using Patchtest

See the patchtest README for instructions on how to use patchtest in your local workspace, and the meta-patchtest README for details on host mode setup.

Patchtest Feedback Guidelines

The patchtest feedback email is designed to provide concise instructions when one or more of the tests has failed, but additional information on specific failures is provided below:

FAIL: test lic files chksum modified not mentioned: LIC_FILES_CHKSUM changed without "License-Update:" tag and description in commit message (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)

Patchtest checks to ensure that any changes made to LIC_FILES_CHKSUM lines (including checksums for new files) are accounted for in the commit message with at least one "License-Update: <reason>" tag. If this is not present, then this test will fail.

FAIL: test CVE presence in commit message: A CVE tag should be provided in the commit message with format: "CVE: CVE-YYYY-XXXX" (test_mbox.TestMbox.test_cve_presence_in_commit_message)

Whenever a submission adds a CVE patch, patchtest will check both the patch and the parent mbox's commit message for a "CVE: CVE-YYYY-XXXX" tag. While this has historically not been required, including the tag in both locations improves review and maintenance.

FAIL: test commit message presence: Please include a commit message on your patch explaining the change (test_mbox.TestMbox.test_commit_message_presence)

This response is received whenever a submission has an empty commit message.

FAIL: test shortlog length: Edit shortlog so that it is 90 characters or less (currently X characters)

This failure indicates that the shortlog (i.e. the subject line) for the patch is so long that it may not be easily readable on some mail clients. Some subject prefixes (e.g. the branch name when submitting a patch for an older release) may unavoidably inflate the length, but the shortlog should be kept as short and concise as possible so that it is clear what the patch does and what it changes. Extra information can always be provided in the commit message.

Tests failed for the patch, but the results log could not be processed due to excessive result line length.

The patchtest-send-results script checks the test results' maximum line length to help ensure that no unintended and/or malicious code is sent to the mailing list with the results. If this message is present, the user should re-test their patch(es) locally using the patchtest script in openembedded-core/scripts before further escalation. If the issue persists after re-testing and re-submission it should be reported as a patchtest bug with a "Major" priority (include the patch file as an attachment).