Skip to content

Commit cf79fab

Browse files
Steven Rostedtrostedt
authored andcommitted
ktest: Fix config bisect with how make oldnoconfig works
With a name like 'oldnoconfig' one may think that the config generated would disable all configs that were not defined (selecting "no" for all options). But this is not the case. It selects the default. If a config has a 'default y', then it is added if not specified. This broke the config bisect, because options not specified by a config will just use the default, where it expected to turn off. This caused an option to be enabled that disabled an option that would break the build. The end result was that we never found the bad config at the end of the test. Instead of using 'make oldnoconfig', ktest now builds the options it expects enabled and disabled. When it turns off an option, it will no longer remove it, but actually set it to: # CONFIG_FOO is not set. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent b091861 commit cf79fab

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

‎tools/testing/ktest/ktest.pl‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@
189189
my %entered_configs;
190190
my %config_help;
191191
my %variable;
192+
193+
# force_config is the list of configs that we force enabled (or disabled)
194+
# in a .config file. The MIN_CONFIG and ADD_CONFIG configs.
192195
my %force_config;
193196

194197
# do not force reboots on config problems
@@ -1837,6 +1840,7 @@ sub make_oldconfig {
18371840
sub load_force_config {
18381841
my ($config) = @_;
18391842

1843+
doprint "Loading force configs from $config\n";
18401844
open(IN, $config) or
18411845
dodie "failed to read $config";
18421846
while (<IN>) {
@@ -2389,9 +2393,24 @@ sub bisect {
23892393
success $i;
23902394
}
23912395

2396+
# config_ignore holds the configs that were set (or unset) for
2397+
# a good config and we will ignore these configs for the rest
2398+
# of a config bisect. These configs stay as they were.
23922399
my %config_ignore;
2400+
2401+
# config_set holds what all configs were set as.
23932402
my %config_set;
23942403

2404+
# config_off holds the set of configs that the bad config had disabled.
2405+
# We need to record them and set them in the .config when running
2406+
# oldnoconfig, because oldnoconfig does not turn off new symbols, but
2407+
# instead just keeps the defaults.
2408+
my %config_off;
2409+
2410+
# config_off_tmp holds a set of configs to turn off for now
2411+
my @config_off_tmp;
2412+
2413+
# config_list is the set of configs that are being tested
23952414
my %config_list;
23962415
my %null_config;
23972416

@@ -2470,6 +2489,16 @@ sub create_config {
24702489
}
24712490
}
24722491

2492+
# turn off configs to keep off
2493+
foreach my $config (keys %config_off) {
2494+
print OUT "# $config is not set\n";
2495+
}
2496+
2497+
# turn off configs that should be off for now
2498+
foreach my $config (@config_off_tmp) {
2499+
print OUT "# $config is not set\n";
2500+
}
2501+
24732502
foreach my $config (keys %config_ignore) {
24742503
print OUT "$config_ignore{$config}\n";
24752504
}
@@ -2551,6 +2580,13 @@ sub run_config_bisect {
25512580
do {
25522581
my @tophalf = @start_list[0 .. $half];
25532582

2583+
# keep the bottom half off
2584+
if ($half < $#start_list) {
2585+
@config_off_tmp = @start_list[$half + 1 .. $#start_list];
2586+
} else {
2587+
@config_off_tmp = ();
2588+
}
2589+
25542590
create_config @tophalf;
25552591
read_current_config \%current_config;
25562592

@@ -2567,7 +2603,11 @@ sub run_config_bisect {
25672603
if (!$found) {
25682604
# try the other half
25692605
doprint "Top half produced no set configs, trying bottom half\n";
2606+
2607+
# keep the top half off
2608+
@config_off_tmp = @tophalf;
25702609
@tophalf = @start_list[$half + 1 .. $#start_list];
2610+
25712611
create_config @tophalf;
25722612
read_current_config \%current_config;
25732613
foreach my $config (@tophalf) {
@@ -2705,6 +2745,10 @@ sub config_bisect {
27052745
$added_configs{$2} = $1;
27062746
$config_list{$2} = $1;
27072747
}
2748+
} elsif (/^# ((CONFIG\S*).*)/) {
2749+
# Keep these configs disabled
2750+
$config_set{$2} = $1;
2751+
$config_off{$2} = $1;
27082752
}
27092753
}
27102754
close(IN);
@@ -2727,6 +2771,8 @@ sub config_bisect {
27272771
my %config_test;
27282772
my $once = 0;
27292773

2774+
@config_off_tmp = ();
2775+
27302776
# Sometimes kconfig does weird things. We must make sure
27312777
# that the config we autocreate has everything we need
27322778
# to test, otherwise we may miss testing configs, or

0 commit comments

Comments
 (0)