Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275177
b: refs/heads/master
c: ac6974c
h: refs/heads/master
i:
  275175: 1314e4a
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Oct 17, 2011
1 parent 1e29520 commit 6be9469
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9900b5dc067551fcdcaec63d013b1d95b36835ae
refs/heads/master: ac6974c76e66c2f9b8b8a23b974c5f3d94302e81
71 changes: 49 additions & 22 deletions trunk/tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2372,12 +2372,31 @@ sub patchcheck {
}

my %depends;
my %depcount;
my $iflevel = 0;
my @ifdeps;

# prevent recursion
my %read_kconfigs;

sub add_dep {
# $config depends on $dep
my ($config, $dep) = @_;

if (defined($depends{$config})) {
$depends{$config} .= " " . $dep;
} else {
$depends{$config} = $dep;
}

# record the number of configs depending on $dep
if (defined $depcount{$dep}) {
$depcount{$dep}++;
} else {
$depcount{$dep} = 1;
}
}

# taken from streamline_config.pl
sub read_kconfig {
my ($kconfig) = @_;
Expand Down Expand Up @@ -2424,30 +2443,19 @@ sub read_kconfig {
$config = $2;

for (my $i = 0; $i < $iflevel; $i++) {
if ($i) {
$depends{$config} .= " " . $ifdeps[$i];
} else {
$depends{$config} = $ifdeps[$i];
}
$state = "DEP";
add_dep $config, $ifdeps[$i];
}

# collect the depends for the config
} elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) {

if (defined($depends{$1})) {
$depends{$config} .= " " . $1;
} else {
$depends{$config} = $1;
}
add_dep $config, $1;

# Get the configs that select this config
} elsif ($state ne "NONE" && /^\s*select\s+(\S+)/) {
if (defined($depends{$1})) {
$depends{$1} .= " " . $config;
} else {
$depends{$1} = $config;
}
} elsif ($state eq "NEW" && /^\s*select\s+(\S+)/) {

# selected by depends on config
add_dep $1, $config;

# Check for if statements
} elsif (/^if\s+(.*\S)\s*$/) {
Expand Down Expand Up @@ -2559,11 +2567,18 @@ sub make_new_config {
close OUT;
}

sub chomp_config {
my ($config) = @_;

$config =~ s/CONFIG_//;

return $config;
}

sub get_depends {
my ($dep) = @_;

my $kconfig = $dep;
$kconfig =~ s/CONFIG_//;
my $kconfig = chomp_config $dep;

$dep = $depends{"$kconfig"};

Expand Down Expand Up @@ -2613,8 +2628,7 @@ sub test_this_config {
return undef;
}

my $kconfig = $config;
$kconfig =~ s/CONFIG_//;
my $kconfig = chomp_config $config;

# Test dependencies first
if (defined($depends{"$kconfig"})) {
Expand Down Expand Up @@ -2704,6 +2718,14 @@ sub make_min_config {

my @config_keys = keys %min_configs;

# All configs need a depcount
foreach my $config (@config_keys) {
my $kconfig = chomp_config $config;
if (!defined $depcount{$kconfig}) {
$depcount{$kconfig} = 0;
}
}

# Remove anything that was set by the make allnoconfig
# we shouldn't need them as they get set for us anyway.
foreach my $config (@config_keys) {
Expand Down Expand Up @@ -2742,8 +2764,13 @@ sub make_min_config {
# Now disable each config one by one and do a make oldconfig
# till we find a config that changes our list.

# Put configs that did not modify the config at the end.
my @test_configs = keys %min_configs;

# Sort keys by who is most dependent on
@test_configs = sort { $depcount{chomp_config($b)} <=> $depcount{chomp_config($a)} }
@test_configs ;

# Put configs that did not modify the config at the end.
my $reset = 1;
for (my $i = 0; $i < $#test_configs; $i++) {
if (!defined($nochange_config{$test_configs[0]})) {
Expand Down

0 comments on commit 6be9469

Please sign in to comment.