summaryrefslogtreecommitdiff
path: root/common/test_util.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-09-01 10:34:14 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-04 20:32:45 +0000
commitf2046ce3dc510b7c5c2673d291d199cae70fb9d1 (patch)
treee5dec022d61134c0993dc60acf548808b93ae752 /common/test_util.c
parent1764246ee90ccac33bc1e9242c030999c9130fbb (diff)
downloadchrome-ec-f2046ce3dc510b7c5c2673d291d199cae70fb9d1.tar.gz
Flush test coverage information before rebooting emulator
If we reboots the emulator without flushing test coverage information, the test coverage report will be incorrect. Let's fix this by flushing it before every reboot. BUG=chrome-os-partner:19235 TEST=Generate test coverage report and check correctness. BRANCH=None Change-Id: I1eb060e419b767f382325bed841366c491ba56b7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/167770 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/test_util.c')
-rw-r--r--common/test_util.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/common/test_util.c b/common/test_util.c
index c133ac9d24..d944cca4b6 100644
--- a/common/test_util.c
+++ b/common/test_util.c
@@ -21,9 +21,14 @@ test_mockable void run_test(void) { }
#ifdef TEST_COVERAGE
extern void __gcov_flush(void);
-void test_end_hook(int sig)
+void emulator_flush(void)
{
__gcov_flush();
+}
+
+void test_end_hook(int sig)
+{
+ emulator_flush();
exit(0);
}
@@ -32,6 +37,10 @@ void register_test_end_hook(void)
signal(SIGTERM, test_end_hook);
}
#else
+void emulator_flush(void)
+{
+}
+
void register_test_end_hook(void)
{
}