aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-03-16 10:15:47 -0400
committerPaul Selkirk <paul@psgd.org>2016-03-16 10:15:47 -0400
commit79559c5041835ce6835a35265a97e291789ec0b0 (patch)
treea80ca837adce158a632633922e2e8786f0558871 /tests
parent8db1d753745bb7b253cf969ff2fb32464b601bf5 (diff)
Added serial RPC transport and lots more...
Added RPC function to get server version number. Substantially reworked GNUMakefile with conditionals. Renamed rpc_*() and xdr_*() to hal_*() for consistency. Moved hal_io_fmc.c from stm32 repo.
Diffstat (limited to 'tests')
-rw-r--r--tests/GNUmakefile18
-rw-r--r--tests/test-rpc_hash.c7
-rw-r--r--tests/test-rpc_server.c10
3 files changed, 22 insertions, 13 deletions
diff --git a/tests/GNUmakefile b/tests/GNUmakefile
index 2f026a1..b4d006d 100644
--- a/tests/GNUmakefile
+++ b/tests/GNUmakefile
@@ -29,8 +29,22 @@
INC = ../hal.h
LIB = ../libhal.a
-BIN = test-aes-key-wrap test-hash test-pbkdf2 test-ecdsa test-bus test-trng test-rsa
-BIN += test-rpc_hash test-rpc_server
+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
+endif
+ifdef RPC_SERVER
+ BIN += test-rpc_server
+endif
CFLAGS = -g3 -Wall -fPIC -std=c99 -I..
diff --git a/tests/test-rpc_hash.c b/tests/test-rpc_hash.c
index d59e341..38bb793 100644
--- a/tests/test-rpc_hash.c
+++ b/tests/test-rpc_hash.c
@@ -636,11 +636,10 @@ static int _test_hmac(const hal_digest_algorithm_t alg,
int main (int argc, char *argv[])
{
-// rpc_client_init(RPC_LOCAL);
- rpc_client_init(RPC_REMOTE);
-
int ok = 1;
+ ok &= hal_rpc_client_init();
+
ok &= test_hash(hal_digest_algorithm_sha1, nist_512_single, sha1_single_digest, "SHA-1 single block");
ok &= test_hash(hal_digest_algorithm_sha1, nist_512_double, sha1_double_digest, "SHA-1 double block");
@@ -688,6 +687,8 @@ int main (int argc, char *argv[])
ok &= test_hmac(hal_digest_algorithm_sha512, hmac_sha2_tc_6_key, hmac_sha2_tc_6_data, hmac_sha2_tc_6_result_sha512, "HMAC-SHA-512 test case 6");
ok &= test_hmac(hal_digest_algorithm_sha512, hmac_sha2_tc_7_key, hmac_sha2_tc_7_data, hmac_sha2_tc_7_result_sha512, "HMAC-SHA-512 test case 7");
+ ok &= hal_rpc_client_close();
+
return !ok;
}
diff --git a/tests/test-rpc_server.c b/tests/test-rpc_server.c
index 6eff755..eb11f6d 100644
--- a/tests/test-rpc_server.c
+++ b/tests/test-rpc_server.c
@@ -1,16 +1,10 @@
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <assert.h>
-
#include <hal.h>
-#include <hal_internal.h>
int main (int argc, char *argv[])
{
- if (rpc_server_init() != HAL_OK)
+ if (hal_rpc_server_init() != HAL_OK)
return 1;
- rpc_server_main();
+ hal_rpc_server_main();
return 0;
}