summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTristan Honscheid <honscheid@google.com>2023-04-12 15:00:13 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-21 07:25:40 +0000
commitb5e2ea8b0dfa7a190783978153bcafb1ae87a3d0 (patch)
treefc686f17ba43c1cb4e48cb499dc19e011630adb3 /common
parent7380b56e8cdbcb8516e767d65eb05330bedbaf60 (diff)
downloadchrome-ec-b5e2ea8b0dfa7a190783978153bcafb1ae87a3d0.tar.gz
zephyr: test: Set up OCPC test project and check console commands
Add a new test binary that has a Nissa-style Kconfig and devicetree, complete with chargers. Use this configuration to run OCPC (common/ocpc.c) and test this module, which has never previously been used in our tests. This CL contains tests for ocpc.c's console commands. BRANCH=None BUG=b:276805061 TEST=./twister -T zephyr/test/ocpc Change-Id: I34dbe1abcae98d8ca9aa9613dddf3b4ba2838792 Signed-off-by: Tristan Honscheid <honscheid@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4438529 Commit-Queue: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/ocpc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/common/ocpc.c b/common/ocpc.c
index a176eea075..6ed15b1b1b 100644
--- a/common/ocpc.c
+++ b/common/ocpc.c
@@ -701,7 +701,7 @@ void ocpc_reset(struct ocpc_data *ocpc)
ocpc_precharge_enable(false);
}
-static void ocpc_set_pid_constants(void)
+test_export_static void ocpc_set_pid_constants(void)
{
ocpc_get_pid_constants(&k_p, &k_p_div, &k_i, &k_i_div, &k_d, &k_d_div);
}
@@ -800,3 +800,14 @@ static int command_ocpcdrvlmt(int argc, const char **argv)
}
DECLARE_SAFE_CONSOLE_COMMAND(ocpcdrvlmt, command_ocpcdrvlmt, "[<drive_limit>]",
"Show/Set drive limit for OCPC PID loop");
+
+#ifdef TEST_BUILD
+int test_ocpc_get_viz_output(void)
+{
+ return viz_output;
+}
+int test_ocpc_get_debug_output(void)
+{
+ return debug_output;
+}
+#endif