summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKris Chen <chenkris@google.com>2019-01-11 20:41:23 +0800
committerKris Chen <chenkris@google.com>2019-01-11 20:41:23 +0800
commit2d712a046d7cee9b5ae3f5944dcbe01fc7ee02a9 (patch)
tree0da9cbabd7c6f83fae3a98f35f70d85dd29e86ed /tests
parent9cc8d3dabe72a8887af1b9951ad489a17a3daf2a (diff)
downloadandroid_hardware_knowles_athletico_sound_trigger_hal-2d712a046d7cee9b5ae3f5944dcbe01fc7ee02a9.tar.gz
android_hardware_knowles_athletico_sound_trigger_hal-2d712a046d7cee9b5ae3f5944dcbe01fc7ee02a9.tar.bz2
android_hardware_knowles_athletico_sound_trigger_hal-2d712a046d7cee9b5ae3f5944dcbe01fc7ee02a9.zip
oslo_config_test: stop oslo before disabling oslo route
Bug: 122711098 Test: Stress oslo ping test Change-Id: Ia38289678713495e105d1a81fa4ab3f34ee3726b
Diffstat (limited to 'tests')
-rw-r--r--tests/oslo_config_test.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/oslo_config_test.c b/tests/oslo_config_test.c
index 6856035..e0b3790 100644
--- a/tests/oslo_config_test.c
+++ b/tests/oslo_config_test.c
@@ -486,12 +486,24 @@ int oslo_plugin_setting_lookup(char *in)
return ret;
}
+void oslo_enable(struct ia_sensor_mgr *smd, bool enable) {
+ if (enable) {
+ osloSoundModelEnable(true);
+ oslo_driver_set_param(smd, OSLO_CONTROL_RESTART, 1);
+ }
+ else {
+ oslo_driver_set_param(smd, OSLO_CONTROL_STOP, 0);
+ sleep(1);
+ osloSoundModelEnable(false);
+ }
+}
+
bool ping_test(struct ia_sensor_mgr *smd, uint32_t ping_timeout_sec) {
bool ret = false;
uint32_t radar_frames_initial;
time_t start_time;
- osloSoundModelEnable(true);
+ oslo_enable(smd, true);
start_time = time(NULL);
radar_frames_initial = oslo_driver_get_param(smd, SENSOR_PARAM_FRAMES_PROCESSED);
@@ -508,7 +520,7 @@ bool ping_test(struct ia_sensor_mgr *smd, uint32_t ping_timeout_sec) {
usleep(50 * 1000); // 50ms
} while (difftime(time(NULL), start_time) <= ping_timeout_sec);
- osloSoundModelEnable(false);
+ oslo_enable(smd, false);
ALOGD("%s: %s", __func__, (ret ? "PASS" : "FAIL"));
fprintf(stdout, "%s: %s\n", __func__, (ret ? "PASS" : "FAIL"));
@@ -805,7 +817,7 @@ int main(int argc, char *argv[]) {
} else if ('p' == use_case) {
ping_test(smd, ping_timeout_sec);
} else if ('r' == use_case) {
- osloSoundModelEnable(route_enable);
+ oslo_enable(smd, route_enable);
} else if ('d' == use_case) {
read_register(smd, reg_addr);
} else if ('w' == use_case) {