Set meaningful test configuration names when running tests

Set MBEDTLS_TEST_PLATFORM and MBEDTLS_TEST_CONFIGURATION to meaningful
values in all.sh. These environment variables are used when
writing an outcome file, which happens if MBEDTLS_TEST_OUTCOME_FILE is
also set.

When running one of the try-multiple-configuration scripts, set
MBEDTLS_TEST_CONFIGURATION to a value that uniquely describes the
configuration.
This commit is contained in:
Gilles Peskine 2019-09-16 15:20:36 +02:00
parent 654bab7635
commit 9004a1768b
6 changed files with 9 additions and 0 deletions

View File

@ -121,6 +121,9 @@ pre_initialize_variables () {
FORCE=0 FORCE=0
KEEP_GOING=0 KEEP_GOING=0
: ${MBEDTLS_TEST_PLATFORM="$(uname -s | tr -c \\n0-9A-Za-z _)-$(uname -m | tr -c \\n0-9A-Za-z _)"}
export MBEDTLS_TEST_PLATFORM
# Default commands, can be overridden by the environment # Default commands, can be overridden by the environment
: ${OPENSSL:="openssl"} : ${OPENSSL:="openssl"}
: ${OPENSSL_LEGACY:="$OPENSSL"} : ${OPENSSL_LEGACY:="$OPENSSL"}
@ -1424,6 +1427,7 @@ run_component () {
# The cleanup function will restore it. # The cleanup function will restore it.
cp -p "$CONFIG_H" "$CONFIG_BAK" cp -p "$CONFIG_H" "$CONFIG_BAK"
current_component="$1" current_component="$1"
export MBEDTLS_TEST_CONFIGURATION="$current_component"
"$@" "$@"
cleanup cleanup
} }

View File

@ -51,6 +51,7 @@ for my $curve (@curves) {
print "\n******************************************\n"; print "\n******************************************\n";
print "* Testing without curve: $curve\n"; print "* Testing without curve: $curve\n";
print "******************************************\n"; print "******************************************\n";
$ENV{MBEDTLS_TEST_CONFIGURATION} = "-$curve";
system( "scripts/config.pl unset $curve" ) system( "scripts/config.pl unset $curve" )
and abort "Failed to disable $curve\n"; and abort "Failed to disable $curve\n";

View File

@ -57,6 +57,7 @@ for my $hash (@hashes) {
print "\n******************************************\n"; print "\n******************************************\n";
print "* Testing without hash: $hash\n"; print "* Testing without hash: $hash\n";
print "******************************************\n"; print "******************************************\n";
$ENV{MBEDTLS_TEST_CONFIGURATION} = "-$hash";
system( "scripts/config.pl unset $hash" ) system( "scripts/config.pl unset $hash" )
and abort "Failed to disable $hash\n"; and abort "Failed to disable $hash\n";

View File

@ -72,6 +72,7 @@ while( my ($alg, $extras) = each %algs ) {
print "\n******************************************\n"; print "\n******************************************\n";
print "* Testing without alg: $alg\n"; print "* Testing without alg: $alg\n";
print "******************************************\n"; print "******************************************\n";
$ENV{MBEDTLS_TEST_CONFIGURATION} = "-$alg";
system( "scripts/config.pl unset $alg" ) system( "scripts/config.pl unset $alg" )
and abort "Failed to disable $alg\n"; and abort "Failed to disable $alg\n";

View File

@ -45,6 +45,7 @@ for my $kex (@kexes) {
print "\n******************************************\n"; print "\n******************************************\n";
print "* Testing with key exchange: $kex\n"; print "* Testing with key exchange: $kex\n";
print "******************************************\n"; print "******************************************\n";
$ENV{MBEDTLS_TEST_CONFIGURATION} = "-$kex";
# full config with all key exchanges disabled except one # full config with all key exchanges disabled except one
system( "scripts/config.pl full" ) and abort "Failed config full\n"; system( "scripts/config.pl full" ) and abort "Failed config full\n";

View File

@ -65,6 +65,7 @@ while( my ($conf, $data) = each %configs ) {
print "\n******************************************\n"; print "\n******************************************\n";
print "* Testing configuration: $conf\n"; print "* Testing configuration: $conf\n";
print "******************************************\n"; print "******************************************\n";
$ENV{MBEDTLS_TEST_CONFIGURATION} = "$conf";
system( "cp configs/$conf $config_h" ) system( "cp configs/$conf $config_h" )
and abort "Failed to activate $conf\n"; and abort "Failed to activate $conf\n";