public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 7/7] ktest: Remove indexes from warnings check
Date: Tue, 19 Feb 2013 23:07:35 -0500	[thread overview]
Message-ID: <20130220040928.024193269@goodmis.org> (raw)
In-Reply-To: 20130220040728.921685169@goodmis.org

[-- Attachment #1: Type: text/plain, Size: 2386 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

The index of a line where a warning is tested can be returned
differently on different versions of gcc (or same version compiled
differently). That is, a tab + space can give different results. This
causes the warning check to produce a false positive. Removing the
index from the check fixes this issue.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl |   34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index f3bb5da..4e67d52 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1945,6 +1945,27 @@ sub start_monitor_and_boot {
 my $check_build_re = ".*:.*(warning|error|Error):.*";
 my $utf8_quote = "\\x{e2}\\x{80}(\\x{98}|\\x{99})";
 
+sub process_warning_line {
+    my ($line) = @_;
+
+    chomp $line;
+
+    # for distcc heterogeneous systems, some compilers
+    # do things differently causing warning lines
+    # to be slightly different. This makes an attempt
+    # to fixe those issues.
+
+    # chop off the index into the line
+    # using distcc, some compilers give different indexes
+    # depending on white space
+    $line =~ s/^(\s*\S+:\d+:)\d+/$1/;
+
+    # Some compilers use UTF-8 extended for quotes and some don't.
+    $line =~ s/$utf8_quote/'/g;
+
+    return $line;
+}
+
 # Read buildlog and check against warnings file for any
 # new warnings.
 #
@@ -1965,8 +1986,9 @@ sub check_buildlog {
 
 	while (<IN>) {
 	    if (/$check_build_re/) {
-		chomp;
-		$warnings_list{$_} = 1;
+		my $warning = process_warning_line $_;
+		
+		$warnings_list{$warning} = 1;
 	    }
 	}
 	close(IN);
@@ -1978,13 +2000,9 @@ sub check_buildlog {
     open(IN, $buildlog) or dodie "Can't open $buildlog";
     while (<IN>) {
 	if (/$check_build_re/) {
+	    my $warning = process_warning_line $_;
 
-	    # Some compilers use UTF-8 extended for quotes
-	    # for distcc heterogeneous systems, this causes issues
-	    s/$utf8_quote/'/g;
-
-	    chomp;
-	    if (!defined $warnings_list{$_}) {
+	    if (!defined $warnings_list{$warning}) {
 		fail "New warning found (not in $warnings_file)\n$_\n";
 		$no_reboot = $save_no_reboot;
 		return 0;
-- 
1.7.10.4



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

      parent reply	other threads:[~2013-02-20  4:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20  4:07 [PATCH 0/7] [GIT PULL] ktest: updates for v3.9 Steven Rostedt
2013-02-20  4:07 ` [PATCH 1/7] ktest: Do not require CONSOLE for build or install bisects Steven Rostedt
2013-02-20  4:07 ` [PATCH 2/7] ktest: Strip off \n when reading which files were modified Steven Rostedt
2013-02-20  4:07 ` [PATCH 3/7] ktest: Allow a test option to use its default option Steven Rostedt
2013-02-20  4:07 ` [PATCH 4/7] ktest: Add make_warnings_file and process full warnings Steven Rostedt
2013-02-20  4:07 ` [PATCH 5/7] ktest: Search for linux banner for successful reboot Steven Rostedt
2013-02-20  4:07 ` [PATCH 6/7] ktest: Ignore warnings during reboot Steven Rostedt
2013-02-20  4:07 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130220040928.024193269@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox