From ab5538fa85c228176c33ee2795cde5e61a075224 Mon Sep 17 00:00:00 2001 From: Gowtham Anandha Babu Date: Wed, 14 Oct 2015 16:07:18 +0530 Subject: [PATCH] shared/tester: Fix divide by zero error Before adding a check - o/p: Total: 0, Passed: 0 (-nan%), Failed: 0, Not Run: 0 After check - o/p: Total: 0, Passed: 0 (0.0%), Failed: 0, Not Run: 0 Git repo link: https://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=27f39bc20ef9c8eb7a60373700fbb2a62df20a79 Change-Id: If7363fd0d43040c88ea9b8d0dff7dc32f71fe0de --- src/shared/tester.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/tester.c b/src/shared/tester.c index ffcc2ea..a49fe04 100644 --- a/src/shared/tester.c +++ b/src/shared/tester.c @@ -315,7 +315,8 @@ static int tester_summarize(void) COLOR_RED "Failed: %d" COLOR_OFF ", " COLOR_YELLOW "Not Run: %d" COLOR_OFF "\n", not_run + passed + failed, passed, - (float) passed * 100 / (not_run + passed + failed), + (not_run + passed + failed) ? + (float) passed * 100 / (not_run + passed + failed) : 0, failed, not_run); execution_time = g_timer_elapsed(test_timer, NULL); -- 2.7.4