ztest: Match cleanup ordering between unittest and normal tests

Tests with KERNEL enabled perform their cleanup logic after the suite's
after and test rules are executed. Unittests should do the same.

Signed-off-by: Yuval Peress <peress@google.com>
This commit is contained in:
Yuval Peress 2022-08-10 22:50:01 -06:00 committed by Carles Cufí
commit 61fb681036

View file

@ -387,8 +387,6 @@ static int run_test(struct ztest_suite_node *suite, struct ztest_unit_test *test
}
run_test_functions(suite, test, data);
out:
phase = TEST_PHASE_FRAMEWORK;
ret |= cleanup_test(test);
phase = TEST_PHASE_AFTER;
if (test_result != ZTEST_RESULT_SUITE_FAIL) {
if (suite->after != NULL) {
@ -396,6 +394,8 @@ out:
}
run_test_rules(/*is_before=*/false, test, data);
}
phase = TEST_PHASE_FRAMEWORK;
ret |= cleanup_test(test);
ret = get_final_test_result(test, ret);
Z_TC_END_RESULT(ret, test->name);