From 64f096d264c31d21c166f157a109d2aa71849c2c Mon Sep 17 00:00:00 2001 From: Enjia Mai Date: Mon, 22 Aug 2022 10:07:21 +0800 Subject: [PATCH] tests: crypto: move the tinycrypt_hmac_prng test to new ztest API Migrate the testsuite tests/crypto/tinycrypt_hmac_prng to the new ztest API. Signed-off-by: Enjia Mai --- tests/crypto/tinycrypt_hmac_prng/prj.conf | 1 + tests/crypto/tinycrypt_hmac_prng/src/hmac_prng.c | 4 +++- tests/crypto/tinycrypt_hmac_prng/src/main.c | 16 ---------------- 3 files changed, 4 insertions(+), 17 deletions(-) delete mode 100644 tests/crypto/tinycrypt_hmac_prng/src/main.c diff --git a/tests/crypto/tinycrypt_hmac_prng/prj.conf b/tests/crypto/tinycrypt_hmac_prng/prj.conf index 8e3d3dbd042..718b2bb5dc2 100644 --- a/tests/crypto/tinycrypt_hmac_prng/prj.conf +++ b/tests/crypto/tinycrypt_hmac_prng/prj.conf @@ -4,3 +4,4 @@ CONFIG_TINYCRYPT_SHA256=y CONFIG_TINYCRYPT_SHA256_HMAC=y CONFIG_TINYCRYPT_SHA256_HMAC_PRNG=y CONFIG_ZTEST=y +CONFIG_ZTEST_NEW_API=y diff --git a/tests/crypto/tinycrypt_hmac_prng/src/hmac_prng.c b/tests/crypto/tinycrypt_hmac_prng/src/hmac_prng.c index d79064f6b5e..122cf92f423 100644 --- a/tests/crypto/tinycrypt_hmac_prng/src/hmac_prng.c +++ b/tests/crypto/tinycrypt_hmac_prng/src/hmac_prng.c @@ -7544,7 +7544,7 @@ unsigned int test_120(void) } -void test_hmac_prng(void) +ZTEST(hmac_prng_fn, test_hmac_prng) { unsigned int result = TC_PASS; @@ -7913,3 +7913,5 @@ void test_hmac_prng(void) TC_PRINT("\n"); TC_PRINT("All HMAC-PRNG tests succeeded!\n"); } + +ZTEST_SUITE(hmac_prng_fn, NULL, NULL, NULL, NULL, NULL); diff --git a/tests/crypto/tinycrypt_hmac_prng/src/main.c b/tests/crypto/tinycrypt_hmac_prng/src/main.c deleted file mode 100644 index 21b8560219c..00000000000 --- a/tests/crypto/tinycrypt_hmac_prng/src/main.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) 2017 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -extern void test_hmac_prng(void); - -/**test case main entry*/ -void test_main(void) -{ - ztest_test_suite(test_hmac_prng_fn, - ztest_unit_test(test_hmac_prng)); - ztest_run_test_suite(test_hmac_prng_fn); -}