diff options
author | Tim Van Patten <timvp@google.com> | 2023-04-27 12:13:30 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-04 21:33:36 +0000 |
commit | 5946e5379dabc3515caec792835c0bdf2996ea81 (patch) | |
tree | a20a4b523d04b15bc06d585ae423091fdd754b1b | |
parent | 0d6bc55eaf6f6b725afd9ec43b45e6df4c2d94fa (diff) | |
download | chrome-ec-5946e5379dabc3515caec792835c0bdf2996ea81.tar.gz |
drivers.body_detection: Enable CONFIG_PLATFORM_EC_GESTURE_HOST_DETECTION
Enable CONFIG_PLATFORM_EC_GESTURE_HOST_DETECTION for
drivers.body_detection, to enable additional testing.
BUG=b:259754018
TEST=./twister -v -i -p native_posix -p unit_testing
Change-Id: I092e2c3e9c9b5db5a29adf15cfb338647058f514
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4484797
Reviewed-by: Aaron Massey <aaronmassey@google.com>
Commit-Queue: Tim Van Patten <timvp@google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Tested-by: Tim Van Patten <timvp@google.com>
-rw-r--r-- | zephyr/test/drivers/host_cmd/src/motion_sense.c | 22 | ||||
-rw-r--r-- | zephyr/test/drivers/testcase.yaml | 1 |
2 files changed, 18 insertions, 5 deletions
diff --git a/zephyr/test/drivers/host_cmd/src/motion_sense.c b/zephyr/test/drivers/host_cmd/src/motion_sense.c index c231f6f55e..94c654de05 100644 --- a/zephyr/test/drivers/host_cmd/src/motion_sense.c +++ b/zephyr/test/drivers/host_cmd/src/motion_sense.c @@ -127,13 +127,25 @@ ZTEST_USER(host_cmd_motion_sense, test_dump) * tests in a loop, but since the number of sensors (as well as the * order) is adjustable by devicetree, it would be too difficult to hard * code here. + * When CONFIG_GESTURE_HOST_DETECTION is enabled, ALL_MOTION_SENSORS is + * increased by 1 (see include/motion_sense.h). Additionally, + * host_cmd_motion_sense() only fills in |motion_sensor_count| worth of + * data (not ALL_MOTION_SENSORS+1), and zeroes out the rest, so only + * validate |motion_sensor_count| worth of data and that the rest is + * zeroed out. */ for (int i = 0; i < ALL_MOTION_SENSORS; ++i) { - zassert_equal(result->dump.sensor[i].flags, - MOTIONSENSE_SENSOR_FLAG_PRESENT, NULL); - zassert_equal(result->dump.sensor[i].data[0], i); - zassert_equal(result->dump.sensor[i].data[1], i + 1); - zassert_equal(result->dump.sensor[i].data[2], i + 2); + if (i < motion_sensor_count) { + zassert_equal(result->dump.sensor[i].flags, + MOTIONSENSE_SENSOR_FLAG_PRESENT, NULL); + zassert_equal(result->dump.sensor[i].data[0], i); + zassert_equal(result->dump.sensor[i].data[1], i + 1); + zassert_equal(result->dump.sensor[i].data[2], i + 2); + } else { + zassert_equal(result->dump.sensor[i].data[0], 0); + zassert_equal(result->dump.sensor[i].data[1], 0); + zassert_equal(result->dump.sensor[i].data[2], 0); + } } /* Make sure that the accelerometer status presence bit is on */ diff --git a/zephyr/test/drivers/testcase.yaml b/zephyr/test/drivers/testcase.yaml index 07a54e4123..695a2bcc66 100644 --- a/zephyr/test/drivers/testcase.yaml +++ b/zephyr/test/drivers/testcase.yaml @@ -506,3 +506,4 @@ tests: - CONFIG_PLATFORM_EC_BODY_DETECTION=y - CONFIG_PLATFORM_EC_BODY_DETECTION_ALWAYS_ENABLE_IN_S0=y - CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE=y + - CONFIG_PLATFORM_EC_GESTURE_HOST_DETECTION=y |