Skip to contentSkip to conversation

checkpatch: reversed logic with acpi test checks

PATCH Applied Michael S. Tsirkin 5 participants 6 messages Jun 2, 2020 – Jun 4, 2020 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: reversed logic with acpi test checks

Logic reversed: allowed list should just be ignored. Instead we only take that into account :(

Fixes e11b06a880ca ("checkpatch: ignore allowed diff list")
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 0ba213e9f2..55aa45dc16 100755
@@ -1267,7 +1267,7 @@ sub checkfilename {
         # 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$#) {
+	} elsif (not $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
 		$$acpi_nontestexpected = $name;
 	}
 	if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
Signature · 1 line
MST
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Michael S. Tsirkin

Logic reversed: allowed list should just be ignored. Instead we only take that into account :(

Fixes e11b06a880ca ("checkpatch: ignore allowed diff list")
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +0 -0
index 0ba213e9f2..55aa45dc16 100755

scripts/checkpatch.pl sub checkfilename { · line 1273

Quoted 8 lines
scripts/checkpatch.pl +1 -1
@@ -1267,7 +1267,7 @@ sub checkfilename {
         # 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$#) {
+	} elsif (not $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
 		$$acpi_nontestexpected = $name;
 	}
 	if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Michael S. Tsirkin

Hi,

Quoted 5 lines · Michael S. Tsirkin

Logic reversed: allowed list should just be ignored. Instead we only take that into account :(

Fixes e11b06a880ca ("checkpatch: ignore allowed diff list")

Fixes issues reported in "[RFC 0/6] TPM-TIS bios-tables-test" cover letter

Thanks

Eric

Quoted 18 lines
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 0ba213e9f2..55aa45dc16 100755
@@ -1267,7 +1267,7 @@ sub checkfilename {
         # 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$#) {
+	} elsif (not $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
 		$$acpi_nontestexpected = $name;
 	}
 	if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
#3 lore raw
In reply to Michael S. Tsirkin
Quoted 15 lines · Michael S. Tsirkin

Logic reversed: allowed list should just be ignored. Instead we only take that into account :(

Fixes e11b06a880ca ("checkpatch: ignore allowed diff list")
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +0 -0
index 0ba213e9f2..55aa45dc16 100755

scripts/checkpatch.pl sub checkfilename { · line 1273

Quoted 8 lines
scripts/checkpatch.pl +1 -1
@@ -1267,7 +1267,7 @@ sub checkfilename {
         # 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$#) {
+	} elsif (not $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
 		$$acpi_nontestexpected = $name;
 	}
 	if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {

Queued with "!~" to achieve the logical not.

Paolo

#4 lore raw
Quoted 27 lines · Paolo Bonzini
Quoted 15 lines · Michael S. Tsirkin

Logic reversed: allowed list should just be ignored. Instead we only take that into account :(

Fixes e11b06a880ca ("checkpatch: ignore allowed diff list")
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +0 -0
index 0ba213e9f2..55aa45dc16 100755

scripts/checkpatch.pl sub checkfilename { · line 1273

Quoted 8 lines
scripts/checkpatch.pl +1 -1
@@ -1267,7 +1267,7 @@ sub checkfilename {
         # 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$#) {
+	} elsif (not $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
 		$$acpi_nontestexpected = $name;
 	}
 	if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {

Queued with "!~" to achieve the logical not.

Quoted 1 line

Paolo

Hmm perl manual says "not" is the logical not. Weird. What's !~? My perl is a bit rusty :)

#5 lore raw
Quoted 9 lines · Michael S. Tsirkin
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Michael S. Tsirkin
+   } elsif (not $name =~ m#^tests/qtest/bios-tables-test-allowed-diff.h$#) {
            $$acpi_nontestexpected = $name;
    }
    if (defined $$acpi_testexpected and defined $$acpi_nontestexpected) {
Quoted 6 lines
Quoted 3 lines

Queued with "!~" to achieve the logical not.

Paolo

Hmm perl manual says "not" is the logical not. Weird. What's !~? My perl is a bit rusty :)

man perlop says:
# Binary "!~" is just like "=~" except the return value is negated in the logical sense.

So it's more idiomatic to use it directly rather than using =~ and then doing a logical negation separately.

thanks
-- PMM