summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-05-22 16:32:37 -0600
committerTom Rini <trini@konsulko.com>2020-06-04 18:10:02 -0400
commit281236c728be2b26474fe4bfa0e53cc4c5782617 (patch)
tree08bfbf8f52a6af55eb11b11dbee96b5208847ded /scripts
parentb77df5980c3e24e34e0db3a52c5bce396a81c430 (diff)
checkpatch.pl: Add a check for tests needed for uclasses
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 <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b8b057ce56..1053d29ce9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2243,6 +2243,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/<name>.c\n" . $herecurr);
+ }
}
sub process {