TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ns_test_helpers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __NS_TEST_HELPERS_H__
9 #define __NS_TEST_HELPERS_H__
10 
11 #include "test_framework.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 #define CONCAT_(x, y) x ## y
18 #define CONCAT(x, y) CONCAT_(x, y)
19 
32 #define BUFFER_SIZE 24
33 #define PADDING_SIZE 8
34 #define HALF_PADDING_SIZE 4
35 
36 #define BUFFER_PLUS_PADDING_SIZE (BUFFER_SIZE + PADDING_SIZE)
37 #define BUFFER_PLUS_HALF_PADDING_SIZE (BUFFER_SIZE + HALF_PADDING_SIZE)
38 
44 #define TFM_PS_TEST_PROTO(test_name) \
45  static void test_name(struct test_result_t *ret)
46 
52 #define TFM_PS_TEST_NAME(test_num) CONCAT(tfm_ps_test_, test_num)
53 
59 #define TFM_PS_TASK_NAME(test_num) CONCAT(TFM_PS_TEST_NAME(test_num), _task)
60 
66 #define TFM_PS_TEST(test_num) TFM_PS_TEST_PROTO(TFM_PS_TEST_NAME(test_num))
67 
73 #define TFM_PS_TASK(test_num) TFM_PS_TEST_PROTO(TFM_PS_TASK_NAME(test_num))
74 
82 #define TFM_PS_NS_TEST(test_num, thread_name) \
83  TFM_PS_TASK(test_num); \
84  TFM_PS_TEST(test_num) \
85  { \
86  tfm_ps_run_test(thread_name, ret, TFM_PS_TASK_NAME(test_num)); \
87  } \
88  TFM_PS_TASK(test_num)
89 
90 /* The type of a test function */
91 typedef void test_func_t(struct test_result_t *ret);
92 
100 void tfm_ps_run_test(const char *thread_name, struct test_result_t *ret,
101  test_func_t *test_func);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif /* __NS_TEST_HELPERS_H__ */
void tfm_ps_run_test(const char *thread_name, struct test_result_t *ret, test_func_t *test_func)
Executes the given test function from the specified thread context.
struct test_result_t * ret
void test_func_t(struct test_result_t *ret)