From b30cd3bb8f57e0c478a6dc14d4785fa08541a61d Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Fri, 17 May 2024 14:11:31 +0200 Subject: [PATCH] Improve test-ref-configs.pl Signed-off-by: Ronald Cron --- tests/scripts/test-ref-configs.pl | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/scripts/test-ref-configs.pl b/tests/scripts/test-ref-configs.pl index edd778a11d..5557de3276 100755 --- a/tests/scripts/test-ref-configs.pl +++ b/tests/scripts/test-ref-configs.pl @@ -142,16 +142,9 @@ sub perform_test { } foreach my $conf ( @configs_to_test ) { - my $test_with_psa = 0; - - open(CONFIG_FILE, "<", "configs/$conf") or die "Opening config file '$conf': $!"; - while (my $line = ) { - if ($line =~ /^\/\/#define MBEDTLS_USE_PSA_CRYPTO/) { - $test_with_psa = 1; - last; - } - } - close(CONFIG_FILE); + system("grep '//#define MBEDTLS_USE_PSA_CRYPTO' configs/$conf > /dev/null"); + die "grep ... configs/$conf: $!" if $? != 0 && $? != 0x100; + my $test_with_psa = $? == 0; if ( $test_with_psa ) {