From 8ea56db2af4d277c356c1292170ab44ca1436bd4 Mon Sep 17 00:00:00 2001 From: Nicholas Ambur Date: Mon, 30 Mar 2020 19:21:04 -0700 Subject: [PATCH 1/2] remove duplicate soundtrigger VTS tests SoundTrigger VTS tests were duplicated in minor version updates. This is not required and thus removed. Bug: 151281377 Test: atest VtsHalSoundtriggerV2_0TargetTest && atest VtsHalSoundtriggerV2_1TargetTest Change-Id: I60cfbe664cf7c38b2894d3e5f0df824737854c82 --- .../VtsHalSoundtriggerV2_1TargetTest.cpp | 165 ------------------ 1 file changed, 165 deletions(-) diff --git a/soundtrigger/2.1/vts/functional/VtsHalSoundtriggerV2_1TargetTest.cpp b/soundtrigger/2.1/vts/functional/VtsHalSoundtriggerV2_1TargetTest.cpp index 7f06ed9199..392679d0cb 100644 --- a/soundtrigger/2.1/vts/functional/VtsHalSoundtriggerV2_1TargetTest.cpp +++ b/soundtrigger/2.1/vts/functional/VtsHalSoundtriggerV2_1TargetTest.cpp @@ -171,61 +171,6 @@ class SoundTriggerHidlTest : public ::testing::TestWithParam { sp mCallback; }; -/** - * Test ISoundTriggerHw::getProperties() method - * - * Verifies that: - * - the implementation implements the method - * - the method returns 0 (no error) - * - the implementation supports at least one sound model and one key phrase - * - the implementation supports at least VOICE_TRIGGER recognition mode - */ -TEST_P(SoundTriggerHidlTest, GetProperties) { - ISoundTriggerHw::Properties halProperties; - Return hidlReturn; - int ret = -ENODEV; - - hidlReturn = mSoundTriggerHal->getProperties([&](int rc, auto res) { - ret = rc; - halProperties = res; - }); - - EXPECT_TRUE(hidlReturn.isOk()); - EXPECT_EQ(0, ret); - EXPECT_GT(halProperties.maxSoundModels, 0u); - EXPECT_GT(halProperties.maxKeyPhrases, 0u); - EXPECT_NE(0u, (halProperties.recognitionModes & (uint32_t)RecognitionMode::VOICE_TRIGGER)); -} - -/** - * Test ISoundTriggerHw::loadPhraseSoundModel() method - * - * Verifies that: - * - the implementation implements the method - * - the implementation returns an error when passed a malformed sound model - * - * There is no way to verify that implementation actually can load a sound model because each - * sound model is vendor specific. - */ -TEST_P(SoundTriggerHidlTest, LoadInvalidModelFail) { - Return hidlReturn; - int ret = -ENODEV; - V2_0_ISoundTriggerHw::PhraseSoundModel model; - SoundModelHandle handle; - - model.common.type = SoundModelType::UNKNOWN; - - hidlReturn = - mSoundTriggerHal->loadPhraseSoundModel(model, mCallback, 0, [&](int32_t retval, auto res) { - ret = retval; - handle = res; - }); - - EXPECT_TRUE(hidlReturn.isOk()); - EXPECT_NE(0, ret); - EXPECT_FALSE(monitor.wait(SHORT_TIMEOUT_PERIOD)); -} - /** * Test ISoundTriggerHw::loadPhraseSoundModel_2_1() method * @@ -279,34 +224,6 @@ TEST_P(SoundTriggerHidlTest, LoadEmptyGenericSoundModelFail) { EXPECT_FALSE(monitor.wait(SHORT_TIMEOUT_PERIOD)); } -/** - * Test ISoundTriggerHw::loadSoundModel() method - * - * Verifies that: - * - the implementation returns error when passed a sound model with random data. - */ -TEST_P(SoundTriggerHidlTest, LoadGenericSoundModelFail) { - int ret = -ENODEV; - V2_0_ISoundTriggerHw::SoundModel model; - SoundModelHandle handle = 0; - - model.type = SoundModelType::GENERIC; - model.data.resize(100); - for (auto& d : model.data) { - d = rand(); - } - - Return loadReturn = - mSoundTriggerHal->loadSoundModel(model, mCallback, 0, [&](int32_t retval, auto res) { - ret = retval; - handle = res; - }); - - EXPECT_TRUE(loadReturn.isOk()); - EXPECT_NE(0, ret); - EXPECT_FALSE(monitor.wait(SHORT_TIMEOUT_PERIOD)); -} - /** * Test ISoundTriggerHw::loadSoundModel_2_1() method * @@ -370,54 +287,6 @@ TEST_P(SoundTriggerHidlTest, LoadGenericSoundModelFail_2_1) { EXPECT_FALSE(monitor.wait(SHORT_TIMEOUT_PERIOD)); } -/** - * Test ISoundTriggerHw::unloadSoundModel() method - * - * Verifies that: - * - the implementation implements the method - * - the implementation returns an error when called without a valid loaded sound model - * - */ -TEST_P(SoundTriggerHidlTest, UnloadModelNoModelFail) { - Return hidlReturn(0); - SoundModelHandle halHandle = 0; - - hidlReturn = mSoundTriggerHal->unloadSoundModel(halHandle); - - EXPECT_TRUE(hidlReturn.isOk()); - EXPECT_NE(0, hidlReturn); -} - -/** - * Test ISoundTriggerHw::startRecognition() method - * - * Verifies that: - * - the implementation implements the method - * - the implementation returns an error when called without a valid loaded sound model - * - * There is no way to verify that implementation actually starts recognition because no model can - * be loaded. - */ -TEST_P(SoundTriggerHidlTest, StartRecognitionNoModelFail) { - Return hidlReturn(0); - SoundModelHandle handle = 0; - PhraseRecognitionExtra phrase; - V2_0_ISoundTriggerHw::RecognitionConfig config; - - config.captureHandle = 0; - config.captureDevice = AudioDevice::IN_BUILTIN_MIC; - phrase.id = 0; - phrase.recognitionModes = (uint32_t)RecognitionMode::VOICE_TRIGGER; - phrase.confidenceLevel = 0; - - config.phrases.setToExternal(&phrase, 1); - - hidlReturn = mSoundTriggerHal->startRecognition(handle, config, mCallback, 0); - - EXPECT_TRUE(hidlReturn.isOk()); - EXPECT_NE(0, hidlReturn); -} - /** * Test ISoundTriggerHw::startRecognition_2_1() method * @@ -448,40 +317,6 @@ TEST_P(SoundTriggerHidlTest, StartRecognitionNoModelFail_2_1) { EXPECT_NE(0, hidlReturn); } -/** - * Test ISoundTriggerHw::stopRecognition() method - * - * Verifies that: - * - the implementation implements the method - * - the implementation returns an error when called without an active recognition running - * - */ -TEST_P(SoundTriggerHidlTest, StopRecognitionNoAStartFail) { - Return hidlReturn(0); - SoundModelHandle handle = 0; - - hidlReturn = mSoundTriggerHal->stopRecognition(handle); - - EXPECT_TRUE(hidlReturn.isOk()); - EXPECT_NE(0, hidlReturn); -} - -/** - * Test ISoundTriggerHw::stopAllRecognitions() method - * - * Verifies that: - * - the implementation implements this optional method or indicates it is not supported by - * returning -ENOSYS - */ -TEST_P(SoundTriggerHidlTest, stopAllRecognitions) { - Return hidlReturn(0); - - hidlReturn = mSoundTriggerHal->stopAllRecognitions(); - - EXPECT_TRUE(hidlReturn.isOk()); - EXPECT_TRUE(hidlReturn == 0 || hidlReturn == -ENOSYS); -} - INSTANTIATE_TEST_SUITE_P( PerInstance, SoundTriggerHidlTest, testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISoundTriggerHw::descriptor)), From 34de57d194a87a506c26b6054a05622a876e7099 Mon Sep 17 00:00:00 2001 From: Nicholas Ambur Date: Fri, 27 Mar 2020 10:57:44 -0700 Subject: [PATCH 2/2] remove stopAllRecognitions VTS test The stopAllRecognitions API is not used at the layers above the HAL, and it requires the HAL to own the state of all active recognitions. This API causes discontinuity with the upper layers also maintaining state information. The VTS requirement is being removed. Bug: 151281377 Test: atest VtsHalSoundtriggerV2_0TargetTest && atest VtsHalSoundtriggerV2_1TargetTest Change-Id: If14ed8177e0ff2730d2ed78ba8fbbbd058c4d57a --- .../VtsHalSoundtriggerV2_0TargetTest.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp b/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp index d7a7d08728..63edec570a 100644 --- a/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp +++ b/soundtrigger/2.0/vts/functional/VtsHalSoundtriggerV2_0TargetTest.cpp @@ -293,22 +293,6 @@ TEST_P(SoundTriggerHidlTest, StopRecognitionNoAStartFail) { EXPECT_NE(0, hidlReturn); } -/** - * Test ISoundTriggerHw::stopAllRecognitions() method - * - * Verifies that: - * - the implementation implements this optional method or indicates it is not support by - * returning -ENOSYS - */ -TEST_P(SoundTriggerHidlTest, stopAllRecognitions) { - Return hidlReturn(0); - - hidlReturn = mSoundTriggerHal->stopAllRecognitions(); - - EXPECT_TRUE(hidlReturn.isOk()); - EXPECT_TRUE(hidlReturn == 0 || hidlReturn == -ENOSYS); -} - INSTANTIATE_TEST_SUITE_P( PerInstance, SoundTriggerHidlTest, testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISoundTriggerHw::descriptor)),