blob: 1249930af1727e2072a07e48fef7c2c8b63d86d3 [file] [log] [blame]
Valerio Settif67ded32024-06-27 08:03:32 +02001#!/bin/bash
2
3# Copyright The Mbed TLS Contributors
4# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
5
6set -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).
10function wait_for_server_startup() {
Valerio Setti405d4ad2025-04-08 14:04:57 +020011 SECONDS=0
12 TIMEOUT=10
13
Ronald Cronc04c2ed2024-07-22 08:48:17 +020014 while [ $(find . -name "psa_notify_*" | wc -l) -eq 0 ]; do
Valerio Setti405d4ad2025-04-08 14:04:57 +020015 if [ "$SECONDS" -ge "$TIMEOUT" ]; then
16 echo "Timeout: psa_server not started within $TIMEOUT seconds."
17 return 1
18 fi
Valerio Settif67ded32024-06-27 08:03:32 +020019 sleep 0.1
20 done
21}
22
Valerio Settif67ded32024-06-27 08:03:32 +020023$(dirname "$0")/psa_server &
24wait_for_server_startup