summaryrefslogtreecommitdiff
path: root/common/test_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/test_util.c')
-rw-r--r--common/test_util.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/common/test_util.c b/common/test_util.c
index 37cc42000c..f15b99f302 100644
--- a/common/test_util.c
+++ b/common/test_util.c
@@ -1,4 +1,4 @@
-/* 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.
*
@@ -29,23 +29,33 @@ struct test_util_tag {
int __test_error_count;
/* Weak reference function as an entry point for unit test */
-test_mockable void run_test(int argc, char **argv) { }
+test_mockable void run_test(int argc, const char **argv)
+{
+}
/* Default mock test init */
-test_mockable void test_init(void) { }
+test_mockable void test_init(void)
+{
+}
/* Default mock before test */
-test_mockable void before_test(void) { }
+test_mockable void before_test(void)
+{
+}
/* Default mock after test */
-test_mockable void after_test(void) { }
+test_mockable void after_test(void)
+{
+}
#ifdef TEST_COVERAGE
-extern void __gcov_flush(void);
+extern void __gcov_dump(void);
+extern void __gcov_reset(void);
void emulator_flush(void)
{
- __gcov_flush();
+ __gcov_dump();
+ __gcov_reset();
}
#else
void emulator_flush(void)
@@ -167,7 +177,7 @@ int test_send_host_command(int command, int version, const void *params,
return host_command_process(&args);
}
-#endif /* TASK_HAS_HOSTCMD */
+#endif /* TASK_HAS_HOSTCMD */
/* Linear congruential pseudo random number generator */
uint32_t prng(uint32_t seed)
@@ -188,8 +198,7 @@ static void restore_state(void)
tag = (const struct test_util_tag *)system_get_jump_tag(
TEST_UTIL_SYSJUMP_TAG, &version, &size);
- if (tag && version == TEST_UTIL_SYSJUMP_VERSION &&
- size == sizeof(*tag))
+ if (tag && version == TEST_UTIL_SYSJUMP_VERSION && size == sizeof(*tag))
__test_error_count = tag->error_count;
else
__test_error_count = 0;
@@ -205,13 +214,12 @@ static void preserve_state(void)
}
DECLARE_HOOK(HOOK_SYSJUMP, preserve_state, HOOK_PRIO_DEFAULT);
-static int command_run_test(int argc, char **argv)
+static int command_run_test(int argc, const char **argv)
{
run_test(argc, argv);
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(runtest, command_run_test,
- NULL, NULL);
+DECLARE_CONSOLE_COMMAND(runtest, command_run_test, NULL, NULL);
#ifndef CONFIG_ZEPHYR
void z_ztest_run_test_suite(const char *name, struct unit_test *suite)