drivers: fake: now just check for CONFIG_ZTEST

Old ztest API is deprecated, so only check for CONFIG_ZTEST.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-10-09 23:39:26 +00:00 committed by Carles Cufí
parent f067bc43c9
commit 85c4703a46
3 changed files with 12 additions and 12 deletions

View file

@ -9,9 +9,9 @@
#include <zephyr/drivers/can/can_fake.h>
#include <zephyr/fff.h>
#ifdef CONFIG_ZTEST_NEW_API
#ifdef CONFIG_ZTEST
#include <zephyr/ztest.h>
#endif /* CONFIG_ZTEST_NEW_API */
#endif /* CONFIG_ZTEST */
#define DT_DRV_COMPAT zephyr_fake_can
@ -46,7 +46,7 @@ DEFINE_FAKE_VOID_FUNC(fake_can_set_state_change_callback, const struct device *,
DEFINE_FAKE_VALUE_FUNC(int, fake_can_get_max_filters, const struct device *, bool);
#ifdef CONFIG_ZTEST_NEW_API
#ifdef CONFIG_ZTEST
static void fake_can_reset_rule_before(const struct ztest_unit_test *test, void *fixture)
{
ARG_UNUSED(test);
@ -68,7 +68,7 @@ static void fake_can_reset_rule_before(const struct ztest_unit_test *test, void
}
ZTEST_RULE(fake_can_reset_rule, fake_can_reset_rule_before, NULL);
#endif /* CONFIG_ZTEST_NEW_API */
#endif /* CONFIG_ZTEST */
static int fake_can_get_core_clock(const struct device *dev, uint32_t *rate)
{

View file

@ -9,9 +9,9 @@
#include <zephyr/drivers/eeprom/eeprom_fake.h>
#include <zephyr/fff.h>
#ifdef CONFIG_ZTEST_NEW_API
#ifdef CONFIG_ZTEST
#include <zephyr/ztest.h>
#endif /* CONFIG_ZTEST_NEW_API */
#endif /* CONFIG_ZTEST */
#define DT_DRV_COMPAT zephyr_fake_eeprom
@ -32,7 +32,7 @@ size_t fake_eeprom_size_delegate(const struct device *dev)
return config->size;
}
#ifdef CONFIG_ZTEST_NEW_API
#ifdef CONFIG_ZTEST
static void fake_eeprom_reset_rule_before(const struct ztest_unit_test *test, void *fixture)
{
ARG_UNUSED(test);
@ -47,7 +47,7 @@ static void fake_eeprom_reset_rule_before(const struct ztest_unit_test *test, vo
}
ZTEST_RULE(fake_eeprom_reset_rule, fake_eeprom_reset_rule_before, NULL);
#endif /* CONFIG_ZTEST_NEW_API */
#endif /* CONFIG_ZTEST */
static const struct eeprom_driver_api fake_eeprom_driver_api = {
.read = fake_eeprom_read,

View file

@ -11,9 +11,9 @@
#include <zephyr/drivers/rtc.h>
#include <zephyr/drivers/rtc/rtc_fake.h>
#ifdef CONFIG_ZTEST_NEW_API
#ifdef CONFIG_ZTEST
#include <zephyr/ztest.h>
#endif /* CONFIG_ZTEST_NEW_API */
#endif /* CONFIG_ZTEST */
DEFINE_FAKE_VALUE_FUNC(int, rtc_fake_set_time, const struct device *, const struct rtc_time *);
DEFINE_FAKE_VALUE_FUNC(int, rtc_fake_get_time, const struct device *, struct rtc_time *);
@ -40,7 +40,7 @@ DEFINE_FAKE_VALUE_FUNC(int, rtc_fake_set_calibration, const struct device *, int
DEFINE_FAKE_VALUE_FUNC(int, rtc_fake_get_calibration, const struct device *, int32_t *);
#endif /* CONFIG_RTC_CALIBRATION */
#ifdef CONFIG_ZTEST_NEW_API
#ifdef CONFIG_ZTEST
static void fake_rtc_reset_rule_before(const struct ztest_unit_test *test, void *fixture)
{
ARG_UNUSED(test);
@ -68,7 +68,7 @@ static void fake_rtc_reset_rule_before(const struct ztest_unit_test *test, void
}
ZTEST_RULE(fake_rtc_reset_rule, fake_rtc_reset_rule_before, NULL);
#endif /* CONFIG_ZTEST_NEW_API */
#endif /* CONFIG_ZTEST */
struct rtc_driver_api rtc_fake_driver_api = {
.set_time = rtc_fake_set_time,