zephyr/tests/ztest/fail/Kconfig
Yuval Peress ba9b4f3734 ztest: Fix confusing SKIP log
When CONFIG_ZTEST_FAIL_ON_ASSUME is set, a failed assumption will
cause the suite to fail, but the individual test will be marked as
SKIPPED. We should fail the test so it's clear what's going on.

Fixes #86611

Signed-off-by: Yuval Peress <peress@google.com>
2025-04-04 21:16:34 +02:00

43 lines
1.7 KiB
Plaintext

# Copyright (c) 2022 Google LLC
# SPDX-License-Identifier: Apache-2.0
choice ZTEST_FAIL_TEST
prompt "Select the type of failure to test"
config ZTEST_FAIL_TEST_ASSERT_AFTER
bool "Add a failed assert in the after phase"
config ZTEST_FAIL_TEST_ASSERT_TEARDOWN
bool "Add a failed assert in the teardown phase"
config ZTEST_FAIL_TEST_ASSUME_AFTER
bool "Add a failed assume in the after phase"
config ZTEST_FAIL_TEST_ASSUME_TEARDOWN
bool "Add a failed assume in the teardown phase"
config ZTEST_FAIL_TEST_PASS_AFTER
bool "Add a call to ztest_test_pass() in the after phase"
config ZTEST_FAIL_TEST_PASS_TEARDOWN
bool "Add a call to ztest_test_pass() in the teardown phase"
config ZTEST_FAIL_TEST_UNEXPECTED_ASSUME
bool "Add a test which fails a zassume() call"
endchoice
config TEST_ERROR_STRING
string
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 && !ZTEST_FAIL_ON_ASSUME
default "ERROR: cannot skip in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSUME_TEARDOWN && !ZTEST_FAIL_ON_ASSUME
default "ERROR: cannot fail in test phase 'after()', bailing" if ZTEST_FAIL_TEST_ASSUME_AFTER && ZTEST_FAIL_ON_ASSUME
default "ERROR: cannot fail in test phase 'teardown()', bailing" if ZTEST_FAIL_TEST_ASSUME_TEARDOWN && ZTEST_FAIL_ON_ASSUME
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"