Skip to content

Commit 18e91b9

Browse files
committed
Detect adding and updating .result files
Part of #23
1 parent fbd3f84 commit 18e91b9

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Diff for: checkpatch.pl

+13
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,8 @@ sub process {
21402140

21412141
my %commit_log_tags = ();
21422142
my $has_changelog = 0;
2143+
my $has_test_result_file = 0;
2144+
my $warned_about_result_file = 0;
21432145
my $has_doc = 0;
21442146
my $has_test = 0;
21452147
my $is_test = 0;
@@ -2731,6 +2733,9 @@ sub process {
27312733
if ($realfile =~ /^(?:static-build\/)?test\/.*\//) {
27322734
$has_test = 1;
27332735
}
2736+
if ($realfile =~ /^test\/.*\.result$/) {
2737+
$has_test_result_file = 1;
2738+
}
27342739

27352740
# check for repeated words separated by a single space
27362741
# avoid false positive from list command eg, '-rw-r--r-- 1 root root'
@@ -2823,6 +2828,14 @@ sub process {
28232828
"please, use spaces instead of tabs\n" . $herevet);
28242829
}
28252830

2831+
if (!$warned_about_result_file &&
2832+
$has_test_result_file &&
2833+
$line =~ /^\+/) {
2834+
$warned_about_result_file = 1;
2835+
ERROR("TEST_DIFF_FILE",
2836+
"Please avoid tests with .result files\n");
2837+
}
2838+
28262839
# check we are in a valid C source file if not then ignore this hunk
28272840
next if ($realfile !~ /\.(h|c|cc)$/);
28282841

Diff for: doc/checkpatch.rst

+4
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,10 @@ Others
742742
For DOS-formatted patches, there are extra ^M symbols at the end of
743743
the line. These should be removed.
744744

745+
**TEST_DIFF_FILE**
746+
For regression tests, there are .result files. Tests with .result files
747+
should be avoided.
748+
745749
**MEMSET**
746750
The memset use appears to be incorrect. This may be caused due to
747751
badly ordered parameters. Please recheck the usage.

0 commit comments

Comments
 (0)