From e2f0e3012af9386ad68bcdf1fd160cc3e18d8920 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Wed, 29 May 2024 12:36:09 +0100 Subject: [PATCH] Extend PSA crypto simulator tests to run psa_hash.c under the simulator Signed-off-by: Tom Cosgrove --- tests/psa-client-server/psasim/Makefile | 4 ++-- tests/scripts/all.sh | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/psa-client-server/psasim/Makefile b/tests/psa-client-server/psasim/Makefile index 45ec45820e..06d3059b4b 100644 --- a/tests/psa-client-server/psasim/Makefile +++ b/tests/psa-client-server/psasim/Makefile @@ -1,4 +1,4 @@ -MAIN ?= client.c +MAIN ?= src/client.c CFLAGS += -Wall -Werror -std=c99 -D_XOPEN_SOURCE=1 -D_POSIX_C_SOURCE=200809L @@ -20,7 +20,7 @@ GENERATED_H_FILES = include/psa_manifest/manifest.h \ include/psa_manifest/sid.h PSA_CLIENT_SRC = src/psa_ff_client.c \ - src/$(MAIN) \ + $(MAIN) \ src/psa_sim_crypto_client.c \ src/psa_sim_serialise.c diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh index e0901711d2..c0abf056bd 100755 --- a/tests/scripts/all.sh +++ b/tests/scripts/all.sh @@ -6232,11 +6232,26 @@ component_test_psasim() { # Delete the executable to ensure we build using the right MAIN rm tests/psa-client-server/psasim/test/psa_client # API under test: psa_hash_compute() - make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="aut_psa_hash_compute.c" + make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="src/aut_psa_hash_compute.c" msg "test psasim running psa_hash_compute" tests/psa-client-server/psasim/test/run_test.sh + # Next APIs under test: psa_hash_*(). Just use the PSA hash example. + aut_psa_hash="../../../programs/psa/psa_hash.c" + if [ -f "tests/psa-client-server/psasim/$aut_psa_hash" ]; then + + msg "build psasim to test all psa_hash_* APIs" + # Delete the executable to ensure we build using the right MAIN + rm tests/psa-client-server/psasim/test/psa_client + make -C tests/psa-client-server/psasim CFLAGS="$ASAN_CFLAGS" LDFLAGS="$ASAN_CFLAGS" MAIN="$aut_psa_hash" + + msg "test psasim running psa_hash sample" + tests/psa-client-server/psasim/test/run_test.sh + else + echo $aut_psa_hash NOT FOUND, so not running that test + fi + msg "clean psasim" make -C tests/psa-client-server/psasim clean }