aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/GNUmakefile40
-rw-r--r--tests/test-rsa.c2
2 files changed, 25 insertions, 17 deletions
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index 65c7a25..f4299a0 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -29,21 +29,27 @@
INC = ../hal.h
LIB = ../libhal.a
-BIN := test-aes-key-wrap test-hash test-pbkdf2 test-ecdsa test-bus test-trng test-rsa
-ifndef RPC_SERVER
- ifdef RPC_CLIENT
- ifneq (${RPC_CLIENT},local)
- # If we're only building a remote RPC client lib, don't include
- # tests that access the FPGA cores.
- BIN :=
- endif
- endif
-endif
-ifdef RPC_CLIENT
- BIN += test-rpc_hash test-rpc_pkey test-rpc_get_version test-rpc_get_random
-endif
-ifdef RPC_SERVER
- BIN += test-rpc_server
+
+# Which tests to build depends on how the library was compiled.
+
+CORE_TESTS = test-aes-key-wrap test-hash test-pbkdf2 test-ecdsa test-bus test-trng test-rsa test-mkmif
+SERVER_TESTS = test-rpc_server
+CLIENT_TESTS = test-rpc_hash test-rpc_pkey test-rpc_get_version test-rpc_get_random
+
+ALL_TESTS = ${CORE_TESTS} ${SERVER_TESTS} ${CLIENT_TESTS}
+
+ifeq "${RPC_MODE}" "none"
+
+ BIN += ${CORE_TESTS}
+
+else ifeq "${RPC_MODE}" "server"
+
+ BIN += ${CORE_TESTS} ${SERVER_TESTS}
+
+else
+
+ BIN += ${CLIENT_TESTS}
+
endif
CFLAGS = -g3 -Wall -fPIC -std=c99 -I..
@@ -53,8 +59,8 @@ all: ${BIN}
test: all
for i in ${BIN}; do (set -x; ./$$i); done
-clean:
- rm -f *.o ${BIN}
+clean distclean:
+ rm -f *.o ${ALL_TESTS}
${BIN}: %: %.o ${LIB}
${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
diff --git a/tests/test-rsa.c b/tests/test-rsa.c
index 1fc516b..60fe2a5 100644
--- a/tests/test-rsa.c
+++ b/tests/test-rsa.c
@@ -299,6 +299,8 @@ static int test_rsa(const hal_core_t *core, const rsa_tc_t * const tc)
int main(int argc, char *argv[])
{
const hal_core_t *core = hal_core_find(MODEXPS6_NAME, NULL);
+ if (core == NULL)
+ core = hal_core_find(MODEXPA7_NAME, NULL);
const hal_core_info_t *core_info = hal_core_info(core);
if (core_info != NULL)