From patchwork Fri May 22 22:32:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 246329 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Fri, 22 May 2020 16:32:37 -0600 Subject: [PATCH 3/6] checkpatch.pl: Add a check for tests needed for uclasses In-Reply-To: <20200522223240.187032-1-sjg@chromium.org> References: <20200522223240.187032-1-sjg@chromium.org> Message-ID: <20200522163226.3.I0ed2ec96cb6c0bf952202e468a44e404c578f517@changeid> A common problem when submitting a new uclass is to forget to add sandbox tests. Add a warning for this. Of course tests should always be added for new code, but this one seems to be missed by nearly every new contributor. Signed-off-by: Simon Glass --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 93863c8f086..9dc42520e2d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2241,6 +2241,12 @@ sub pos_last_openparen { # Checks specific to U-Boot sub u_boot_line { my ($realfile, $line, $herecurr) = @_; + + # ask for a test if a new uclass ID is added + if ($realfile =~ /uclass-id.h/ && $line =~ /^\+/) { + WARN("NEW_UCLASS", + "Possible new uclass - make sure to add a sandbox driver, plus a test in test/dm/.c\n" . $herecurr); + } } sub process {