Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71e94d72 authored by Ian Hua's avatar Ian Hua Committed by Automerger Merge Worker
Browse files

Add FL6 spec tests to AIDL VTS. am: ca46f976 am: 65a05848 am: 1a1d9d03 am: cc144fff

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1866682

Change-Id: Ie2b7ae91e0c021b0e97c4b1bbd94ab770f06c35b
parents 8d5db930 cc144fff
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
namespace aidl::android::hardware::neuralnetworks::utils {

constexpr auto kDefaultPriority = Priority::MEDIUM;
constexpr auto kVersion = nn::Version::ANDROID_S;
constexpr auto kVersion = nn::Version::FEATURE_LEVEL_6;

template <typename Type>
nn::Result<void> validate(const Type& halObject) {
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ cc_test {
        "neuralnetworks_utils_hal_aidl",
    ],
    whole_static_libs: [
        "neuralnetworks_generated_AIDL_V2_example",
        "neuralnetworks_generated_V1_0_example",
        "neuralnetworks_generated_V1_1_example",
        "neuralnetworks_generated_V1_2_example",
+14 −0
Original line number Diff line number Diff line
@@ -907,6 +907,20 @@ void GeneratedTestBase::SetUp() {
    const bool deviceIsResponsive =
            ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
    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) {
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@ class GeneratedTestBase : public testing::TestWithParam<GeneratedTestParam> {
    void SetUp() override;
    const std::shared_ptr<IDevice> kDevice = getData(std::get<NamedDevice>(GetParam()));
    const test_helper::TestModel& kTestModel = *getData(std::get<NamedModel>(GetParam()));

  private:
    void SkipIfDriverOlderThanTestModel();
};

using FilterFn = std::function<bool(const test_helper::TestModel&)>;
+6 −0
Original line number Diff line number Diff line
@@ -1122,6 +1122,7 @@ static bool removeOperationInputSkip(const Operation& op, size_t input) {
    //   align_corners and half_pixel_centers parameters.
    // - L2_NORMALIZATION, LOCAL_RESPONSE_NORMALIZATION, SOFTMAX can have an optional axis
    //   parameter.
    // - PACK has at least 2 inputs, with the first element being INT32.
    switch (op.type) {
        case OperationType::CONCATENATION: {
            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;
            }
        } break;
        case OperationType::PACK: {
            if (op.inputs.size() > 2 && input != 0) {
                return true;
            }
        } break;
        default:
            break;
    }