Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ktest: Fix bug when ADD_CONFIG is set but MIN_CONFIG is not

The MIN_CONFIG is a single config that is considered to have all the
configs that are required to boot the box.

ADD_CONFIG is a list of configs that we add that may contain configs
known to be broken (set off) or just configs that we want every box to
have and this can include shared configs.

If a config has no MIN_CONFIG defined, but has multiple files defined
for the ADD_CONFIG, the test will die, because the MIN_CONFIG will
default to ADD_CONFIG. The problem is the code to open MIN_CONFIG
expects a string of one file, not multiple, and the open will fail.

Since the real minconfig that is used is a concatination of MIN_CONFIG
and ADD_CONFIG files, we change the code to open that instead of
whatever MIN_CONFIG defaults to.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Steven Rostedt and committed by
Steven Rostedt
250bae8b 43d1b651

+7 -12
+7 -12
tools/testing/ktest/ktest.pl
··· 1970 1970 unlink $tmpconfig; 1971 1971 } 1972 1972 1973 - # Add other configs 1974 - if (defined($addconfig)) { 1975 - run_command "cat $addconfig >> $tmpconfig" or 1976 - dodie "failed to append $addconfig"; 1977 - } 1978 - 1979 1973 if (-f $tmpconfig) { 1980 1974 load_force_config($tmpconfig); 1981 1975 process_config_ignore $tmpconfig; ··· 1991 1997 } 1992 1998 close(IN); 1993 1999 1994 - # Now run oldconfig with the minconfig (and addconfigs) 2000 + # Now run oldconfig with the minconfig 1995 2001 make_oldconfig; 1996 2002 1997 2003 # check to see what we lost (or gained) ··· 2895 2901 unlink $dmesg; 2896 2902 unlink $buildlog; 2897 2903 2898 - if (!defined($minconfig)) { 2899 - $minconfig = $addconfig; 2900 - 2901 - } elsif (defined($addconfig)) { 2902 - run_command "cat $addconfig $minconfig > $tmpdir/add_config" or 2904 + if (defined($addconfig)) { 2905 + my $min = $minconfig; 2906 + if (!defined($minconfig)) { 2907 + $min = ""; 2908 + } 2909 + run_command "cat $addconfig $min > $tmpdir/add_config" or 2903 2910 dodie "Failed to create temp config"; 2904 2911 $minconfig = "$tmpdir/add_config"; 2905 2912 }