diff options
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
-rwxr-xr-x | tools/testing/ktest/ktest.pl | 110 |
1 files changed, 104 insertions, 6 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl index 3d19ee445249..3fd768e65998 100755 --- a/tools/testing/ktest/ktest.pl +++ b/tools/testing/ktest/ktest.pl | |||
@@ -126,6 +126,7 @@ my $start_minconfig_defined; | |||
126 | my $output_minconfig; | 126 | my $output_minconfig; |
127 | my $minconfig_type; | 127 | my $minconfig_type; |
128 | my $use_output_minconfig; | 128 | my $use_output_minconfig; |
129 | my $warnings_file; | ||
129 | my $ignore_config; | 130 | my $ignore_config; |
130 | my $ignore_errors; | 131 | my $ignore_errors; |
131 | my $addconfig; | 132 | my $addconfig; |
@@ -193,6 +194,9 @@ my $patchcheck_end; | |||
193 | # which would require more options. | 194 | # which would require more options. |
194 | my $buildonly = 1; | 195 | my $buildonly = 1; |
195 | 196 | ||
197 | # tell build not to worry about warnings, even when WARNINGS_FILE is set | ||
198 | my $warnings_ok = 0; | ||
199 | |||
196 | # set when creating a new config | 200 | # set when creating a new config |
197 | my $newconfig = 0; | 201 | my $newconfig = 0; |
198 | 202 | ||
@@ -235,6 +239,7 @@ my %option_map = ( | |||
235 | "START_MIN_CONFIG" => \$start_minconfig, | 239 | "START_MIN_CONFIG" => \$start_minconfig, |
236 | "MIN_CONFIG_TYPE" => \$minconfig_type, | 240 | "MIN_CONFIG_TYPE" => \$minconfig_type, |
237 | "USE_OUTPUT_MIN_CONFIG" => \$use_output_minconfig, | 241 | "USE_OUTPUT_MIN_CONFIG" => \$use_output_minconfig, |
242 | "WARNINGS_FILE" => \$warnings_file, | ||
238 | "IGNORE_CONFIG" => \$ignore_config, | 243 | "IGNORE_CONFIG" => \$ignore_config, |
239 | "TEST" => \$run_test, | 244 | "TEST" => \$run_test, |
240 | "ADD_CONFIG" => \$addconfig, | 245 | "ADD_CONFIG" => \$addconfig, |
@@ -1924,7 +1929,60 @@ sub start_monitor_and_boot { | |||
1924 | return monitor; | 1929 | return monitor; |
1925 | } | 1930 | } |
1926 | 1931 | ||
1932 | my $check_build_re = ".*:.*(warning|error|Error):.*"; | ||
1933 | my $utf8_quote = "\\x{e2}\\x{80}(\\x{98}|\\x{99})"; | ||
1934 | |||
1935 | # Read buildlog and check against warnings file for any | ||
1936 | # new warnings. | ||
1937 | # | ||
1938 | # Returns 1 if OK | ||
1939 | # 0 otherwise | ||
1927 | sub check_buildlog { | 1940 | sub check_buildlog { |
1941 | return 1 if (!defined $warnings_file); | ||
1942 | |||
1943 | my %warnings_list; | ||
1944 | |||
1945 | # Failed builds should not reboot the target | ||
1946 | my $save_no_reboot = $no_reboot; | ||
1947 | $no_reboot = 1; | ||
1948 | |||
1949 | if (-f $warnings_file) { | ||
1950 | open(IN, $warnings_file) or | ||
1951 | dodie "Error opening $warnings_file"; | ||
1952 | |||
1953 | while (<IN>) { | ||
1954 | if (/$check_build_re/) { | ||
1955 | chomp; | ||
1956 | $warnings_list{$_} = 1; | ||
1957 | } | ||
1958 | } | ||
1959 | close(IN); | ||
1960 | } | ||
1961 | |||
1962 | # If warnings file didn't exist, and WARNINGS_FILE exist, | ||
1963 | # then we fail on any warning! | ||
1964 | |||
1965 | open(IN, $buildlog) or dodie "Can't open $buildlog"; | ||
1966 | while (<IN>) { | ||
1967 | if (/$check_build_re/) { | ||
1968 | |||
1969 | # Some compilers use UTF-8 extended for quotes | ||
1970 | # for distcc heterogeneous systems, this causes issues | ||
1971 | s/$utf8_quote/'/g; | ||
1972 | |||
1973 | chomp; | ||
1974 | if (!defined $warnings_list{$_}) { | ||
1975 | fail "New warning found (not in $warnings_file)\n$_\n"; | ||
1976 | $no_reboot = $save_no_reboot; | ||
1977 | return 0; | ||
1978 | } | ||
1979 | } | ||
1980 | } | ||
1981 | $no_reboot = $save_no_reboot; | ||
1982 | close(IN); | ||
1983 | } | ||
1984 | |||
1985 | sub check_patch_buildlog { | ||
1928 | my ($patch) = @_; | 1986 | my ($patch) = @_; |
1929 | 1987 | ||
1930 | my @files = `git show $patch | diffstat -l`; | 1988 | my @files = `git show $patch | diffstat -l`; |
@@ -3080,11 +3138,13 @@ sub patchcheck { | |||
3080 | build "oldconfig" or return 0; | 3138 | build "oldconfig" or return 0; |
3081 | } | 3139 | } |
3082 | 3140 | ||
3083 | 3141 | # No need to do per patch checking if warnings file exists | |
3084 | if (!defined($ignored_warnings{$sha1})) { | 3142 | if (!defined($warnings_file) && !defined($ignored_warnings{$sha1})) { |
3085 | check_buildlog $sha1 or return 0; | 3143 | check_patch_buildlog $sha1 or return 0; |
3086 | } | 3144 | } |
3087 | 3145 | ||
3146 | check_buildlog or return 0; | ||
3147 | |||
3088 | next if ($type eq "build"); | 3148 | next if ($type eq "build"); |
3089 | 3149 | ||
3090 | my $failed = 0; | 3150 | my $failed = 0; |
@@ -3642,6 +3702,39 @@ sub make_min_config { | |||
3642 | return 1; | 3702 | return 1; |
3643 | } | 3703 | } |
3644 | 3704 | ||
3705 | sub make_warnings_file { | ||
3706 | my ($i) = @_; | ||
3707 | |||
3708 | if (!defined($warnings_file)) { | ||
3709 | dodie "Must define WARNINGS_FILE for make_warnings_file test"; | ||
3710 | } | ||
3711 | |||
3712 | if ($build_type eq "nobuild") { | ||
3713 | dodie "BUILD_TYPE can not be 'nobuild' for make_warnings_file test"; | ||
3714 | } | ||
3715 | |||
3716 | build $build_type or dodie "Failed to build"; | ||
3717 | |||
3718 | open(OUT, ">$warnings_file") or dodie "Can't create $warnings_file"; | ||
3719 | |||
3720 | open(IN, $buildlog) or dodie "Can't open $buildlog"; | ||
3721 | while (<IN>) { | ||
3722 | |||
3723 | # Some compilers use UTF-8 extended for quotes | ||
3724 | # for distcc heterogeneous systems, this causes issues | ||
3725 | s/$utf8_quote/'/g; | ||
3726 | |||
3727 | if (/$check_build_re/) { | ||
3728 | print OUT; | ||
3729 | } | ||
3730 | } | ||
3731 | close(IN); | ||
3732 | |||
3733 | close(OUT); | ||
3734 | |||
3735 | success $i; | ||
3736 | } | ||
3737 | |||
3645 | $#ARGV < 1 or die "ktest.pl version: $VERSION\n usage: ktest.pl config-file\n"; | 3738 | $#ARGV < 1 or die "ktest.pl version: $VERSION\n usage: ktest.pl config-file\n"; |
3646 | 3739 | ||
3647 | if ($#ARGV == 0) { | 3740 | if ($#ARGV == 0) { |
@@ -3843,9 +3936,9 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3843 | $run_type = $bisect_type; | 3936 | $run_type = $bisect_type; |
3844 | } elsif ($test_type eq "config_bisect") { | 3937 | } elsif ($test_type eq "config_bisect") { |
3845 | $run_type = $config_bisect_type; | 3938 | $run_type = $config_bisect_type; |
3846 | } | 3939 | } elsif ($test_type eq "make_min_config") { |
3847 | 3940 | $run_type = ""; | |
3848 | if ($test_type eq "make_min_config") { | 3941 | } elsif ($test_type eq "make_warnings_file") { |
3849 | $run_type = ""; | 3942 | $run_type = ""; |
3850 | } | 3943 | } |
3851 | 3944 | ||
@@ -3902,10 +3995,15 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) { | |||
3902 | } elsif ($test_type eq "make_min_config") { | 3995 | } elsif ($test_type eq "make_min_config") { |
3903 | make_min_config $i; | 3996 | make_min_config $i; |
3904 | next; | 3997 | next; |
3998 | } elsif ($test_type eq "make_warnings_file") { | ||
3999 | $no_reboot = 1; | ||
4000 | make_warnings_file $i; | ||
4001 | next; | ||
3905 | } | 4002 | } |
3906 | 4003 | ||
3907 | if ($build_type ne "nobuild") { | 4004 | if ($build_type ne "nobuild") { |
3908 | build $build_type or next; | 4005 | build $build_type or next; |
4006 | check_buildlog or next; | ||
3909 | } | 4007 | } |
3910 | 4008 | ||
3911 | if ($test_type eq "install") { | 4009 | if ($test_type eq "install") { |