Revert "Adapt psasim"

This reverts commit b6f6cc89d08b01eddc1b1f20aa9e6ee56f566bc7.

The usage of files /tmp/ could result in race conditions if
several several are run on the same machine.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2024-07-22 08:48:17 +02:00
parent 3f8275e93a
commit c04c2ed2eb
5 changed files with 8 additions and 8 deletions

View File

@ -77,5 +77,5 @@ clean_server_intermediate_files:
clean: clean_server_intermediate_files clean: clean_server_intermediate_files
rm -f test/psa_client_base test/psa_client_full test/psa_server rm -f test/psa_client_base test/psa_client_full test/psa_server
rm -rf client_libs server_libs rm -rf client_libs server_libs
rm -f test/*.log rm -f test/psa_service_* test/psa_notify_* test/*.log
rm -f test/seedfile rm -f test/seedfile

View File

@ -28,4 +28,4 @@
#define PROJECT_ID 'M' #define PROJECT_ID 'M'
#define PATHNAMESIZE 256 #define PATHNAMESIZE 256
#define TMP_FILE_BASE_PATH "/tmp/" #define TMP_FILE_BASE_PATH "./"

View File

@ -605,9 +605,9 @@ void __init_psasim(const char **array,
key_t key; key_t key;
int qid; int qid;
FILE *fp; FILE *fp;
char doorbell_file[PATHNAMESIZE] = { 0 }; char doorbell_path[PATHNAMESIZE] = { 0 };
char queue_path[PATHNAMESIZE]; char queue_path[PATHNAMESIZE];
snprintf(doorbell_file, PATHNAMESIZE, "psa_notify_%u", getpid()); snprintf(doorbell_path, PATHNAMESIZE, TMP_FILE_BASE_PATH "psa_notify_%u", getpid());
if (library_initialised > 0) { if (library_initialised > 0) {
return; return;
@ -619,7 +619,7 @@ void __init_psasim(const char **array,
FATAL("Unsupported value. Aborting."); FATAL("Unsupported value. Aborting.");
} }
array[3] = doorbell_file; array[3] = doorbell_path;
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
if (strncmp(array[i], "", 1) != 0) { if (strncmp(array[i], "", 1) != 0) {

View File

@ -8,8 +8,8 @@ set -e
pkill psa_server || true pkill psa_server || true
# Remove temporary files and logs # Remove temporary files and logs
rm -f /tmp/psa_notify_* rm -f psa_notify_*
rm -f /tmp/psa_service_* rm -f psa_service_*
rm -f psa_server.log rm -f psa_server.log
# Remove all IPCs # Remove all IPCs

View File

@ -8,7 +8,7 @@ set -e
# The server creates some local files when it starts up so we can wait for this # 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). # event as signal that the server is ready so that we can start client(s).
function wait_for_server_startup() { function wait_for_server_startup() {
while [ -z $(find /tmp -maxdepth 1 -name "psa_notify_*" -printf 1 -quit) ]; do while [ $(find . -name "psa_notify_*" | wc -l) -eq 0 ]; do
sleep 0.1 sleep 0.1
done done
} }