mirror of
https://github.com/qemu/qemu.git
synced 2025-08-15 22:31:15 +00:00
scripts/checkpatch: use new hook for ACPI test data check
The ACPI test data check needs to analyse a list of all files in a commit, so can use the new hook for processing the file list. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
25374ba59b
commit
9bec5f93e7
@ -1330,29 +1330,6 @@ sub WARN {
|
||||
}
|
||||
}
|
||||
|
||||
# According to tests/qtest/bios-tables-test.c: do not
|
||||
# change expected file in the same commit with adding test
|
||||
sub checkfilename {
|
||||
my ($name, $acpi_testexpected, $acpi_nontestexpected) = @_;
|
||||
|
||||
# Note: shell script that rebuilds the expected files is in the same
|
||||
# directory as files themselves.
|
||||
# Note: allowed diff list can be changed both when changing expected
|
||||
# files and when changing tests.
|
||||
if ($name =~ m#^tests/data/acpi/# and not $name =~ m#^\.sh$#) {
|
||||
$$acpi_testexpected = $name;
|
||||
} elsif ($name !~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
|
||||
$$acpi_nontestexpected = $name;
|
||||
}
|
||||
if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
|
||||
ERROR("Do not add expected files together with tests, " .
|
||||
"follow instructions in " .
|
||||
"tests/qtest/bios-tables-test.c: both " .
|
||||
$$acpi_testexpected . " and " .
|
||||
$$acpi_nontestexpected . " found\n");
|
||||
}
|
||||
}
|
||||
|
||||
sub checkspdx {
|
||||
my ($file, $expr) = @_;
|
||||
|
||||
@ -1438,6 +1415,34 @@ sub checkspdx {
|
||||
# real filenames that were seen in the patch
|
||||
sub process_file_list {
|
||||
my @fileinfos = @_;
|
||||
|
||||
# According to tests/qtest/bios-tables-test.c: do not
|
||||
# change expected file in the same commit with adding test
|
||||
my @acpi_testexpected;
|
||||
my @acpi_nontestexpected;
|
||||
|
||||
foreach my $fileinfo (@fileinfos) {
|
||||
# Note: shell script that rebuilds the expected files is in
|
||||
# the same directory as files themselves.
|
||||
# Note: allowed diff list can be changed both when changing
|
||||
# expected files and when changing tests.
|
||||
if ($fileinfo->{filenew} =~ m#^tests/data/acpi/# &&
|
||||
$fileinfo->{filenew} !~ m#^\.sh$#) {
|
||||
push @acpi_testexpected, $fileinfo->{filenew};
|
||||
} elsif ($fileinfo->{filenew} !~
|
||||
m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
|
||||
push @acpi_nontestexpected, $fileinfo->{filenew};
|
||||
}
|
||||
}
|
||||
if (int(@acpi_testexpected) > 0 and int(@acpi_nontestexpected) > 0) {
|
||||
ERROR("Do not add expected files together with tests, " .
|
||||
"follow instructions in " .
|
||||
"tests/qtest/bios-tables-test.c. Files\n\n " .
|
||||
join("\n ", @acpi_testexpected) .
|
||||
"\n\nand\n\n " .
|
||||
join("\n ", @acpi_nontestexpected) .
|
||||
"\n\nfound in the same patch\n");
|
||||
}
|
||||
}
|
||||
|
||||
# Called at the start of processing a diff hunk for a file
|
||||
@ -1502,9 +1507,6 @@ sub process {
|
||||
my %suppress_whiletrailers;
|
||||
my %suppress_export;
|
||||
|
||||
my $acpi_testexpected;
|
||||
my $acpi_nontestexpected;
|
||||
|
||||
# Pre-scan the patch sanitizing the lines.
|
||||
|
||||
sanitise_line_reset();
|
||||
@ -1643,7 +1645,6 @@ sub process {
|
||||
$fileold =~ s@^([^/]*)/@@ if (!$file);
|
||||
$filenew =~ s@^([^/]*)/@@ if (!$file);
|
||||
$realfile = $filenew;
|
||||
checkfilename($realfile, \$acpi_testexpected, \$acpi_nontestexpected);
|
||||
|
||||
$fileinfo = {
|
||||
"isgit" => 1,
|
||||
@ -1677,8 +1678,6 @@ sub process {
|
||||
$realfile = $1;
|
||||
$realfile =~ s@^([^/]*)/@@ if (!$file);
|
||||
|
||||
checkfilename($realfile, \$acpi_testexpected, \$acpi_nontestexpected);
|
||||
|
||||
$p1_prefix = $1;
|
||||
if (!$file && $tree && $p1_prefix ne '' &&
|
||||
-e "$root/$p1_prefix") {
|
||||
@ -1771,9 +1770,7 @@ sub process {
|
||||
$line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
|
||||
($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
|
||||
(defined($1) || defined($2)))) &&
|
||||
!(($realfile ne '') &&
|
||||
defined($acpi_testexpected) &&
|
||||
($realfile eq $acpi_testexpected))) {
|
||||
$realfile !~ m#^tests/data/acpi/#) {
|
||||
$reported_maintainer_file = 1;
|
||||
WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user