summaryrefslogtreecommitdiff
path: root/test/kb_mkbp.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/kb_mkbp.c')
-rw-r--r--test/kb_mkbp.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/test/kb_mkbp.c b/test/kb_mkbp.c
index a8e57bfe57..fc7a9255de 100644
--- a/test/kb_mkbp.c
+++ b/test/kb_mkbp.c
@@ -13,10 +13,9 @@
#include "keyboard_mkbp.h"
#include "keyboard_protocol.h"
#include "keyboard_scan.h"
+#include "test_util.h"
#include "util.h"
-static int error_count;
-
static uint8_t state[KEYBOARD_COLS];
static int ec_int_level;
@@ -44,24 +43,6 @@ int lid_is_open(void)
/*****************************************************************************/
/* Test utilities */
-#define RUN_TEST(n) \
- do { \
- ccprintf("Running %s...", #n); \
- cflush(); \
- if (n() == EC_SUCCESS) { \
- ccputs("OK\n"); \
- } else { \
- ccputs("Fail\n"); \
- error_count++; \
- } \
- } while (0)
-
-#define TEST_ASSERT(n) \
- do { \
- if (!(n)) \
- return EC_ERROR_UNKNOWN; \
- } while (0)
-
#define FIFO_EMPTY() (ec_int_level == 1)
#define FIFO_NOT_EMPTY() (ec_int_level == 0)
@@ -227,24 +208,13 @@ int fifo_underrun(void)
void run_test(void)
{
- error_count = 0;
ec_int_level = 1;
+ test_reset();
RUN_TEST(single_key_press);
RUN_TEST(test_fifo_size);
RUN_TEST(test_enable);
RUN_TEST(fifo_underrun);
- if (error_count == 0)
- ccprintf("Pass!\n");
- else
- ccprintf("Fail!\n");
-}
-
-static int command_run_test(int argc, char **argv)
-{
- run_test();
- return EC_SUCCESS;
+ test_print_result();
}
-DECLARE_CONSOLE_COMMAND(runtest, command_run_test,
- NULL, NULL, NULL);