Skip to content

Commit e3283ed

Browse files
test-ref-configs.pl: Detect automatically test with USE_PSA enabled
Change the way we decide if for a given configuration we need to run tests with and without MBEDTLS_USE_PSA_CRYPTO enabled. That makes the script suitable for 3.6 and development branch. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
1 parent f47f545 commit e3283ed

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/scripts/test-ref-configs.pl

+11-7
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,25 @@
1818
my %configs = (
1919
'config-ccm-psk-tls1_2.h' => {
2020
'compat' => '-m tls12 -f \'^TLS_PSK_WITH_AES_..._CCM_8\'',
21-
'test_again_with_use_psa' => 1
2221
},
2322
'config-ccm-psk-dtls1_2.h' => {
2423
'compat' => '-m dtls12 -f \'^TLS_PSK_WITH_AES_..._CCM_8\'',
2524
'opt' => ' ',
2625
'opt_needs_debug' => 1,
27-
'test_again_with_use_psa' => 1
2826
},
2927
'config-no-entropy.h' => {
3028
},
3129
'config-suite-b.h' => {
3230
'compat' => "-m tls12 -f 'ECDHE_ECDSA.*AES.*GCM' -p mbedTLS",
33-
'test_again_with_use_psa' => 1,
3431
'opt' => ' ',
3532
'opt_needs_debug' => 1,
3633
},
3734
'config-symmetric-only.h' => {
38-
'test_again_with_use_psa' => 0, # Uses PSA by default, no need to test it twice
3935
},
4036
'config-tfm.h' => {
41-
'test_again_with_use_psa' => 0, # Uses PSA by default, no need to test it twice
4237
},
4338
'config-thread.h' => {
4439
'opt' => '-f ECJPAKE.*nolog',
45-
'test_again_with_use_psa' => 1,
4640
},
4741
);
4842

@@ -148,7 +142,17 @@ sub perform_test {
148142
}
149143

150144
foreach my $conf ( @configs_to_test ) {
151-
my $test_with_psa = $configs{$conf}{'test_again_with_use_psa'};
145+
my $test_with_psa = 0;
146+
147+
open(CONFIG_FILE, "<", "configs/$conf") or die "Opening config file '$conf': $!";
148+
while (my $line = <CONFIG_FILE>) {
149+
if ($line =~ /^\/\/#define MBEDTLS_USE_PSA_CRYPTO/) {
150+
$test_with_psa = 1;
151+
last;
152+
}
153+
}
154+
close(CONFIG_FILE);
155+
152156
if ( $test_with_psa )
153157
{
154158
perform_test( $conf, $configs{$conf}, $test_with_psa );

0 commit comments

Comments
 (0)