Merge pull request #9427 from valeriosetti/psasim-small-fixes

psasim: small fixes to all.sh and test bash scripts
This commit is contained in:
Tom Cosgrove 2024-08-07 13:13:46 +00:00 committed by GitHub
commit 195e1647b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 35 deletions

View File

@ -7,6 +7,9 @@ set -e
pkill psa_server || true
# Remove temporary files
rm -f psa_notify_*
# Remove all IPCs
# Not just ipcrm -all=msg as it is not supported on macOS.
# Filter out header and empty lines, choosing to select based on keys being

View File

@ -16,10 +16,9 @@ cd "$(dirname "$0")"
CLIENT_BIN=$1
shift
ipcs | grep q | awk '{ printf " -q " $2 }' | xargs ipcrm > /dev/null 2>&1 || true
./kill_servers.sh
./start_server.sh
./$CLIENT_BIN "$@"
# Kill server once client exited
pkill psa_server
./kill_servers.sh

View File

@ -387,8 +387,7 @@ cleanup()
helper_psasim_cleanup_before_client() {
# Clean up library files
make -C library clean
# Clean up intermediate files that were used to build the server
make -C $PSASIM_PATH clean_server_intermediate_files
# Restore files that were backup before building library files. This
# includes $CONFIG_H and $CRYPTO_CONFIG_H.
for x in $files_to_back_up; do

View File

@ -10,37 +10,37 @@
################################################################
# Helper function for controlling (start & stop) the psasim server.
helper_psasim_server () {
helper_psasim_server() {
OPERATION=$1
if [ "$OPERATION" == "start" ]; then
(
cd tests
msg "start server in tests"
psa-client-server/psasim/test/start_server.sh
(
cd tests
../$PSASIM_PATH/test/start_server.sh
)
msg "start server in tf-psa-crypto/tests"
cd ../tf-psa-crypto/tests
../../tests/psa-client-server/psasim/test/start_server.sh
)
(
cd tf-psa-crypto/tests
../../$PSASIM_PATH/test/start_server.sh
)
else
(
msg "terminate servers and cleanup"
tests/psa-client-server/psasim//test/kill_servers.sh
# Remove temporary files and logs
cd tests
rm -f psa_notify_*
rm -f psa_service_*
rm -f psa_server.log
cd ../tf-psa-crypto/tests
rm -f psa_notify_*
rm -f psa_service_*
rm -f psa_server.log
)
msg "terminate server in tests"
(
# This will kill both servers and clean up all the message queues,
# and clear temporary files in tests
cd tests
../$PSASIM_PATH/test/kill_servers.sh
)
msg "terminate server in tf-psa-crypto/tests"
(
# This just clears temporary files in tf-psa-crypto/tests
cd tf-psa-crypto/tests
../../$PSASIM_PATH/test/kill_servers.sh
)
fi
}
component_test_psasim () {
component_test_psasim() {
msg "build server library and application"
scripts/config.py crypto
helper_psasim_config server
@ -53,19 +53,21 @@ component_test_psasim () {
helper_psasim_build client
msg "build basic psasim client"
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_base
make -C $PSASIM_PATH CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_base
msg "test basic psasim client"
tests/psa-client-server/psasim/test/run_test.sh psa_client_base
$PSASIM_PATH/test/run_test.sh psa_client_base
msg "build full psasim client"
make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_full
make -C $PSASIM_PATH CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" test/psa_client_full
msg "test full psasim client"
tests/psa-client-server/psasim/test/run_test.sh psa_client_full
$PSASIM_PATH/test/run_test.sh psa_client_full
make -C tests/psa-client-server/psasim clean
helper_psasim_server kill
make -C $PSASIM_PATH clean
}
component_test_suite_with_psasim () {
component_test_suite_with_psasim()
{
msg "build server library and application"
helper_psasim_config server
# Modify server's library configuration here (if needed)
@ -83,7 +85,6 @@ component_test_suite_with_psasim () {
msg "build test suites"
make PSASIM=1 CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" tests
helper_psasim_server kill
helper_psasim_server start
# psasim takes an extremely long execution time on some test suites so we