ztest: move get_friendly_phase_name to common code
Move the function used for printing the phase name up so its available for both unittest and KERNEL mode of tests. Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
parent
5b6b304e3c
commit
20475bff0e
1 changed files with 21 additions and 21 deletions
|
@ -256,27 +256,6 @@ static int get_final_test_result(const struct ztest_unit_test *test, int ret)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
|
||||
/* Static code analysis tool can raise a violation that the standard header
|
||||
* <setjmp.h> shall not be used.
|
||||
*
|
||||
* setjmp is using in a test code, not in a runtime code, it is acceptable.
|
||||
* It is a deliberate deviation.
|
||||
*/
|
||||
#include <setjmp.h> /* parasoft-suppress MISRAC2012-RULE_21_4-a MISRAC2012-RULE_21_4-b*/
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FAIL_FAST 0
|
||||
|
||||
static jmp_buf test_fail;
|
||||
static jmp_buf test_pass;
|
||||
static jmp_buf test_skip;
|
||||
static jmp_buf stack_fail;
|
||||
static jmp_buf test_suite_fail;
|
||||
|
||||
/**
|
||||
* @brief Get a friendly name string for a given test phrase.
|
||||
*
|
||||
|
@ -303,6 +282,27 @@ static inline const char *get_friendly_phase_name(enum ztest_phase phase)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
|
||||
/* Static code analysis tool can raise a violation that the standard header
|
||||
* <setjmp.h> shall not be used.
|
||||
*
|
||||
* setjmp is using in a test code, not in a runtime code, it is acceptable.
|
||||
* It is a deliberate deviation.
|
||||
*/
|
||||
#include <setjmp.h> /* parasoft-suppress MISRAC2012-RULE_21_4-a MISRAC2012-RULE_21_4-b*/
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define FAIL_FAST 0
|
||||
|
||||
static jmp_buf test_fail;
|
||||
static jmp_buf test_pass;
|
||||
static jmp_buf test_skip;
|
||||
static jmp_buf stack_fail;
|
||||
static jmp_buf test_suite_fail;
|
||||
|
||||
void ztest_test_fail(void)
|
||||
{
|
||||
switch (phase) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue