mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-01 09:10:03 +00:00
psasim: update bash scripts
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
9022f718b1
commit
f67ded3488
16
tests/psa-client-server/psasim/test/kill_server.sh
Executable file
16
tests/psa-client-server/psasim/test/kill_server.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -e
|
||||
|
||||
pkill psa_server || true
|
||||
|
||||
# Remove temporary files and logs
|
||||
rm -f psa_notify_*
|
||||
rm -f psa_service_*
|
||||
rm -f psa_server.log
|
||||
|
||||
# Remove all IPCs
|
||||
ipcs -q | awk '{ printf " -q " $2 }' | xargs ipcrm > /dev/null 2>&1 || true
|
@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
# This is a simple bash script that tests psa_client/psa_server interaction.
|
||||
# This script is automatically executed when "make run" is launched by the
|
||||
# "psasim" root folder. The script can also be launched manually once
|
||||
# binary files are built (i.e. after "make test" is executed from the "psasim"
|
||||
# root folder).
|
||||
#
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -e
|
||||
|
||||
@ -16,26 +16,10 @@ cd "$(dirname "$0")"
|
||||
CLIENT_BIN=$1
|
||||
shift
|
||||
|
||||
function clean_run() {
|
||||
rm -f psa_notify_*
|
||||
pkill psa_partition || true
|
||||
pkill psa_client || true
|
||||
ipcs | grep q | awk '{ printf " -q " $2 }' | xargs ipcrm > /dev/null 2>&1 || true
|
||||
}
|
||||
ipcs | grep q | awk '{ printf " -q " $2 }' | xargs ipcrm > /dev/null 2>&1 || true
|
||||
|
||||
# The server creates some local files when it starts up so we can wait for this
|
||||
# event as signal that the server is ready so that we can start client(s).
|
||||
function wait_for_server_startup() {
|
||||
while [ ! -f ./psa_notify_* ]; do
|
||||
sleep 0.1
|
||||
done
|
||||
}
|
||||
|
||||
clean_run
|
||||
|
||||
./psa_partition &
|
||||
wait_for_server_startup
|
||||
./start_server.sh
|
||||
./$CLIENT_BIN "$@"
|
||||
|
||||
# Kill server once client exited
|
||||
pkill psa_partition
|
||||
pkill psa_server
|
||||
|
19
tests/psa-client-server/psasim/test/start_server.sh
Executable file
19
tests/psa-client-server/psasim/test/start_server.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright The Mbed TLS Contributors
|
||||
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
|
||||
set -e
|
||||
|
||||
# The server creates some local files when it starts up so we can wait for this
|
||||
# event as signal that the server is ready so that we can start client(s).
|
||||
function wait_for_server_startup() {
|
||||
while [ $(find . -name "psa_notify_*" | wc -l) -eq 0 ]; do
|
||||
sleep 0.1
|
||||
done
|
||||
}
|
||||
|
||||
$(dirname "$0")/kill_server.sh
|
||||
|
||||
$(dirname "$0")/psa_server &
|
||||
wait_for_server_startup
|
Loading…
Reference in New Issue
Block a user