Support negative dependencies in test cases

The entropy test suite uses a negative dependency "depends_on:!CONFIG_FLAG" for one of its tests. This kind of
dependency (running a test only if some configuration flag is not defined) is currently not supported and instead
results in the respective test case being dropped.

This commit adds support for negative dependencies in test cases.
This commit is contained in:
Hanno Becker 2017-07-23 10:24:22 +01:00
parent 75efa79201
commit f058f34b5a

View file

@ -312,7 +312,7 @@ END
# and make check code # and make check code
my $dep_check_code; my $dep_check_code;
my @res = $test_data =~ /^depends_on:([\w:]+)/msg; my @res = $test_data =~ /^depends_on:([!:\w]+)/msg;
my %case_deps; my %case_deps;
foreach my $deps (@res) foreach my $deps (@res)
{ {
@ -322,6 +322,22 @@ foreach my $deps (@res)
} }
} }
while( my ($key, $value) = each(%case_deps) ) while( my ($key, $value) = each(%case_deps) )
{
if( substr($key, 0, 1) eq "!" )
{
my $key = substr($key, 1);
$dep_check_code .= << "END";
if( strcmp( str, "!$key" ) == 0 )
{
#if !defined($key)
return( DEPENDENCY_SUPPORTED );
#else
return( DEPENDENCY_NOT_SUPPORTED );
#endif
}
END
}
else
{ {
$dep_check_code .= << "END"; $dep_check_code .= << "END";
if( strcmp( str, "$key" ) == 0 ) if( strcmp( str, "$key" ) == 0 )
@ -334,6 +350,7 @@ while( my ($key, $value) = each(%case_deps) )
} }
END END
} }
}
# Make mapping code # Make mapping code
while( my ($key, $value) = each(%mapping_values) ) while( my ($key, $value) = each(%mapping_values) )