Skip to content

Commit

Permalink
ztest: fix grammar for errors in bad test phases
Browse files Browse the repository at this point in the history
Addresses the comments in zephyrproject-rtos#48846 regarding the error messages

Signed-off-by: Yuval Peress <[email protected]>
  • Loading branch information
yperess authored and nashif committed Oct 13, 2022
1 parent dbd63e8 commit 4f75848
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
13 changes: 7 additions & 6 deletions subsys/testsuite/ztest/src/ztest_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void ztest_test_fail(void)
case TEST_PHASE_AFTER:
case TEST_PHASE_TEARDOWN:
case TEST_PHASE_FRAMEWORK:
PRINT(" ERROR: cannot fail in test '%s()', bailing\n",
PRINT(" ERROR: cannot fail in test phase '%s()', bailing\n",
get_friendly_phase_name(phase));
longjmp(stack_fail, 1);
}
Expand All @@ -345,7 +345,8 @@ void ztest_test_pass(void)
if (phase == TEST_PHASE_TEST) {
longjmp(test_pass, 1);
}
PRINT(" ERROR: cannot pass in test '%s()', bailing\n", get_friendly_phase_name(phase));
PRINT(" ERROR: cannot pass in test phase '%s()', bailing\n",
get_friendly_phase_name(phase));
longjmp(stack_fail, 1);
}

Expand All @@ -357,7 +358,7 @@ void ztest_test_skip(void)
case TEST_PHASE_TEST:
longjmp(test_skip, 1);
default:
PRINT(" ERROR: cannot skip in test '%s()', bailing\n",
PRINT(" ERROR: cannot skip in test phase '%s()', bailing\n",
get_friendly_phase_name(phase));
longjmp(stack_fail, 1);
}
Expand Down Expand Up @@ -448,7 +449,7 @@ void ztest_test_fail(void)
test_finalize();
break;
default:
PRINT(" ERROR: cannot fail in test '%s()', bailing\n",
PRINT(" ERROR: cannot fail in test phase '%s()', bailing\n",
get_friendly_phase_name(phase));
test_status = ZTEST_STATUS_CRITICAL_ERROR;
break;
Expand All @@ -463,7 +464,7 @@ void ztest_test_pass(void)
test_finalize();
break;
default:
PRINT(" ERROR: cannot pass in test '%s()', bailing\n",
PRINT(" ERROR: cannot pass in test phase '%s()', bailing\n",
get_friendly_phase_name(phase));
test_status = ZTEST_STATUS_CRITICAL_ERROR;
if (phase == TEST_PHASE_BEFORE) {
Expand All @@ -484,7 +485,7 @@ void ztest_test_skip(void)
test_finalize();
break;
default:
PRINT(" ERROR: cannot skip in test '%s()', bailing\n",
PRINT(" ERROR: cannot skip in test phase '%s()', bailing\n",
get_friendly_phase_name(phase));
test_status = ZTEST_STATUS_CRITICAL_ERROR;
break;
Expand Down
12 changes: 6 additions & 6 deletions tests/ztest/fail/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ endchoice

config TEST_ERROR_STRING
string
default "ERROR: cannot fail in test 'after()', bailing" if ZTEST_FAIL_TEST_ASSERT_AFTER
default "ERROR: cannot fail in test 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSERT_TEARDOWN
default "ERROR: cannot skip in test 'after()', bailing" if ZTEST_FAIL_TEST_ASSUME_AFTER
default "ERROR: cannot skip in test 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSUME_TEARDOWN
default "ERROR: cannot pass in test 'after()', bailing" if ZTEST_FAIL_TEST_PASS_AFTER
default "ERROR: cannot pass in test 'teardown()', bailing" if ZTEST_FAIL_TEST_PASS_TEARDOWN
default "ERROR: cannot fail in test phase 'after()', bailing" if ZTEST_FAIL_TEST_ASSERT_AFTER
default "ERROR: cannot fail in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSERT_TEARDOWN
default "ERROR: cannot skip in test phase 'after()', bailing" if ZTEST_FAIL_TEST_ASSUME_AFTER
default "ERROR: cannot skip in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSUME_TEARDOWN
default "ERROR: cannot pass in test phase 'after()', bailing" if ZTEST_FAIL_TEST_PASS_AFTER
default "ERROR: cannot pass in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_PASS_TEARDOWN
default "Assumption failed at " if ZTEST_FAIL_TEST_UNEXPECTED_ASSUME

source "Kconfig.zephyr"

0 comments on commit 4f75848

Please sign in to comment.