summaryrefslogtreecommitdiff
path: root/test/kb_scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/kb_scan.c')
-rw-r--r--test/kb_scan.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/test/kb_scan.c b/test/kb_scan.c
index a43808c0c1..82693ff525 100644
--- a/test/kb_scan.c
+++ b/test/kb_scan.c
@@ -1,7 +1,7 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
- * Copyright 2013 Google Inc.
+ * Copyright 2013 Google LLC
*
* Tests for keyboard scan deghosting and debouncing.
*/
@@ -20,15 +20,15 @@
#include "timer.h"
#include "util.h"
-#define KEYDOWN_DELAY_MS 10
-#define KEYDOWN_RETRY 10
-#define NO_KEYDOWN_DELAY_MS 100
+#define KEYDOWN_DELAY_MS 10
+#define KEYDOWN_RETRY 10
+#define NO_KEYDOWN_DELAY_MS 100
-#define CHECK_KEY_COUNT(old, expected) \
- do { \
+#define CHECK_KEY_COUNT(old, expected) \
+ do { \
if (verify_key_presses(old, expected) != EC_SUCCESS) \
- return EC_ERROR_UNKNOWN; \
- old = fifo_add_count; \
+ return EC_ERROR_UNKNOWN; \
+ old = fifo_add_count; \
} while (0)
/* Emulated physical key state */
@@ -121,13 +121,10 @@ void chipset_reset(void)
}
#endif
-#define mock_defined_key(k, p) mock_key(KEYBOARD_ROW_ ## k, \
- KEYBOARD_COL_ ## k, \
- p)
+#define mock_defined_key(k, p) mock_key(KEYBOARD_ROW_##k, KEYBOARD_COL_##k, p)
-#define mock_default_key(k, p) mock_key(KEYBOARD_DEFAULT_ROW_ ## k, \
- KEYBOARD_DEFAULT_COL_ ## k, \
- p)
+#define mock_default_key(k, p) \
+ mock_key(KEYBOARD_DEFAULT_ROW_##k, KEYBOARD_DEFAULT_COL_##k, p)
static void mock_key(int r, int c, int keydown)
{
@@ -403,7 +400,7 @@ static int debounce_test(void)
* Push down each subsequent key, until all 8 are pressed, each
* time bouncing the former one once.
*/
- for (i = 1 ; i < 8; i++) {
+ for (i = 1; i < 8; i++) {
mock_key(i, 1, 1);
task_wake(TASK_ID_KEYSCAN);
msleep(3);
@@ -547,12 +544,14 @@ static int lid_test(void)
static int test_check_boot_esc(void)
{
- TEST_CHECK(keyboard_scan_get_boot_keys() == BOOT_KEY_ESC);
+ TEST_ASSERT(keyboard_scan_get_boot_keys() == BOOT_KEY_ESC);
+ return EC_SUCCESS;
}
static int test_check_boot_down(void)
{
- TEST_CHECK(keyboard_scan_get_boot_keys() == BOOT_KEY_DOWN_ARROW);
+ TEST_ASSERT(keyboard_scan_get_boot_keys() == BOOT_KEY_DOWN_ARROW);
+ return EC_SUCCESS;
}
void test_init(void)
@@ -587,7 +586,7 @@ static void run_test_step1(void)
else
RUN_TEST(debounce_test);
- if (0) /* crbug.com/976974 */
+ if (0) /* crbug.com/976974 */
RUN_TEST(simulate_key_test);
#ifdef EMU_BUILD
RUN_TEST(runtime_key_test);
@@ -646,7 +645,7 @@ int test_task(void *data)
return EC_SUCCESS;
}
-void run_test(int argc, char **argv)
+void run_test(int argc, const char **argv)
{
msleep(30); /* Wait for TASK_ID_TEST to initialize */
task_wake(TASK_ID_TEST);