Merge "Effect AIDL VTS: skip data path testing for offloading effects" into 24D1-dev

This commit is contained in:
Shunkai Yao 2024-03-14 16:58:44 +00:00 committed by Android (Google) Code Review
commit b2869538a7
5 changed files with 30 additions and 10 deletions

View file

@ -104,11 +104,13 @@ inline ::testing::AssertionResult assertResultOrUnknownTransaction(
EXPECT_PRED_FORMAT2(::android::hardware::audio::common::testing::detail::assertResult, \ EXPECT_PRED_FORMAT2(::android::hardware::audio::common::testing::detail::assertResult, \
expected, ret) expected, ret)
#define SKIP_TEST_IF_DATA_UNSUPPORTED(flags) \ #define SKIP_TEST_IF_DATA_UNSUPPORTED(flags) \
({ \ ({ \
if ((flags).hwAcceleratorMode == Flags::HardwareAccelerator::TUNNEL || (flags).bypass) { \ if ((flags).hwAcceleratorMode == \
GTEST_SKIP() << "Skip data path for offload"; \ aidl::android::hardware::audio::effect::Flags::HardwareAccelerator::TUNNEL || \
} \ (flags).bypass) { \
GTEST_SKIP() << "Skip data path for offload"; \
} \
}) })
// Test that the transaction status 'isOk' if it is a known transaction // Test that the transaction status 'isOk' if it is a known transaction

View file

@ -166,6 +166,7 @@ class BassBoostDataTest : public ::testing::TestWithParam<BassBoostDataTestParam
} }
void SetUp() override { void SetUp() override {
SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
ASSERT_NO_FATAL_FAILURE(SetUpBassBoost(mChannelLayout)); ASSERT_NO_FATAL_FAILURE(SetUpBassBoost(mChannelLayout));
if (int32_t version; if (int32_t version;
mEffect->getInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) { mEffect->getInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) {
@ -173,7 +174,10 @@ class BassBoostDataTest : public ::testing::TestWithParam<BassBoostDataTestParam
} }
} }
void TearDown() override { TearDownBassBoost(); } void TearDown() override {
SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
TearDownBassBoost();
}
// Find FFT bin indices for testFrequencies and get bin center frequencies // Find FFT bin indices for testFrequencies and get bin center frequencies
void roundToFreqCenteredToFftBin(std::vector<int>& testFrequencies, void roundToFreqCenteredToFftBin(std::vector<int>& testFrequencies,

View file

@ -230,6 +230,7 @@ class DownmixFoldDataTest : public ::testing::TestWithParam<DownmixDataTestParam
} }
void SetUp() override { void SetUp() override {
SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
SetUpDownmix(mInputChannelLayout); SetUpDownmix(mInputChannelLayout);
if (int32_t version; if (int32_t version;
mEffect->getInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) { mEffect->getInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) {
@ -241,7 +242,10 @@ class DownmixFoldDataTest : public ::testing::TestWithParam<DownmixDataTestParam
setDataTestParams(mInputChannelLayout); setDataTestParams(mInputChannelLayout);
} }
void TearDown() override { TearDownDownmix(); } void TearDown() override {
SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
TearDownDownmix();
}
void checkAtLeft(int32_t position) { void checkAtLeft(int32_t position) {
for (size_t i = 0, j = position; i < mOutputBufferSize; for (size_t i = 0, j = position; i < mOutputBufferSize;

View file

@ -156,6 +156,7 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance
} }
void SetUp() override { void SetUp() override {
SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
SetUpLoudnessEnhancer(); SetUpLoudnessEnhancer();
// Creating AidlMessageQueues // Creating AidlMessageQueues
@ -164,7 +165,10 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance
mOutputMQ = std::make_unique<EffectHelper::DataMQ>(mOpenEffectReturn.outputDataMQ); mOutputMQ = std::make_unique<EffectHelper::DataMQ>(mOpenEffectReturn.outputDataMQ);
} }
void TearDown() override { TearDownLoudnessEnhancer(); } void TearDown() override {
SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
TearDownLoudnessEnhancer();
}
// Fill inputBuffer with random values between -kMaxAudioSample to kMaxAudioSample // Fill inputBuffer with random values between -kMaxAudioSample to kMaxAudioSample
void generateInputBuffer() { void generateInputBuffer() {

View file

@ -163,8 +163,14 @@ class VolumeDataTest : public ::testing::TestWithParam<VolumeDataTestParam>,
// Convert Decibel value to Percentage // Convert Decibel value to Percentage
int percentageDb(float level) { return std::round((1 - (pow(10, level / 20))) * 100); } int percentageDb(float level) { return std::round((1 - (pow(10, level / 20))) * 100); }
void SetUp() override { ASSERT_NO_FATAL_FAILURE(SetUpVolumeControl()); } void SetUp() override {
void TearDown() override { TearDownVolumeControl(); } SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
ASSERT_NO_FATAL_FAILURE(SetUpVolumeControl());
}
void TearDown() override {
SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
TearDownVolumeControl();
}
static constexpr int kMaxAudioSample = 1; static constexpr int kMaxAudioSample = 1;
static constexpr int kTransitionDuration = 300; static constexpr int kTransitionDuration = 300;