Commit 511f3aa7 authored by Frank Rowand's avatar Frank Rowand Committed by Rob Herring

of: prepare to add processing of EXPECT_NOT to of_unittest_expect

scripts/dtc/of_unittest_expect processes EXPECT messages that
document expected kernel messages triggered by unittest.  Add
processing of EXPECT_NOT messages that document kernel messages
triggered by unittest that are not expected.

This is commit 1 of 2, renaming existing variables in anticipation
of the changes needed to process EXPECT_NOT, so that commit 2 of 2
will be smaller and easier to read.  This commit is not intended
to make any functional changes.
Signed-off-by: default avatarFrank Rowand <frowand.list@gmail.com>
Link: https://lore.kernel.org/r/20230213185702.395776-2-frowand.list@gmail.comSigned-off-by: default avatarRob Herring <robh@kernel.org>
parent 16b0c7ca
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# on the console log that results from executing the Linux kernel # on the console log that results from executing the Linux kernel
# devicetree unittest (drivers/of/unitest.c). # devicetree unittest (drivers/of/unitest.c).
$VUFX = "220201a"; $VUFX = "230121a";
use strict 'refs'; use strict 'refs';
use strict subs; use strict subs;
...@@ -274,7 +274,7 @@ while ($line = <ARGV>) { ...@@ -274,7 +274,7 @@ while ($line = <ARGV>) {
if ($line =~ /^\s*$exp_begin/) { if ($line =~ /^\s*$exp_begin/) {
$data = $line; $data = $line;
$data =~ s/^\s*$exp_begin//; $data =~ s/^\s*$exp_begin//;
push @begin, $data; push @exp_begin_stack, $data;
if ($verbose) { if ($verbose) {
if ($print_line_num) { if ($print_line_num) {
...@@ -302,20 +302,20 @@ while ($line = <ARGV>) { ...@@ -302,20 +302,20 @@ while ($line = <ARGV>) {
$found = 0; $found = 0;
$no_begin = 0; $no_begin = 0;
if (@found_or_begin > 0) { if (@exp_found_or_begin > 0) {
$begin = pop @found_or_begin; $begin = pop @exp_found_or_begin;
if (compare($data, $begin)) { if (compare($data, $begin)) {
$found = 1; $found = 1;
} }
} elsif (@begin > 0) { } elsif (@begin > 0) {
$begin = pop @begin; $begin = pop @exp_begin_stack;
} else { } else {
$no_begin = 1; $no_begin = 1;
} }
if ($no_begin) { if ($no_begin) {
$expect_missing_begin++; $exp_missing_begin++;
print "** ERROR: EXPECT end without any EXPECT begin:\n"; print "** ERROR: EXPECT end without any EXPECT begin:\n";
print " end ---> $line\n"; print " end ---> $line\n";
...@@ -325,20 +325,20 @@ while ($line = <ARGV>) { ...@@ -325,20 +325,20 @@ while ($line = <ARGV>) {
$line_num = sprintf("%4s ", $.); $line_num = sprintf("%4s ", $.);
} }
$expect_not_found++; $exp_missing++;
printf "** %s%s$script_name WARNING - not found ---> %s\n", printf "** %s%s$script_name WARNING - not found ---> %s\n",
$line_num, $timestamp, $data; $line_num, $timestamp, $data;
} elsif (! compare($data, $begin)) { } elsif (! compare($data, $begin)) {
$expect_missing_end++; $exp_missing_end++;
print "** ERROR: EXPECT end does not match EXPECT begin:\n"; print "** ERROR: EXPECT end does not match EXPECT begin:\n";
print " begin -> $begin\n"; print " begin -> $begin\n";
print " end ---> $line\n"; print " end ---> $line\n";
} else { } else {
$expect_found++; $exp_found++;
} }
...@@ -357,7 +357,7 @@ while ($line = <ARGV>) { ...@@ -357,7 +357,7 @@ while ($line = <ARGV>) {
} }
$found = 0; $found = 0;
foreach $begin (@begin) { foreach $begin (@exp_begin_stack) {
if (compare($begin, $line)) { if (compare($begin, $line)) {
$found = 1; $found = 1;
last; last;
...@@ -365,12 +365,12 @@ while ($line = <ARGV>) { ...@@ -365,12 +365,12 @@ while ($line = <ARGV>) {
} }
if ($found) { if ($found) {
$begin = shift @begin; $begin = shift @exp_begin_stack;
while (! compare($begin, $line)) { while (! compare($begin, $line)) {
push @found_or_begin, $begin; push @exp_found_or_begin, $begin;
$begin = shift @begin; $begin = shift @exp_begin_stack;
} }
push @found_or_begin, $line; push @exp_found_or_begin, $line;
if ($hide_expect) { if ($hide_expect) {
$suppress_line = 1; $suppress_line = 1;
...@@ -391,18 +391,18 @@ if (! $no_expect_stats) { ...@@ -391,18 +391,18 @@ if (! $no_expect_stats) {
print "\n"; print "\n";
print "** EXPECT statistics:\n"; print "** EXPECT statistics:\n";
print "**\n"; print "**\n";
printf "** EXPECT found : %4i\n", $expect_found; printf "** EXPECT found : %4i\n", $exp_found;
printf "** EXPECT not found : %4i\n", $expect_not_found; printf "** EXPECT not found : %4i\n", $exp_missing;
printf "** missing EXPECT begin : %4i\n", $expect_missing_begin; printf "** missing EXPECT begin : %4i\n", $exp_missing_begin;
printf "** missing EXPECT end : %4i\n", $expect_missing_end; printf "** missing EXPECT end : %4i\n", $exp_missing_end;
printf "** unittest FAIL : %4i\n", $unittest_fail; printf "** unittest FAIL : %4i\n", $unittest_fail;
printf "** internal error : %4i\n", $internal_err; printf "** internal error : %4i\n", $internal_err;
} }
if (@begin) { if (@exp_begin_stack) {
print "** ERROR: EXPECT begin without any EXPECT end:\n"; print "** ERROR: EXPECT begin without any EXPECT end:\n";
print " This list may be misleading.\n"; print " This list may be misleading.\n";
foreach $begin (@begin) { foreach $begin (@exp_begin_stack) {
print " begin ---> $begin\n"; print " begin ---> $begin\n";
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment