From e4c7a967896068028ec9445000b4e5733c0807a7 Mon Sep 17 00:00:00 2001 From: Jaideep Sharma Date: Wed, 14 Jun 2023 19:14:44 +0530 Subject: [PATCH] aidl: Improve Effect VTS naming Use uuid in hexadecimal format in testcase name. Change-Id: Ib687b6617060e4400a767f23ca0b26cece4005f1 --- audio/aidl/vts/EffectHelper.h | 11 ++++++++++- audio/aidl/vts/VtsHalAECTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalAGC1TargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalAGC2TargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp | 9 +++++++-- audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp | 5 +---- audio/aidl/vts/VtsHalBassBoostTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalDownmixTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp | 4 +--- .../aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalEqualizerTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalNSTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalVisualizerTargetTest.cpp | 4 +--- audio/aidl/vts/VtsHalVolumeTargetTest.cpp | 4 +--- 18 files changed, 33 insertions(+), 52 deletions(-) diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h index 4e84f6bc7b..a1353f5bbd 100644 --- a/audio/aidl/vts/EffectHelper.h +++ b/audio/aidl/vts/EffectHelper.h @@ -32,12 +32,14 @@ #include #include #include +#include #include "AudioHalBinderServiceUtil.h" #include "EffectFactoryHelper.h" #include "TestUtils.h" using namespace android; +using ::android::audio::utils::toString; using aidl::android::hardware::audio::effect::CommandId; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::IEffect; @@ -63,6 +65,13 @@ typedef ::android::AidlMessageQueue DataMQ; +static inline std::string getPrefix(Descriptor &descriptor) { + std::string prefix = "Implementor_" + descriptor.common.implementor + "_name_" + + descriptor.common.name + "_UUID_" + + toString(descriptor.common.id.uuid); + return prefix; +} + class EffectHelper { public: static void create(std::shared_ptr factory, std::shared_ptr& effect, @@ -71,7 +80,7 @@ class EffectHelper { auto& id = desc.common.id; ASSERT_STATUS(status, factory->createEffect(id.uuid, &effect)); if (status == EX_NONE) { - ASSERT_NE(effect, nullptr) << id.uuid.toString(); + ASSERT_NE(effect, nullptr) << toString(id.uuid); } } diff --git a/audio/aidl/vts/VtsHalAECTargetTest.cpp b/audio/aidl/vts/VtsHalAECTargetTest.cpp index 8828c41bbe..4f658f227b 100644 --- a/audio/aidl/vts/VtsHalAECTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAECTargetTest.cpp @@ -162,9 +162,7 @@ INSTANTIATE_TEST_SUITE_P( auto descriptor = std::get(info.param).second; std::string echoDelay = std::to_string(std::get(info.param)); std::string mobileMode = std::get(info.param) ? "true" : "false"; - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_EchoDelay_" + echoDelay + + std::string name = getPrefix(descriptor) + "_EchoDelay_" + echoDelay + "_MobileMode_" + mobileMode; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); diff --git a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp index edfcdf6fce..cc00763399 100644 --- a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp +++ b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp @@ -177,9 +177,7 @@ INSTANTIATE_TEST_SUITE_P( std::to_string(std::get(info.param)); std::string enableLimiter = std::to_string(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_target_peak_level_" + + std::string name = getPrefix(descriptor) + "_target_peak_level_" + targetPeakLevel + "_max_compression_gain_" + maxCompressionGain + "_enable_limiter_" + enableLimiter; std::replace_if( diff --git a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp index 8ba8e45566..46a569ef92 100644 --- a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp +++ b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp @@ -183,9 +183,7 @@ INSTANTIATE_TEST_SUITE_P( std::string margin = std::to_string(static_cast(std::get(info.param))); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_digital_gain_" + gain + + std::string name = getPrefix(descriptor) + "_digital_gain_" + gain + "_level_estimator_" + estimator + "_margin_" + margin; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp index 9cd6c22c7c..8084a594e0 100644 --- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp @@ -36,6 +36,11 @@ #include "EffectFactoryHelper.h" #include "TestUtils.h" +#include + +using namespace android; +using ::android::audio::utils::toString; + using namespace android; using aidl::android::hardware::audio::effect::Descriptor; @@ -93,7 +98,7 @@ class EffectFactoryTest : public testing::TestWithParam { std::shared_ptr effect; EXPECT_STATUS(expectStatus, mEffectFactory->createEffect(uuid, &effect)); if (expectStatus == EX_NONE) { - EXPECT_NE(effect, nullptr) << " null effect with uuid: " << uuid.toString(); + EXPECT_NE(effect, nullptr) << " null effect with uuid: " << toString(uuid); effects.push_back(std::move(effect)); } } @@ -148,7 +153,7 @@ TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) { } std::string msg = " missing type UUID:\n"; for (const auto& uuid : typeUuidSet) { - msg += (uuid.toString() + "\n"); + msg += (toString(uuid) + "\n"); } SCOPED_TRACE(msg); EXPECT_EQ(0UL, typeUuidSet.size()); diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp index 436f2a3164..4ad9b2ddae 100644 --- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp @@ -848,10 +848,7 @@ INSTANTIATE_TEST_SUITE_P( EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor))), [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_TYPE_" + - descriptor.common.id.type.toString() + "_UUID_" + - descriptor.common.id.uuid.toString(); + std::string name = getPrefix(descriptor); std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp index 9cfdc50a2c..afddb841ee 100644 --- a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp +++ b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp @@ -145,9 +145,7 @@ INSTANTIATE_TEST_SUITE_P( [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; std::string strength = std::to_string(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_strength_" + strength; + std::string name = getPrefix(descriptor) + "_strength_" + strength; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp index 5aeebde1a0..7a2f31bfe5 100644 --- a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp +++ b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp @@ -126,9 +126,7 @@ INSTANTIATE_TEST_SUITE_P( [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; std::string type = std::to_string(static_cast(std::get(info.param))); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_type" + type; + std::string name = getPrefix(descriptor) + "_type" + type; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp index 033e3b5f3f..5509c76eb9 100644 --- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp +++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp @@ -513,9 +513,7 @@ INSTANTIATE_TEST_SUITE_P( auto descriptor = std::get(info.param).second; DynamicsProcessing::EngineArchitecture cfg; fillEngineArchConfig(cfg, info.param); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_Cfg_" + cfg.toString(); + std::string name = getPrefix(descriptor) + "_Cfg_" + cfg.toString(); std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp index 05c2c5b5e6..f2ef185950 100644 --- a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp +++ b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp @@ -209,9 +209,7 @@ INSTANTIATE_TEST_SUITE_P( auto descriptor = std::get<0>(info.param).second; std::string roomLevel = std::to_string(std::get<1>(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_roomLevel" + roomLevel; + std::string name = getPrefix(descriptor) + "_roomLevel" + roomLevel; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp index 716a2c67b5..37e7c0a0ff 100644 --- a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp @@ -209,9 +209,7 @@ INSTANTIATE_TEST_SUITE_P( auto descriptor = std::get(info.param).second; std::string bandLevel = ::android::internal::ToString(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_preset_" + + std::string name = getPrefix(descriptor) + "_preset_" + std::to_string(std::get(info.param)) + "_bandLevel_" + bandLevel; std::replace_if( diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp index 7c79d1bfab..d417e86110 100644 --- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp +++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp @@ -195,9 +195,7 @@ INSTANTIATE_TEST_SUITE_P( std::to_string(std::get(info.param)); std::string maxAmplitude = std::to_string(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_hapticScaleId" + + std::string name = getPrefix(descriptor) + "_hapticScaleId" + hapticScaleID + "_hapticScaleVibScale" + hapticScaleVibScale + "_resonantFrequency" + resonantFrequency + "_qFactor" + qFactor + "_maxAmplitude" + maxAmplitude; diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp index 96b048ed18..cbb80a9101 100644 --- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp @@ -131,9 +131,7 @@ INSTANTIATE_TEST_SUITE_P( [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; std::string gainMb = std::to_string(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_gainMb_" + gainMb; + std::string name = getPrefix(descriptor) + "_gainMb_" + gainMb; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalNSTargetTest.cpp b/audio/aidl/vts/VtsHalNSTargetTest.cpp index 5525c80894..7c8b2e58cc 100644 --- a/audio/aidl/vts/VtsHalNSTargetTest.cpp +++ b/audio/aidl/vts/VtsHalNSTargetTest.cpp @@ -155,9 +155,7 @@ INSTANTIATE_TEST_SUITE_P( std::get(info.param)); std::string type = aidl::android::hardware::audio::effect::toString( std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_level_" + level + "_type_" + + std::string name = getPrefix(descriptor) + "_level_" + level + "_type_" + type; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); diff --git a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp index 8fb4ebf339..3056c6c1cc 100644 --- a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp +++ b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp @@ -137,9 +137,7 @@ INSTANTIATE_TEST_SUITE_P( auto descriptor = std::get(info.param).second; std::string preset = std::to_string(static_cast(std::get(info.param))); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_preset" + preset; + std::string name = getPrefix(descriptor) + "_preset" + preset; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp index 6b1da6388e..07a9fa4e70 100644 --- a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp @@ -141,9 +141,7 @@ INSTANTIATE_TEST_SUITE_P( [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; std::string strength = std::to_string(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_strength" + strength; + std::string name = getPrefix(descriptor) + "_strength" + strength; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); return name; diff --git a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp index f41ba30b12..903ba696be 100644 --- a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp @@ -195,9 +195,7 @@ INSTANTIATE_TEST_SUITE_P( std::get(info.param)); std::string latency = std::to_string(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_captureSize" + captureSize + + std::string name = getPrefix(descriptor) + "_captureSize" + captureSize + "_scalingMode" + scalingMode + "_measurementMode" + measurementMode + "_latency" + latency; std::replace_if( diff --git a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp index 90b7f37946..9193a360ff 100644 --- a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp @@ -149,9 +149,7 @@ INSTANTIATE_TEST_SUITE_P( auto descriptor = std::get(info.param).second; std::string level = std::to_string(std::get(info.param)); std::string mute = std::to_string(std::get(info.param)); - std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + - descriptor.common.name + "_UUID_" + - descriptor.common.id.uuid.toString() + "_level" + level + "_mute" + + std::string name = getPrefix(descriptor) + "_level" + level + "_mute" + mute; std::replace_if( name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');