Valerio Setti | f67ded3 | 2024-06-27 08:03:32 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright The Mbed TLS Contributors |
| 4 | # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later |
| 5 | |
| 6 | set -e |
| 7 | |
| 8 | # The server creates some local files when it starts up so we can wait for this |
| 9 | # event as signal that the server is ready so that we can start client(s). |
| 10 | function wait_for_server_startup() { |
Valerio Setti | 405d4ad | 2025-04-08 14:04:57 +0200 | [diff] [blame^] | 11 | SECONDS=0 |
| 12 | TIMEOUT=10 |
| 13 | |
Ronald Cron | c04c2ed | 2024-07-22 08:48:17 +0200 | [diff] [blame] | 14 | while [ $(find . -name "psa_notify_*" | wc -l) -eq 0 ]; do |
Valerio Setti | 405d4ad | 2025-04-08 14:04:57 +0200 | [diff] [blame^] | 15 | if [ "$SECONDS" -ge "$TIMEOUT" ]; then |
| 16 | echo "Timeout: psa_server not started within $TIMEOUT seconds." |
| 17 | return 1 |
| 18 | fi |
Valerio Setti | f67ded3 | 2024-06-27 08:03:32 +0200 | [diff] [blame] | 19 | sleep 0.1 |
| 20 | done |
| 21 | } |
| 22 | |
Valerio Setti | f67ded3 | 2024-06-27 08:03:32 +0200 | [diff] [blame] | 23 | $(dirname "$0")/psa_server & |
| 24 | wait_for_server_startup |