Skip to content

Commit b2e32fd

Browse files
components-configuration-crypto: Migrated components to cmakes' CMAKE_BUILD_TYPE:String=None
Improve compilation flag granularity by disabling CMAKE_BUILD_TYPE defaults and asserting test-specific flags manually. Signed-off-by: Minos Galanakis <[email protected]>
1 parent 069849c commit b2e32fd

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tests/scripts/components-configuration-crypto.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,18 @@ component_test_crypto_for_psa_service () {
507507
scripts/config.py unset MBEDTLS_PK_C
508508
scripts/config.py unset MBEDTLS_PK_PARSE_C
509509
scripts/config.py unset MBEDTLS_PK_WRITE_C
510-
$MAKE_COMMAND CFLAGS='-O1 -Werror' all test
510+
CFLAGS="-O1" cmake -D CMAKE_BUILD_TYPE:String=None .
511+
cmake --build .
512+
make test
511513
are_empty_libraries library/libmbedx509.* library/libmbedtls.*
512514
}
513515

514516
component_build_crypto_baremetal () {
515517
msg "build: make, crypto only, baremetal config"
516518
scripts/config.py crypto_baremetal
517-
$MAKE_COMMAND CFLAGS="-O1 -Werror -I$PWD/framework/tests/include/baremetal-override/"
519+
CFLAGS="-O1 -I$PWD/framework/tests/include/baremetal-override/" cmake -D CMAKE_BUILD_TYPE:String=None .
520+
cmake --build .
521+
make test
518522
are_empty_libraries library/libmbedx509.* library/libmbedtls.*
519523
}
520524

@@ -2067,13 +2071,14 @@ END
20672071
END
20682072

20692073
msg "all loops unrolled"
2070-
$MAKE_COMMAND clean
2071-
make -C tests ../tf-psa-crypto/tests/test_suite_shax CFLAGS="-DMBEDTLS_SHA3_THETA_UNROLL=1 -DMBEDTLS_SHA3_PI_UNROLL=1 -DMBEDTLS_SHA3_CHI_UNROLL=1 -DMBEDTLS_SHA3_RHO_UNROLL=1"
2074+
CFLAGS="-DMBEDTLS_SHA3_THETA_UNROLL=1 -DMBEDTLS_SHA3_PI_UNROLL=1 -DMBEDTLS_SHA3_CHI_UNROLL=1 -DMBEDTLS_SHA3_RHO_UNROLL=1" cmake -D CMAKE_BUILD_TYPE:String=None .
2075+
cmake --build .
20722076
./tf-psa-crypto/tests/test_suite_shax
20732077

20742078
msg "all loops rolled up"
2075-
$MAKE_COMMAND clean
2076-
make -C tests ../tf-psa-crypto/tests/test_suite_shax CFLAGS="-DMBEDTLS_SHA3_THETA_UNROLL=0 -DMBEDTLS_SHA3_PI_UNROLL=0 -DMBEDTLS_SHA3_CHI_UNROLL=0 -DMBEDTLS_SHA3_RHO_UNROLL=0"
2079+
cmake --build . --target clean
2080+
CFLAGS="-DMBEDTLS_SHA3_THETA_UNROLL=0 -DMBEDTLS_SHA3_PI_UNROLL=0 -DMBEDTLS_SHA3_CHI_UNROLL=0 -DMBEDTLS_SHA3_RHO_UNROLL=0" cmake -D CMAKE_BUILD_TYPE:String=None .
2081+
cmake --build .
20772082
./tf-psa-crypto/tests/test_suite_shax
20782083
}
20792084

@@ -2230,8 +2235,10 @@ helper_block_cipher_no_decrypt_build_test () {
22302235
[ -n "$unset_opts" ] && echo "Disabling: $unset_opts" && scripts/config.py unset-all $unset_opts
22312236

22322237
msg "build: default config + BLOCK_CIPHER_NO_DECRYPT${set_opts:+ + $set_opts}${unset_opts:+ - $unset_opts} with $cflags${ldflags:+, $ldflags}"
2233-
$MAKE_COMMAND clean
2234-
$MAKE_COMMAND CFLAGS="-O2 $cflags" LDFLAGS="$ldflags"
2238+
2239+
make -f ./scripts/legacy.make clean
2240+
CFLAGS="-O2 $cflags" LDFLAGS="$ldflags" cmake -D CMAKE_BUILD_TYPE:String=None .
2241+
cmake --build .
22352242

22362243
# Make sure we don't have mbedtls_xxx_setkey_dec in AES/ARIA/CAMELLIA
22372244
not grep mbedtls_aes_setkey_dec ${BUILTIN_SRC_PATH}/aes.o
@@ -2243,7 +2250,7 @@ helper_block_cipher_no_decrypt_build_test () {
22432250
not grep mbedtls_aesni_inverse_key ${BUILTIN_SRC_PATH}/aesni.o
22442251

22452252
msg "test: default config + BLOCK_CIPHER_NO_DECRYPT${set_opts:+ + $set_opts}${unset_opts:+ - $unset_opts} with $cflags${ldflags:+, $ldflags}"
2246-
$MAKE_COMMAND test
2253+
make test
22472254

22482255
msg "selftest: default config + BLOCK_CIPHER_NO_DECRYPT${set_opts:+ + $set_opts}${unset_opts:+ - $unset_opts} with $cflags${ldflags:+, $ldflags}"
22492256
programs/test/selftest

0 commit comments

Comments
 (0)