mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Add FL6 spec tests to AIDL VTS.
Also skip FL6 (AIDL_V2) tests for older AIDL drivers. Bug: 203038813 Test: VtsHalNeuralnetworksTargetTest Specifically, for old driver such as AIDL_V1 sample driver, it can pass HIDL tests and skip AIDL_V2 tests. For new driver such as AIDL_V2 sample driver, it can pass all tests. Change-Id: I689fef0945428f6548977628e3c43628dd1e5bf7
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
namespace aidl::android::hardware::neuralnetworks::utils {
|
namespace aidl::android::hardware::neuralnetworks::utils {
|
||||||
|
|
||||||
constexpr auto kDefaultPriority = Priority::MEDIUM;
|
constexpr auto kDefaultPriority = Priority::MEDIUM;
|
||||||
constexpr auto kVersion = nn::Version::ANDROID_S;
|
constexpr auto kVersion = nn::Version::FEATURE_LEVEL_6;
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
nn::Result<void> validate(const Type& halObject) {
|
nn::Result<void> validate(const Type& halObject) {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ cc_test {
|
|||||||
"neuralnetworks_utils_hal_aidl",
|
"neuralnetworks_utils_hal_aidl",
|
||||||
],
|
],
|
||||||
whole_static_libs: [
|
whole_static_libs: [
|
||||||
|
"neuralnetworks_generated_AIDL_V2_example",
|
||||||
"neuralnetworks_generated_V1_0_example",
|
"neuralnetworks_generated_V1_0_example",
|
||||||
"neuralnetworks_generated_V1_1_example",
|
"neuralnetworks_generated_V1_1_example",
|
||||||
"neuralnetworks_generated_V1_2_example",
|
"neuralnetworks_generated_V1_2_example",
|
||||||
|
|||||||
@@ -907,6 +907,20 @@ void GeneratedTestBase::SetUp() {
|
|||||||
const bool deviceIsResponsive =
|
const bool deviceIsResponsive =
|
||||||
ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
|
ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
|
||||||
ASSERT_TRUE(deviceIsResponsive);
|
ASSERT_TRUE(deviceIsResponsive);
|
||||||
|
// TODO(b/201260787): We should require old drivers to report the model as
|
||||||
|
// unsupported instead of simply skipping the test.
|
||||||
|
SkipIfDriverOlderThanTestModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeneratedTestBase::SkipIfDriverOlderThanTestModel() {
|
||||||
|
int32_t deviceVersion;
|
||||||
|
ASSERT_TRUE(kDevice->getInterfaceVersion(&deviceVersion).isOk());
|
||||||
|
const int32_t modelVersion = kTestModel.getAidlVersionInt();
|
||||||
|
if (deviceVersion < modelVersion) {
|
||||||
|
GTEST_SKIP() << "Device interface version " << deviceVersion
|
||||||
|
<< " is older than test model's minimum supported HAL version " << modelVersion
|
||||||
|
<< ". Skipping test.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
|
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ class GeneratedTestBase : public testing::TestWithParam<GeneratedTestParam> {
|
|||||||
void SetUp() override;
|
void SetUp() override;
|
||||||
const std::shared_ptr<IDevice> kDevice = getData(std::get<NamedDevice>(GetParam()));
|
const std::shared_ptr<IDevice> kDevice = getData(std::get<NamedDevice>(GetParam()));
|
||||||
const test_helper::TestModel& kTestModel = *getData(std::get<NamedModel>(GetParam()));
|
const test_helper::TestModel& kTestModel = *getData(std::get<NamedModel>(GetParam()));
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SkipIfDriverOlderThanTestModel();
|
||||||
};
|
};
|
||||||
|
|
||||||
using FilterFn = std::function<bool(const test_helper::TestModel&)>;
|
using FilterFn = std::function<bool(const test_helper::TestModel&)>;
|
||||||
|
|||||||
@@ -1122,6 +1122,7 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) {
|
|||||||
// align_corners and half_pixel_centers parameters.
|
// align_corners and half_pixel_centers parameters.
|
||||||
// - L2_NORMALIZATION, LOCAL_RESPONSE_NORMALIZATION, SOFTMAX can have an optional axis
|
// - L2_NORMALIZATION, LOCAL_RESPONSE_NORMALIZATION, SOFTMAX can have an optional axis
|
||||||
// parameter.
|
// parameter.
|
||||||
|
// - PACK has at least 2 inputs, with the first element being INT32.
|
||||||
switch (op.type) {
|
switch (op.type) {
|
||||||
case OperationType::CONCATENATION: {
|
case OperationType::CONCATENATION: {
|
||||||
if (op.inputs.size() > 2 && input != op.inputs.size() - 1) {
|
if (op.inputs.size() > 2 && input != op.inputs.size() - 1) {
|
||||||
@@ -1178,6 +1179,11 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case OperationType::PACK: {
|
||||||
|
if (op.inputs.size() > 2 && input != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user