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 File Reference
#include "test_framework.h"
Include dependency graph for ns_test_helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CONCAT_(x, y)   x ## y
 
#define CONCAT(x, y)   CONCAT_(x, y)
 
#define BUFFER_SIZE   24
 
#define PADDING_SIZE   8
 
#define HALF_PADDING_SIZE   4
 
#define BUFFER_PLUS_PADDING_SIZE   (BUFFER_SIZE + PADDING_SIZE)
 
#define BUFFER_PLUS_HALF_PADDING_SIZE   (BUFFER_SIZE + HALF_PADDING_SIZE)
 
#define TFM_PS_TEST_PROTO(test_name)   static void test_name(struct test_result_t *ret)
 Expands to the prototype of a test function. More...
 
#define TFM_PS_TEST_NAME(test_num)   CONCAT(tfm_ps_test_, test_num)
 Expands to the standard name of a test function. More...
 
#define TFM_PS_TASK_NAME(test_num)   CONCAT(TFM_PS_TEST_NAME(test_num), _task)
 Expands to the standard name of a task function. More...
 
#define TFM_PS_TEST(test_num)   TFM_PS_TEST_PROTO(TFM_PS_TEST_NAME(test_num))
 Expands to a test function declaration. More...
 
#define TFM_PS_TASK(test_num)   TFM_PS_TEST_PROTO(TFM_PS_TASK_NAME(test_num))
 Expands to a task function declaration. More...
 
#define TFM_PS_NS_TEST(test_num, thread_name)
 Defines a single-threaded PS NS test function and declares the corresponding task function. More...
 

Typedefs

typedef void test_func_t (struct test_result_t *ret)
 

Functions

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. More...
 

Macro Definition Documentation

#define BUFFER_PLUS_HALF_PADDING_SIZE   (BUFFER_SIZE + HALF_PADDING_SIZE)

Definition at line 37 of file ns_test_helpers.h.

#define BUFFER_PLUS_PADDING_SIZE   (BUFFER_SIZE + PADDING_SIZE)

Definition at line 36 of file ns_test_helpers.h.

#define BUFFER_SIZE   24

Several tests use a buffer to read back data from an asset. This buffer is larger than the size of the asset data by PADDING_SIZE bytes. This allows us to ensure that the only the expected data is read back and that it is read back correctly.

For example if the buffer and asset are as follows: Buffer - "XXXXXXXXXXXX", Asset data - "AAAA"

Then a correct and successful read would give this result: "XXXXAAAAXXXX" (Assuming a PADDING_SIZE of 8)

Definition at line 32 of file ns_test_helpers.h.

#define CONCAT (   x,
 
)    CONCAT_(x, y)

Definition at line 18 of file ns_test_helpers.h.

#define CONCAT_ (   x,
 
)    x ## y

Definition at line 17 of file ns_test_helpers.h.

#define HALF_PADDING_SIZE   4

Definition at line 34 of file ns_test_helpers.h.

#define PADDING_SIZE   8

Definition at line 33 of file ns_test_helpers.h.

#define TFM_PS_NS_TEST (   test_num,
  thread_name 
)
Value:
TFM_PS_TASK(test_num); \
TFM_PS_TEST(test_num) \
{ \
tfm_ps_run_test(thread_name, ret, TFM_PS_TASK_NAME(test_num)); \
} \
TFM_PS_TASK(test_num)
#define TFM_PS_TASK(test_num)
Expands to a task function declaration.
#define TFM_PS_TEST(test_num)
Expands to a test function declaration.
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.
#define TFM_PS_TASK_NAME(test_num)
Expands to the standard name of a task function.

Defines a single-threaded PS NS test function and declares the corresponding task function.

Parameters
[in]test_numIdentification number of the test
[in]thread_nameName of the thread in which to run the test

Definition at line 82 of file ns_test_helpers.h.

#define TFM_PS_TASK (   test_num)    TFM_PS_TEST_PROTO(TFM_PS_TASK_NAME(test_num))

Expands to a task function declaration.

Parameters
[in]test_numIdentification number of the task

Definition at line 73 of file ns_test_helpers.h.

#define TFM_PS_TASK_NAME (   test_num)    CONCAT(TFM_PS_TEST_NAME(test_num), _task)

Expands to the standard name of a task function.

Parameters
[in]test_numIdentification number of the task

Definition at line 59 of file ns_test_helpers.h.

#define TFM_PS_TEST (   test_num)    TFM_PS_TEST_PROTO(TFM_PS_TEST_NAME(test_num))

Expands to a test function declaration.

Parameters
[in]test_numIdentification number of the test

Definition at line 66 of file ns_test_helpers.h.

#define TFM_PS_TEST_NAME (   test_num)    CONCAT(tfm_ps_test_, test_num)

Expands to the standard name of a test function.

Parameters
[in]test_numIdentification number of the test

Definition at line 52 of file ns_test_helpers.h.

#define TFM_PS_TEST_PROTO (   test_name)    static void test_name(struct test_result_t *ret)

Expands to the prototype of a test function.

Parameters
[in]test_nameName of the test function

Definition at line 44 of file ns_test_helpers.h.

Typedef Documentation

typedef void test_func_t(struct test_result_t *ret)

Definition at line 91 of file ns_test_helpers.h.

Function Documentation

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.

Parameters
[in]thread_nameName of the thread to be created for test
[out]retResult of the test
[in]test_funcTest function to be run in the new thread

Definition at line 48 of file ns_test_helpers.c.

Here is the call graph for this function: