audio: Add flags to makefiles
Enable GCOV if config is set to true. Also
add gcov_flush in source files to get enhanced
code coverage.
Change-Id: I39776cc6d6f16cd23da05b66669eea22fc4cba81
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 79be457..fb7fffc 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -449,6 +449,18 @@
static int out_set_voip_volume(struct audio_stream_out *stream, float left, float right);
static int out_set_pcm_volume(struct audio_stream_out *stream, float left, float right);
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
static bool may_use_noirq_mode(struct audio_device *adev, audio_usecase_t uc_id,
int flags __unused)
{
@@ -2411,7 +2423,7 @@
free(uc_info);
adev->active_input = get_next_active_input(adev);
-
+ enable_gcov();
ALOGV("%s: exit: status(%d)", __func__, ret);
return ret;
}
@@ -2587,7 +2599,7 @@
done_open:
audio_extn_perf_lock_release(&adev->perf_lock_handle);
ALOGD("%s: exit", __func__);
-
+ enable_gcov();
return ret;
error_open:
@@ -2601,7 +2613,7 @@
*/
usleep(50000);
ALOGD("%s: exit: status(%d)", __func__, ret);
-
+ enable_gcov();
return ret;
}
@@ -3294,6 +3306,7 @@
platform_set_swap_channels(adev, true);
ATRACE_END();
+ enable_gcov();
return ret;
error_open:
audio_extn_perf_lock_release(&adev->perf_lock_handle);
@@ -3305,6 +3318,7 @@
*/
usleep(50000);
ATRACE_END();
+ enable_gcov();
return ret;
}
@@ -7504,7 +7518,7 @@
adev = NULL;
}
pthread_mutex_unlock(&adev_init_lock);
-
+ enable_gcov();
return 0;
}