Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psasim: small fixes to all.sh and test bash scripts #9427

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tests/psa-client-server/psasim/test/kill_servers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions tests/psa-client-server/psasim/test/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions tests/scripts/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,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
Expand Down
61 changes: 31 additions & 30 deletions tests/scripts/components-psasim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
tom-cosgrove-arm marked this conversation as resolved.
Show resolved Hide resolved
)
fi
}

component_test_psasim () {
component_test_psasim() {
msg "build server library and application"
scripts/config.py crypto
helper_psasim_config server
Expand All @@ -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)
Expand All @@ -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
Expand Down