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

Commit 17bc5781 authored by Eva Chen's avatar Eva Chen
Browse files

Update VtsHalAutomotiveVehicleTargetTest::verifyProperty to only run on implemented properties.

Bug: 264730687
Test: atest VtsHalAutomotiveVehicle_TargetTest
Change-Id: I027e2324f30b34600bc1036bfcdd1547b245667f
parent 7443fb11
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -438,13 +438,30 @@ void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId,
    int expectedArea = toInt(area);
    int expectedPropertyType = toInt(propertyType);

    auto result = mVhalClient->getPropConfigs({expectedPropId});
    ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
    auto result = mVhalClient->getAllPropConfigs();
    ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: "
                             << result.error().message();

    if (result.value().size() == 0) {
        GTEST_SKIP() << "Property has not been implemented";
    // Check if property is implemented by getting all configs and looking to see if the expected
    // property id is in that list.
    bool isExpectedPropIdImplemented = false;
    for (const auto& cfgPtr : result.value()) {
        const IHalPropConfig& cfg = *cfgPtr;
        if (expectedPropId == cfg.getPropId()) {
            isExpectedPropIdImplemented = true;
            break;
        }
    }

    if (!isExpectedPropIdImplemented) {
        GTEST_SKIP() << StringPrintf("Property %" PRId32 " has not been implemented",
                                     expectedPropId);
    }

    result = mVhalClient->getPropConfigs({expectedPropId});
    ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: "
                             << result.error().message();

    ASSERT_EQ(result.value().size(), 1u)
            << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size());