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>
diff --git a/tests/psa-client-server/psasim/Makefile b/tests/psa-client-server/psasim/Makefile
index c23017f..ec6691f 100644
--- a/tests/psa-client-server/psasim/Makefile
+++ b/tests/psa-client-server/psasim/Makefile
@@ -77,5 +77,5 @@
clean: clean_server_intermediate_files
rm -f test/psa_client_base test/psa_client_full test/psa_server
rm -rf client_libs server_libs
- rm -f test/*.log
+ rm -f test/psa_service_* test/psa_notify_* test/*.log
rm -f test/seedfile
diff --git a/tests/psa-client-server/psasim/include/util.h b/tests/psa-client-server/psasim/include/util.h
index bbff3ca..5eb8238 100644
--- a/tests/psa-client-server/psasim/include/util.h
+++ b/tests/psa-client-server/psasim/include/util.h
@@ -28,4 +28,4 @@
#define PROJECT_ID 'M'
#define PATHNAMESIZE 256
-#define TMP_FILE_BASE_PATH "/tmp/"
+#define TMP_FILE_BASE_PATH "./"
diff --git a/tests/psa-client-server/psasim/src/psa_ff_server.c b/tests/psa-client-server/psasim/src/psa_ff_server.c
index 00c5272..b106092 100644
--- a/tests/psa-client-server/psasim/src/psa_ff_server.c
+++ b/tests/psa-client-server/psasim/src/psa_ff_server.c
@@ -605,9 +605,9 @@
key_t key;
int qid;
FILE *fp;
- char doorbell_file[PATHNAMESIZE] = { 0 };
+ char doorbell_path[PATHNAMESIZE] = { 0 };
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) {
return;
@@ -619,7 +619,7 @@
FATAL("Unsupported value. Aborting.");
}
- array[3] = doorbell_file;
+ array[3] = doorbell_path;
for (int i = 0; i < 32; i++) {
if (strncmp(array[i], "", 1) != 0) {
diff --git a/tests/psa-client-server/psasim/test/kill_server.sh b/tests/psa-client-server/psasim/test/kill_server.sh
index 0425282..7aba5a3 100755
--- a/tests/psa-client-server/psasim/test/kill_server.sh
+++ b/tests/psa-client-server/psasim/test/kill_server.sh
@@ -8,8 +8,8 @@
pkill psa_server || true
# Remove temporary files and logs
-rm -f /tmp/psa_notify_*
-rm -f /tmp/psa_service_*
+rm -f psa_notify_*
+rm -f psa_service_*
rm -f psa_server.log
# Remove all IPCs
diff --git a/tests/psa-client-server/psasim/test/start_server.sh b/tests/psa-client-server/psasim/test/start_server.sh
index 58ab850..fcc8a97 100755
--- a/tests/psa-client-server/psasim/test/start_server.sh
+++ b/tests/psa-client-server/psasim/test/start_server.sh
@@ -8,7 +8,7 @@
# 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 [ -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
done
}