summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/common
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2022-08-31 02:05:03 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-09-01 00:04:13 +0000
commit2aaee77c3797d5b7fcf4876f9306f33e4b15a640 (patch)
tree9458aa75ee2014e262ca9dbaa724ae64ba1271af /zephyr/test/drivers/common
parentb2a302b1bef67dd322762feb8e344d45987c30f2 (diff)
downloadchrome-ec-2aaee77c3797d5b7fcf4876f9306f33e4b15a640.tar.gz
test: Add tests for lid_angle.c cover the basic code paths
Test the basic code paths of setting/getting the wake angle as well as having the lid at 45 while the wake angle is at either the min/max. BRANCH=none BUG=b:244402830 TEST=twister -T zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I076f00fe7f572ac3358a9471a51b6408ee082b92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3867250 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Diffstat (limited to 'zephyr/test/drivers/common')
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/test_mocks.h3
-rw-r--r--zephyr/test/drivers/common/src/test_mocks.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/zephyr/test/drivers/common/include/test/drivers/test_mocks.h b/zephyr/test/drivers/common/include/test/drivers/test_mocks.h
index f77eb6fc10..eb6325903f 100644
--- a/zephyr/test/drivers/common/include/test/drivers/test_mocks.h
+++ b/zephyr/test/drivers/common/include/test/drivers/test_mocks.h
@@ -108,3 +108,6 @@ DECLARE_FAKE_VALUE_FUNC(int, system_jumped_late);
DECLARE_FAKE_VOID_FUNC(system_reset, int);
DECLARE_FAKE_VOID_FUNC(software_panic, uint32_t, uint32_t);
DECLARE_FAKE_VOID_FUNC(assert_post_action, const char *, unsigned int);
+
+/* Mocks for common/lid_angle.c */
+DECLARE_FAKE_VOID_FUNC(lid_angle_peripheral_enable, int);
diff --git a/zephyr/test/drivers/common/src/test_mocks.c b/zephyr/test/drivers/common/src/test_mocks.c
index 6c8db5c27a..d2e4770f9b 100644
--- a/zephyr/test/drivers/common/src/test_mocks.c
+++ b/zephyr/test/drivers/common/src/test_mocks.c
@@ -20,6 +20,9 @@ DEFINE_FAKE_VOID_FUNC(system_reset, int);
DEFINE_FAKE_VOID_FUNC(software_panic, uint32_t, uint32_t);
DEFINE_FAKE_VOID_FUNC(assert_post_action, const char *, unsigned int);
+/* Mocks for common/lid_angle.c */
+DEFINE_FAKE_VOID_FUNC(lid_angle_peripheral_enable, int);
+
/**
* @brief Reset all the fakes before each test.
*/
@@ -36,6 +39,7 @@ static void fff_reset_rule_before(const struct ztest_unit_test *test,
RESET_FAKE(system_reset);
RESET_FAKE(software_panic);
RESET_FAKE(assert_post_action);
+ RESET_FAKE(lid_angle_peripheral_enable);
}
ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);