File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 59
59
60
60
#define FAIL "FAIL"
61
61
#define PASS "PASS"
62
+ #define SKIP "SKIP"
62
63
#define FMT_ERROR "%s - %s@%d. "
63
64
64
65
#define TC_PASS 0
65
66
#define TC_FAIL 1
67
+ #define TC_SKIP 2
66
68
67
69
#define TC_ERROR (fmt , ...) \
68
70
do { \
77
79
/* prints result and the function name */
78
80
#define _TC_END_RESULT (result , func ) \
79
81
do { \
80
- TC_END(result, "%s - %s.\n", \
81
- (result) == TC_PASS ? PASS : FAIL, func); \
82
+ if ((result) == TC_PASS) { \
83
+ TC_END(result, "%s - %s.\n", PASS, func); \
84
+ } else if ((result) == TC_FAIL) { \
85
+ TC_END(result, "%s - %s.\n", FAIL, func); \
86
+ } else { \
87
+ TC_END(result, "%s - %s.\n", SKIP, func); \
88
+ } \
82
89
PRINT_LINE; \
83
90
} while (0)
84
91
#define TC_END_RESULT (result ) \
Original file line number Diff line number Diff line change @@ -51,6 +51,12 @@ void ztest_test_fail(void);
51
51
*/
52
52
void ztest_test_pass (void );
53
53
54
+ /**
55
+ * @brief Skip the current test.
56
+ *
57
+ */
58
+ void ztest_test_skip (void );
59
+
54
60
/**
55
61
* @brief Do nothing, successfully.
56
62
*
Original file line number Diff line number Diff line change @@ -172,6 +172,13 @@ void ztest_test_pass(void)
172
172
k_thread_abort (k_current_get ());
173
173
}
174
174
175
+ void ztest_test_skip (void )
176
+ {
177
+ test_result = 2 ;
178
+ k_sem_give (& test_end_signal );
179
+ k_thread_abort (k_current_get ());
180
+ }
181
+
175
182
static void init_testing (void )
176
183
{
177
184
k_sem_init (& test_end_signal , 0 , 1 );
@@ -216,16 +223,18 @@ static int run_test(struct unit_test *test)
216
223
* phase": this will corrupt the kernel ready queue.
217
224
*/
218
225
k_sem_take (& test_end_signal , K_FOREVER );
219
- if (test_result ) {
226
+ if (test_result == 1 ) {
220
227
ret = TC_FAIL ;
228
+ _TC_END_RESULT (ret , test -> name );
221
229
}
222
230
223
- if (!test_result || !FAIL_FAST ) {
231
+ if (test_result == 2 ) {
232
+ _TC_END_RESULT (TC_SKIP , test -> name );
233
+ } else if (!test_result || !FAIL_FAST ) {
224
234
ret |= cleanup_test (test );
235
+ _TC_END_RESULT (ret , test -> name );
225
236
}
226
237
227
- _TC_END_RESULT (ret , test -> name );
228
-
229
238
return ret ;
230
239
}
231
240
You can’t perform that action at this time.
0 commit comments