diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-02-18 09:35:49 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-02-18 09:35:49 -0500 |
commit | 7328735cbf68b7cd4d7ef16e172013743cdc2bc4 (patch) | |
tree | 66a6ff7a8d90f809d81c5f77e8219dc40e5c50a1 /tools/testing/ktest | |
parent | 4c0b67a27d96e01a4b4ede2fda57da9f7c50af21 (diff) |
ktest: Remove indexes from warnings check
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>
Diffstat (limited to 'tools/testing/ktest')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index f3bb5da3193b..4e67d52eb3a2 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -1945,6 +1945,27 @@ sub start_monitor_and_boot { | |||
1945 | my $check_build_re = ".*:.*(warning|error|Error):.*"; | 1945 | my $check_build_re = ".*:.*(warning|error|Error):.*"; |
1946 | my $utf8_quote = "\\x{e2}\\x{80}(\\x{98}|\\x{99})"; | 1946 | my $utf8_quote = "\\x{e2}\\x{80}(\\x{98}|\\x{99})"; |
1947 | 1947 | ||
1948 | sub process_warning_line { | ||
1949 | my ($line) = @_; | ||
1950 | |||
1951 | chomp $line; | ||
1952 | |||
1953 | # for distcc heterogeneous systems, some compilers | ||
1954 | # do things differently causing warning lines | ||
1955 | # to be slightly different. This makes an attempt | ||
1956 | # to fixe those issues. | ||
1957 | |||
1958 | # chop off the index into the line | ||
1959 | # using distcc, some compilers give different indexes | ||
1960 | # depending on white space | ||
1961 | $line =~ s/^(\s*\S+:\d+:)\d+/$1/; | ||
1962 | |||
1963 | # Some compilers use UTF-8 extended for quotes and some don't. | ||
1964 | $line =~ s/$utf8_quote/'/g; | ||
1965 | |||
1966 | return $line; | ||
1967 | } | ||
1968 | |||
1948 | # Read buildlog and check against warnings file for any | 1969 | # Read buildlog and check against warnings file for any |
1949 | # new warnings. | 1970 | # new warnings. |
1950 | # | 1971 | # |
@@ -1965,8 +1986,9 @@ sub check_buildlog { | |||
1965 | 1986 | ||
1966 | while (<IN>) { | 1987 | while (<IN>) { |
1967 | if (/$check_build_re/) { | 1988 | if (/$check_build_re/) { |
1968 | chomp; | 1989 | my $warning = process_warning_line $_; |
1969 | $warnings_list{$_} = 1; | 1990 | |
1991 | $warnings_list{$warning} = 1; | ||
1970 | } | 1992 | } |
1971 | } | 1993 | } |
1972 | close(IN); | 1994 | close(IN); |
@@ -1978,13 +2000,9 @@ sub check_buildlog { | |||
1978 | open(IN, $buildlog) or dodie "Can't open $buildlog"; | 2000 | open(IN, $buildlog) or dodie "Can't open $buildlog"; |
1979 | while (<IN>) { | 2001 | while (<IN>) { |
1980 | if (/$check_build_re/) { | 2002 | if (/$check_build_re/) { |
2003 | my $warning = process_warning_line $_; | ||
1981 | 2004 | ||
1982 | # Some compilers use UTF-8 extended for quotes | 2005 | if (!defined $warnings_list{$warning}) { |
1983 | # for distcc heterogeneous systems, this causes issues | ||
1984 | s/$utf8_quote/'/g; | ||
1985 | |||
1986 | chomp; | ||
1987 | if (!defined $warnings_list{$_}) { | ||
1988 | fail "New warning found (not in $warnings_file)\n$_\n"; | 2006 | fail "New warning found (not in $warnings_file)\n$_\n"; |
1989 | $no_reboot = $save_no_reboot; | 2007 | $no_reboot = $save_no_reboot; |
1990 | return 0; | 2008 | return 0; |