add wolfcrypt_test() to unit_test(); remove call to HashTest() and delete

tests/hash.c (entire file duplicates code in wolfcrypt/test/test.c, originally
  ctaocrypt/test/test.c).
This commit is contained in:
Daniel Pouzzner
2025-03-11 14:59:07 -05:00
parent 2de3d46971
commit 9a84dfc86a
5 changed files with 40 additions and 1060 deletions

View File

@ -2538,7 +2538,6 @@ if(WOLFSSL_EXAMPLES)
tests/api/test_dtls.c
tests/api/test_ocsp.c
tests/api/test_evp.c
tests/hash.c
tests/srp.c
tests/suites.c
tests/w64wrapper.c
@ -2547,7 +2546,8 @@ if(WOLFSSL_EXAMPLES)
tests/utils.c
testsuite/utils.c
examples/server/server.c
examples/client/client.c)
examples/client/client.c
wolfcrypt/test/test.c)
target_include_directories(unit_test PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
target_compile_options(unit_test PUBLIC "-DNO_MAIN_DRIVER")

File diff suppressed because it is too large Load Diff

View File

@ -11,12 +11,16 @@ tests_unit_test_SOURCES = \
tests/utils.c \
testsuite/utils.c \
tests/suites.c \
tests/hash.c \
tests/w64wrapper.c \
tests/srp.c \
tests/quic.c \
examples/client/client.c \
examples/server/server.c
if BUILD_WOLFCRYPT_TESTS
tests_unit_test_SOURCES += wolfcrypt/test/test.c
endif
tests_unit_test_CFLAGS = -DNO_MAIN_DRIVER $(AM_CFLAGS) $(WOLFSENTRY_INCLUDE)
tests_unit_test_LDADD = src/libwolfssl@LIBSUFFIX@.la $(LIB_STATIC_ADD) $(WOLFSENTRY_LIB)
tests_unit_test_DEPENDENCIES = src/libwolfssl@LIBSUFFIX@.la

View File

@ -29,6 +29,10 @@
#include <stdio.h>
#include <wolfssl/wolfcrypt/fips_test.h>
#ifndef NO_CRYPT_TEST
#include <wolfssl/test.h>
#include "wolfcrypt/test/test.h"
#endif
int allTesting = 1;
int apiTesting = 1;
@ -218,6 +222,34 @@ int unit_test(int argc, char** argv)
argv++;
}
#ifndef NO_CRYPT_TEST
/* wc_ test */
if (allTesting) {
func_args wc_args;
printf("\nwolfCrypt unit test:\n");
if ((ret = wolfCrypt_Init()) != 0) {
fprintf(stderr, "wolfCrypt_Init failed: %d\n", (int)ret);
goto exit;
}
XMEMSET(&wc_args, 0, sizeof(wc_args));
wolfcrypt_test(&wc_args);
if (wc_args.return_code != 0) {
ret = 1;
goto exit;
}
if ((ret = wolfCrypt_Cleanup()) != 0) {
fprintf(stderr, "wolfCrypt_Cleanup failed: %d\n", (int)ret);
goto exit;
}
printf("wolfCrypt unit test completed successfully.\n\n");
}
#endif
#ifdef WOLFSSL_ALLOW_SKIP_UNIT_TESTS
if (argc == 1)
#endif
@ -232,11 +264,6 @@ int unit_test(int argc, char** argv)
goto exit;
}
if ((ret = HashTest()) != 0) {
fprintf(stderr, "hash test failed with %d\n", ret);
goto exit;
}
#ifdef WOLFSSL_W64_WRAPPER
if ((ret = w64wrapper_test()) != 0) {
fprintf(stderr, "w64wrapper test failed with %d\n", ret);
@ -246,7 +273,7 @@ int unit_test(int argc, char** argv)
#ifdef WOLFSSL_QUIC
if ((ret = QuicTest()) != 0) {
printf("quic test failed with %d\n", ret);
fprintf(stderr, "quic test failed with %d\n", ret);
goto exit;
}
#endif

View File

@ -419,7 +419,6 @@ int ApiTest_RunName(char* name);
int ApiTest(void);
int SuiteTest(int argc, char** argv);
int HashTest(void);
void SrpTest(void);
int w64wrapper_test(void);
int QuicTest(void);