diff options
author | Simon Glass <sjg@chromium.org> | 2023-05-02 15:37:27 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-03 16:53:29 +0000 |
commit | fd4c313e9c16d9766a14c7ed8bcef10758e23ae3 (patch) | |
tree | 148bf28a7c77019c2cd77d30cdd25e7c49f4fb9e /zephyr/emul | |
parent | 6fb9ba45716128f499ad19580f6f2c3552c79a04 (diff) | |
download | chrome-ec-fd4c313e9c16d9766a14c7ed8bcef10758e23ae3.tar.gz |
zephyr: emul_smart_battery: Allow use outside tests
This emulator is useful outside tests. Add #ifdefs around the parts
that depend on testing.
BUG=b:218332694
TEST=with other changes, see that it can be built into dev-posix
Change-Id: I399fa3e977aa87b65dfef104ee7207b207b056b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4501042
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Tested-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'zephyr/emul')
-rw-r--r-- | zephyr/emul/emul_smart_battery.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/zephyr/emul/emul_smart_battery.c b/zephyr/emul/emul_smart_battery.c index a935a71921..13abc1c4db 100644 --- a/zephyr/emul/emul_smart_battery.c +++ b/zephyr/emul/emul_smart_battery.c @@ -14,7 +14,10 @@ #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/i2c_emul.h> #include <zephyr/logging/log.h> + +#ifdef CONFIG_ZTEST #include <zephyr/ztest.h> +#endif #define DT_DRV_COMPAT zephyr_smart_battery_emul @@ -893,6 +896,7 @@ DT_INST_FOREACH_STATUS_OKAY(SMART_BATTERY_EMUL) case DT_INST_DEP_ORD(n): \ return sbat_emul_data_##n.common.emul.target; +#ifdef CONFIG_ZTEST static void emul_smart_battery_reset_capacity(const struct emul *emul) { struct sbat_emul_data *bat_data = emul->data; @@ -913,6 +917,7 @@ static void emul_sbat_reset(const struct ztest_unit_test *test, void *data) } ZTEST_RULE(emul_smart_battery_reset, NULL, emul_sbat_reset); +#endif /* CONFIG_ZTEST */ DT_INST_FOREACH_STATUS_OKAY(EMUL_STUB_DEVICE); |