Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "VtsHalAutomotiveVehicle" |
| 18 | |
| 19 | #include <IVhalClient.h> |
| 20 | #include <VehicleHalTypes.h> |
| 21 | #include <VehicleUtils.h> |
| 22 | #include <aidl/Gtest.h> |
| 23 | #include <aidl/Vintf.h> |
| 24 | #include <aidl/android/hardware/automotive/vehicle/IVehicle.h> |
| 25 | #include <android-base/stringprintf.h> |
| 26 | #include <android-base/thread_annotations.h> |
| 27 | #include <android/binder_process.h> |
Yu Shan | 928062c | 2024-01-25 17:40:41 -0800 | [diff] [blame] | 28 | #include <android/hardware/automotive/vehicle/2.0/IVehicle.h> |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 29 | #include <gtest/gtest.h> |
| 30 | #include <hidl/GtestPrinter.h> |
| 31 | #include <hidl/ServiceManagement.h> |
| 32 | #include <inttypes.h> |
| 33 | #include <utils/Log.h> |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 34 | #include <utils/SystemClock.h> |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 35 | |
| 36 | #include <chrono> |
| 37 | #include <mutex> |
| 38 | #include <unordered_map> |
| 39 | #include <unordered_set> |
| 40 | #include <vector> |
| 41 | |
| 42 | using ::aidl::android::hardware::automotive::vehicle::IVehicle; |
| 43 | using ::aidl::android::hardware::automotive::vehicle::StatusCode; |
| 44 | using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; |
| 45 | using ::aidl::android::hardware::automotive::vehicle::VehicleArea; |
| 46 | using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; |
| 47 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 48 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; |
| 49 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 50 | using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; |
| 51 | using ::android::getAidlHalInstanceNames; |
| 52 | using ::android::base::ScopedLockAssertion; |
| 53 | using ::android::base::StringPrintf; |
Chen Cheng | faf9adc | 2022-06-22 23:09:09 +0000 | [diff] [blame] | 54 | using ::android::frameworks::automotive::vhal::ErrorCode; |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 55 | using ::android::frameworks::automotive::vhal::HalPropError; |
| 56 | using ::android::frameworks::automotive::vhal::IHalPropConfig; |
| 57 | using ::android::frameworks::automotive::vhal::IHalPropValue; |
| 58 | using ::android::frameworks::automotive::vhal::ISubscriptionCallback; |
| 59 | using ::android::frameworks::automotive::vhal::IVhalClient; |
| 60 | using ::android::hardware::getAllHalInstanceNames; |
| 61 | using ::android::hardware::Sanitize; |
| 62 | using ::android::hardware::automotive::vehicle::toInt; |
| 63 | |
| 64 | constexpr int32_t kInvalidProp = 0x31600207; |
| 65 | |
| 66 | struct ServiceDescriptor { |
| 67 | std::string name; |
| 68 | bool isAidlService; |
| 69 | }; |
| 70 | |
| 71 | class VtsVehicleCallback final : public ISubscriptionCallback { |
| 72 | private: |
| 73 | std::mutex mLock; |
| 74 | std::unordered_map<int32_t, size_t> mEventsCount GUARDED_BY(mLock); |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 75 | std::unordered_map<int32_t, std::vector<int64_t>> mEventTimestamps GUARDED_BY(mLock); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 76 | std::condition_variable mEventCond; |
| 77 | |
| 78 | public: |
| 79 | void onPropertyEvent(const std::vector<std::unique_ptr<IHalPropValue>>& values) override { |
| 80 | { |
| 81 | std::lock_guard<std::mutex> lockGuard(mLock); |
| 82 | for (auto& value : values) { |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 83 | int32_t propId = value->getPropId(); |
| 84 | mEventsCount[propId] += 1; |
| 85 | mEventTimestamps[propId].push_back(value->getTimestamp()); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 86 | } |
| 87 | } |
| 88 | mEventCond.notify_one(); |
| 89 | } |
| 90 | |
| 91 | void onPropertySetError([[maybe_unused]] const std::vector<HalPropError>& errors) override { |
| 92 | // Do nothing. |
| 93 | } |
| 94 | |
| 95 | template <class Rep, class Period> |
| 96 | bool waitForExpectedEvents(int32_t propId, size_t expectedEvents, |
| 97 | const std::chrono::duration<Rep, Period>& timeout) { |
| 98 | std::unique_lock<std::mutex> uniqueLock(mLock); |
| 99 | return mEventCond.wait_for(uniqueLock, timeout, [this, propId, expectedEvents] { |
| 100 | ScopedLockAssertion lockAssertion(mLock); |
| 101 | return mEventsCount[propId] >= expectedEvents; |
| 102 | }); |
| 103 | } |
| 104 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 105 | std::vector<int64_t> getEventTimestamps(int32_t propId) { |
| 106 | { |
| 107 | std::lock_guard<std::mutex> lockGuard(mLock); |
| 108 | return mEventTimestamps[propId]; |
| 109 | } |
| 110 | } |
| 111 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 112 | void reset() { |
| 113 | std::lock_guard<std::mutex> lockGuard(mLock); |
| 114 | mEventsCount.clear(); |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam<ServiceDescriptor> { |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 119 | protected: |
| 120 | bool checkIsSupported(int32_t propertyId); |
| 121 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 122 | public: |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 123 | void verifyProperty(VehicleProperty propId, VehiclePropertyAccess access, |
| 124 | VehiclePropertyChangeMode changeMode, VehiclePropertyGroup group, |
| 125 | VehicleArea area, VehiclePropertyType propertyType); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 126 | virtual void SetUp() override { |
| 127 | auto descriptor = GetParam(); |
| 128 | if (descriptor.isAidlService) { |
| 129 | mVhalClient = IVhalClient::tryCreateAidlClient(descriptor.name.c_str()); |
| 130 | } else { |
| 131 | mVhalClient = IVhalClient::tryCreateHidlClient(descriptor.name.c_str()); |
| 132 | } |
| 133 | |
| 134 | ASSERT_NE(mVhalClient, nullptr) << "Failed to connect to VHAL"; |
| 135 | |
| 136 | mCallback = std::make_shared<VtsVehicleCallback>(); |
| 137 | } |
| 138 | |
| 139 | static bool isBooleanGlobalProp(int32_t property) { |
| 140 | return (property & toInt(VehiclePropertyType::MASK)) == |
| 141 | toInt(VehiclePropertyType::BOOLEAN) && |
| 142 | (property & toInt(VehicleArea::MASK)) == toInt(VehicleArea::GLOBAL); |
| 143 | } |
| 144 | |
| 145 | protected: |
| 146 | std::shared_ptr<IVhalClient> mVhalClient; |
| 147 | std::shared_ptr<VtsVehicleCallback> mCallback; |
| 148 | }; |
| 149 | |
| 150 | TEST_P(VtsHalAutomotiveVehicleTargetTest, useAidlBackend) { |
| 151 | if (!mVhalClient->isAidlVhal()) { |
| 152 | GTEST_SKIP() << "AIDL backend is not available, HIDL backend is used instead"; |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | TEST_P(VtsHalAutomotiveVehicleTargetTest, useHidlBackend) { |
| 157 | if (mVhalClient->isAidlVhal()) { |
| 158 | GTEST_SKIP() << "AIDL backend is available, HIDL backend is not used"; |
| 159 | } |
| 160 | } |
| 161 | |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 162 | // Test getAllPropConfigs() returns at least 1 property configs. |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 163 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getAllPropConfigs) { |
| 164 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getAllPropConfigs"); |
| 165 | |
| 166 | auto result = mVhalClient->getAllPropConfigs(); |
| 167 | |
| 168 | ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " |
| 169 | << result.error().message(); |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 170 | ASSERT_GE(result.value().size(), 1u) |
| 171 | << StringPrintf("Expect to get at least 1 property config, got %zu", |
| 172 | result.value().size()); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 175 | // Test getPropConfigs() can query properties returned by getAllPropConfigs. |
| 176 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithValidProps) { |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 177 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getRequiredPropConfigs"); |
| 178 | |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 179 | std::vector<int32_t> properties; |
| 180 | auto result = mVhalClient->getAllPropConfigs(); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 181 | |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 182 | ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " |
| 183 | << result.error().message(); |
| 184 | for (const auto& cfgPtr : result.value()) { |
| 185 | properties.push_back(cfgPtr->getPropId()); |
| 186 | } |
| 187 | |
| 188 | result = mVhalClient->getPropConfigs(properties); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 189 | |
| 190 | ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " |
| 191 | << result.error().message(); |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 192 | ASSERT_EQ(result.value().size(), properties.size()) |
| 193 | << StringPrintf("Expect to get exactly %zu configs, got %zu", |
| 194 | properties.size(), result.value().size()); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 195 | } |
| 196 | |
| 197 | // Test getPropConfig() with an invalid propertyId returns an error code. |
| 198 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getPropConfigsWithInvalidProp) { |
| 199 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getPropConfigsWithInvalidProp"); |
| 200 | |
| 201 | auto result = mVhalClient->getPropConfigs({kInvalidProp}); |
| 202 | |
| 203 | ASSERT_FALSE(result.ok()) << StringPrintf( |
| 204 | "Expect failure to get prop configs for invalid prop: %" PRId32, kInvalidProp); |
| 205 | ASSERT_NE(result.error().message(), "") << "Expect error message not to be empty"; |
| 206 | } |
| 207 | |
| 208 | // Test get() return current value for properties. |
| 209 | TEST_P(VtsHalAutomotiveVehicleTargetTest, get) { |
| 210 | ALOGD("VtsHalAutomotiveVehicleTargetTest::get"); |
| 211 | |
| 212 | int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 213 | if (!checkIsSupported(propId)) { |
| 214 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 215 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 216 | auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); |
| 217 | |
| 218 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 |
| 219 | ", error: %s", |
| 220 | propId, result.error().message().c_str()); |
| 221 | ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; |
| 222 | } |
| 223 | |
| 224 | // Test get() with an invalid propertyId return an error codes. |
| 225 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getInvalidProp) { |
| 226 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getInvalidProp"); |
| 227 | |
| 228 | auto result = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(kInvalidProp)); |
| 229 | |
| 230 | ASSERT_FALSE(result.ok()) << StringPrintf( |
| 231 | "Expect failure to get property for invalid prop: %" PRId32, kInvalidProp); |
| 232 | } |
| 233 | |
| 234 | // Test set() on read_write properties. |
| 235 | TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) { |
| 236 | ALOGD("VtsHalAutomotiveVehicleTargetTest::setProp"); |
| 237 | |
| 238 | // skip hvac related properties |
| 239 | std::unordered_set<int32_t> hvacProps = {toInt(VehicleProperty::HVAC_DEFROSTER), |
| 240 | toInt(VehicleProperty::HVAC_AC_ON), |
| 241 | toInt(VehicleProperty::HVAC_MAX_AC_ON), |
| 242 | toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), |
| 243 | toInt(VehicleProperty::HVAC_RECIRC_ON), |
| 244 | toInt(VehicleProperty::HVAC_DUAL_ON), |
| 245 | toInt(VehicleProperty::HVAC_AUTO_ON), |
| 246 | toInt(VehicleProperty::HVAC_POWER_ON), |
| 247 | toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON), |
| 248 | toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON)}; |
| 249 | auto result = mVhalClient->getAllPropConfigs(); |
| 250 | ASSERT_TRUE(result.ok()); |
| 251 | |
| 252 | for (const auto& cfgPtr : result.value()) { |
| 253 | const IHalPropConfig& cfg = *cfgPtr; |
| 254 | int32_t propId = cfg.getPropId(); |
| 255 | // test on boolean and writable property |
| 256 | if (cfg.getAccess() == toInt(VehiclePropertyAccess::READ_WRITE) && |
| 257 | isBooleanGlobalProp(propId) && !hvacProps.count(propId)) { |
| 258 | auto propToGet = mVhalClient->createHalPropValue(propId); |
| 259 | auto getValueResult = mVhalClient->getValueSync(*propToGet); |
| 260 | |
| 261 | ASSERT_TRUE(getValueResult.ok()) |
| 262 | << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", |
| 263 | propId, getValueResult.error().message().c_str()); |
| 264 | ASSERT_NE(getValueResult.value(), nullptr) |
| 265 | << StringPrintf("Result value must not be null for property: %" PRId32, propId); |
| 266 | |
| 267 | const IHalPropValue& value = *getValueResult.value(); |
| 268 | size_t intValueSize = value.getInt32Values().size(); |
| 269 | ASSERT_EQ(intValueSize, 1u) << StringPrintf( |
| 270 | "Expect exactly 1 int value for boolean property: %" PRId32 ", got %zu", propId, |
| 271 | intValueSize); |
| 272 | |
| 273 | int setValue = value.getInt32Values()[0] == 1 ? 0 : 1; |
| 274 | auto propToSet = mVhalClient->createHalPropValue(propId); |
| 275 | propToSet->setInt32Values({setValue}); |
| 276 | auto setValueResult = mVhalClient->setValueSync(*propToSet); |
| 277 | |
| 278 | ASSERT_TRUE(setValueResult.ok()) |
| 279 | << StringPrintf("Failed to set value for property: %" PRId32 ", error: %s", |
| 280 | propId, setValueResult.error().message().c_str()); |
| 281 | |
| 282 | // check set success |
| 283 | getValueResult = mVhalClient->getValueSync(*propToGet); |
| 284 | ASSERT_TRUE(getValueResult.ok()) |
| 285 | << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", |
| 286 | propId, getValueResult.error().message().c_str()); |
| 287 | ASSERT_NE(getValueResult.value(), nullptr) |
| 288 | << StringPrintf("Result value must not be null for property: %" PRId32, propId); |
| 289 | ASSERT_EQ(getValueResult.value()->getInt32Values(), std::vector<int32_t>({setValue})) |
| 290 | << StringPrintf("Boolean value not updated after set for property: %" PRId32, |
| 291 | propId); |
| 292 | } |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | // Test set() on an read_only property. |
| 297 | TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { |
| 298 | ALOGD("VtsHalAutomotiveVehicleTargetTest::setNotWritableProp"); |
| 299 | |
| 300 | int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 301 | if (!checkIsSupported(propId)) { |
| 302 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 303 | } |
| 304 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 305 | auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); |
| 306 | ASSERT_TRUE(getValueResult.ok()) |
| 307 | << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s", propId, |
| 308 | getValueResult.error().message().c_str()); |
| 309 | |
| 310 | auto setValueResult = mVhalClient->setValueSync(*getValueResult.value()); |
| 311 | |
| 312 | ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail"; |
Chen Cheng | faf9adc | 2022-06-22 23:09:09 +0000 | [diff] [blame] | 313 | ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 314 | } |
| 315 | |
shrikar | 8a14023 | 2023-03-07 16:57:59 +0000 | [diff] [blame] | 316 | // Test get(), set() and getAllPropConfigs() on VehicleProperty::INVALID. |
| 317 | TEST_P(VtsHalAutomotiveVehicleTargetTest, getSetPropertyIdInvalid) { |
| 318 | ALOGD("VtsHalAutomotiveVehicleTargetTest::getSetPropertyIdInvalid"); |
| 319 | |
| 320 | int32_t propId = toInt(VehicleProperty::INVALID); |
| 321 | auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); |
| 322 | ASSERT_FALSE(getValueResult.ok()) << "Expect get on VehicleProperty::INVALID to fail"; |
| 323 | ASSERT_EQ(getValueResult.error().code(), ErrorCode::INVALID_ARG); |
| 324 | |
| 325 | auto propToSet = mVhalClient->createHalPropValue(propId); |
| 326 | propToSet->setInt32Values({0}); |
| 327 | auto setValueResult = mVhalClient->setValueSync(*propToSet); |
| 328 | ASSERT_FALSE(setValueResult.ok()) << "Expect set on VehicleProperty::INVALID to fail"; |
| 329 | ASSERT_EQ(setValueResult.error().code(), ErrorCode::INVALID_ARG); |
| 330 | |
| 331 | auto result = mVhalClient->getAllPropConfigs(); |
| 332 | ASSERT_TRUE(result.ok()); |
| 333 | for (const auto& cfgPtr : result.value()) { |
| 334 | const IHalPropConfig& cfg = *cfgPtr; |
| 335 | ASSERT_FALSE(cfg.getPropId() == propId) << "Expect VehicleProperty::INVALID to not be " |
| 336 | "included in propConfigs"; |
| 337 | } |
| 338 | } |
| 339 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 340 | // Test subscribe() and unsubscribe(). |
| 341 | TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeAndUnsubscribe) { |
| 342 | ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe"); |
| 343 | |
| 344 | int32_t propId = toInt(VehicleProperty::PERF_VEHICLE_SPEED); |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 345 | if (!checkIsSupported(propId)) { |
| 346 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 347 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 348 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 349 | auto propConfigsResult = mVhalClient->getPropConfigs({propId}); |
| 350 | |
| 351 | ASSERT_TRUE(propConfigsResult.ok()) << "Failed to get property config for PERF_VEHICLE_SPEED: " |
| 352 | << "error: " << propConfigsResult.error().message(); |
| 353 | ASSERT_EQ(propConfigsResult.value().size(), 1u) |
| 354 | << "Expect to return 1 config for PERF_VEHICLE_SPEED"; |
| 355 | auto& propConfig = propConfigsResult.value()[0]; |
| 356 | float minSampleRate = propConfig->getMinSampleRate(); |
| 357 | float maxSampleRate = propConfig->getMaxSampleRate(); |
| 358 | |
| 359 | if (minSampleRate < 1) { |
| 360 | GTEST_SKIP() << "Sample rate for vehicle speed < 1 times/sec, skip test since it would " |
| 361 | "take too long"; |
| 362 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 363 | |
| 364 | auto client = mVhalClient->getSubscriptionClient(mCallback); |
| 365 | ASSERT_NE(client, nullptr) << "Failed to get subscription client"; |
| 366 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 367 | auto result = client->subscribe({{.propId = propId, .sampleRate = minSampleRate}}); |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 368 | |
| 369 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32 |
| 370 | ", error: %s", |
| 371 | propId, result.error().message().c_str()); |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 372 | |
| 373 | if (mVhalClient->isAidlVhal()) { |
| 374 | // Skip checking timestamp for HIDL because the behavior for sample rate and timestamp is |
| 375 | // only specified clearly for AIDL. |
| 376 | |
| 377 | // Timeout is 2 seconds, which gives a 1 second buffer. |
| 378 | ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(minSampleRate), |
| 379 | std::chrono::seconds(2))) |
| 380 | << "Didn't get enough events for subscribing to minSampleRate"; |
| 381 | } |
| 382 | |
| 383 | result = client->subscribe({{.propId = propId, .sampleRate = maxSampleRate}}); |
| 384 | |
| 385 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to subscribe to property: %" PRId32 |
| 386 | ", error: %s", |
| 387 | propId, result.error().message().c_str()); |
| 388 | |
| 389 | if (mVhalClient->isAidlVhal()) { |
| 390 | ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, std::floor(maxSampleRate), |
| 391 | std::chrono::seconds(2))) |
| 392 | << "Didn't get enough events for subscribing to maxSampleRate"; |
| 393 | |
| 394 | std::unordered_set<int64_t> timestamps; |
| 395 | // Event event should have a different timestamp. |
| 396 | for (const int64_t& eventTimestamp : mCallback->getEventTimestamps(propId)) { |
| 397 | ASSERT_TRUE(timestamps.find(eventTimestamp) == timestamps.end()) |
| 398 | << "two events for the same property must not have the same timestamp"; |
| 399 | timestamps.insert(eventTimestamp); |
| 400 | } |
| 401 | } |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 402 | |
| 403 | result = client->unsubscribe({propId}); |
| 404 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to unsubscribe to property: %" PRId32 |
| 405 | ", error: %s", |
| 406 | propId, result.error().message().c_str()); |
| 407 | |
| 408 | mCallback->reset(); |
| 409 | ASSERT_FALSE(mCallback->waitForExpectedEvents(propId, 10, std::chrono::seconds(1))) |
| 410 | << "Expect not to get events after unsubscription"; |
| 411 | } |
| 412 | |
| 413 | // Test subscribe() with an invalid property. |
| 414 | TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeInvalidProp) { |
| 415 | ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeInvalidProp"); |
| 416 | |
| 417 | std::vector<SubscribeOptions> options = { |
| 418 | SubscribeOptions{.propId = kInvalidProp, .sampleRate = 10.0}}; |
| 419 | |
| 420 | auto client = mVhalClient->getSubscriptionClient(mCallback); |
| 421 | ASSERT_NE(client, nullptr) << "Failed to get subscription client"; |
| 422 | |
| 423 | auto result = client->subscribe(options); |
| 424 | |
| 425 | ASSERT_FALSE(result.ok()) << StringPrintf("Expect subscribing to property: %" PRId32 " to fail", |
| 426 | kInvalidProp); |
| 427 | } |
| 428 | |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 429 | // Test the timestamp returned in GetValues results is the timestamp when the value is retrieved. |
| 430 | TEST_P(VtsHalAutomotiveVehicleTargetTest, testGetValuesTimestampAIDL) { |
| 431 | if (!mVhalClient->isAidlVhal()) { |
| 432 | GTEST_SKIP() << "Skip checking timestamp for HIDL because the behavior is only specified " |
| 433 | "for AIDL"; |
| 434 | } |
| 435 | |
| 436 | int32_t propId = toInt(VehicleProperty::PARKING_BRAKE_ON); |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 437 | if (!checkIsSupported(propId)) { |
| 438 | GTEST_SKIP() << "Property: " << propId << " is not supported, skip the test"; |
| 439 | } |
Yu Shan | 4569ef5 | 2022-03-18 14:34:25 -0700 | [diff] [blame] | 440 | auto prop = mVhalClient->createHalPropValue(propId); |
| 441 | |
| 442 | auto result = mVhalClient->getValueSync(*prop); |
| 443 | |
| 444 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 |
| 445 | ", error: %s", |
| 446 | propId, result.error().message().c_str()); |
| 447 | ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; |
| 448 | ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value"; |
| 449 | |
| 450 | bool parkBrakeOnValue1 = (result.value()->getInt32Values()[0] == 1); |
| 451 | int64_t timestampValue1 = result.value()->getTimestamp(); |
| 452 | |
| 453 | result = mVhalClient->getValueSync(*prop); |
| 454 | |
| 455 | ASSERT_TRUE(result.ok()) << StringPrintf("Failed to get value for property: %" PRId32 |
| 456 | ", error: %s", |
| 457 | propId, result.error().message().c_str()); |
| 458 | ASSERT_NE(result.value(), nullptr) << "Result value must not be null"; |
| 459 | ASSERT_EQ(result.value()->getInt32Values().size(), 1u) << "Result must contain 1 int value"; |
| 460 | |
| 461 | bool parkBarkeOnValue2 = (result.value()->getInt32Values()[0] == 1); |
| 462 | int64_t timestampValue2 = result.value()->getTimestamp(); |
| 463 | |
| 464 | if (parkBarkeOnValue2 == parkBrakeOnValue1) { |
| 465 | ASSERT_EQ(timestampValue2, timestampValue1) |
| 466 | << "getValue result must contain a timestamp updated when the value was updated, if" |
| 467 | "the value does not change, expect the same timestamp"; |
| 468 | } else { |
| 469 | ASSERT_GT(timestampValue2, timestampValue1) |
| 470 | << "getValue result must contain a timestamp updated when the value was updated, if" |
| 471 | "the value changes, expect the newer value has a larger timestamp"; |
| 472 | } |
| 473 | } |
| 474 | |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 475 | // Helper function to compare actual vs expected property config |
| 476 | void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, |
| 477 | VehiclePropertyAccess access, |
| 478 | VehiclePropertyChangeMode changeMode, |
| 479 | VehiclePropertyGroup group, VehicleArea area, |
| 480 | VehiclePropertyType propertyType) { |
| 481 | int expectedPropId = toInt(propId); |
| 482 | int expectedAccess = toInt(access); |
| 483 | int expectedChangeMode = toInt(changeMode); |
| 484 | int expectedGroup = toInt(group); |
| 485 | int expectedArea = toInt(area); |
| 486 | int expectedPropertyType = toInt(propertyType); |
| 487 | |
Eva Chen | 17bc578 | 2023-01-06 22:59:58 -0800 | [diff] [blame] | 488 | auto result = mVhalClient->getAllPropConfigs(); |
| 489 | ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " |
| 490 | << result.error().message(); |
| 491 | |
| 492 | // Check if property is implemented by getting all configs and looking to see if the expected |
| 493 | // property id is in that list. |
| 494 | bool isExpectedPropIdImplemented = false; |
| 495 | for (const auto& cfgPtr : result.value()) { |
| 496 | const IHalPropConfig& cfg = *cfgPtr; |
| 497 | if (expectedPropId == cfg.getPropId()) { |
| 498 | isExpectedPropIdImplemented = true; |
| 499 | break; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | if (!isExpectedPropIdImplemented) { |
| 504 | GTEST_SKIP() << StringPrintf("Property %" PRId32 " has not been implemented", |
| 505 | expectedPropId); |
| 506 | } |
| 507 | |
| 508 | result = mVhalClient->getPropConfigs({expectedPropId}); |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 509 | ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " |
| 510 | << result.error().message(); |
| 511 | |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 512 | ASSERT_EQ(result.value().size(), 1u) |
| 513 | << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size()); |
| 514 | |
| 515 | const auto& config = result.value().at(0); |
| 516 | int actualPropId = config->getPropId(); |
| 517 | int actualAccess = config->getAccess(); |
| 518 | int actualChangeMode = config->getChangeMode(); |
| 519 | int actualGroup = actualPropId & toInt(VehiclePropertyGroup::MASK); |
| 520 | int actualArea = actualPropId & toInt(VehicleArea::MASK); |
| 521 | int actualPropertyType = actualPropId & toInt(VehiclePropertyType::MASK); |
| 522 | |
| 523 | ASSERT_EQ(actualPropId, expectedPropId) |
| 524 | << StringPrintf("Expect to get property ID: %i, got %i", expectedPropId, actualPropId); |
| 525 | |
| 526 | if (expectedAccess == toInt(VehiclePropertyAccess::READ_WRITE)) { |
| 527 | ASSERT_TRUE(actualAccess == expectedAccess || |
| 528 | actualAccess == toInt(VehiclePropertyAccess::READ)) |
| 529 | << StringPrintf("Expect to get VehiclePropertyAccess: %i or %i, got %i", |
| 530 | expectedAccess, toInt(VehiclePropertyAccess::READ), actualAccess); |
| 531 | } else { |
| 532 | ASSERT_EQ(actualAccess, expectedAccess) << StringPrintf( |
| 533 | "Expect to get VehiclePropertyAccess: %i, got %i", expectedAccess, actualAccess); |
| 534 | } |
| 535 | |
| 536 | ASSERT_EQ(actualChangeMode, expectedChangeMode) |
| 537 | << StringPrintf("Expect to get VehiclePropertyChangeMode: %i, got %i", |
| 538 | expectedChangeMode, actualChangeMode); |
| 539 | ASSERT_EQ(actualGroup, expectedGroup) << StringPrintf( |
| 540 | "Expect to get VehiclePropertyGroup: %i, got %i", expectedGroup, actualGroup); |
| 541 | ASSERT_EQ(actualArea, expectedArea) |
| 542 | << StringPrintf("Expect to get VehicleArea: %i, got %i", expectedArea, actualArea); |
| 543 | ASSERT_EQ(actualPropertyType, expectedPropertyType) |
| 544 | << StringPrintf("Expect to get VehiclePropertyType: %i, got %i", expectedPropertyType, |
| 545 | actualPropertyType); |
| 546 | } |
| 547 | |
shrikar | 3456364 | 2023-02-14 02:57:17 +0000 | [diff] [blame] | 548 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLocationCharacterizationConfig) { |
| 549 | verifyProperty(VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ, |
| 550 | VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, |
| 551 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 552 | } |
| 553 | |
shrikar | 668df36 | 2022-12-20 22:08:17 +0000 | [diff] [blame] | 554 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) { |
| 555 | verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, |
| 556 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 557 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 558 | } |
| 559 | |
shrikar | 80cc0c5 | 2023-01-30 16:56:53 +0000 | [diff] [blame] | 560 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistStateConfig) { |
| 561 | verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ, |
| 562 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 563 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 564 | } |
| 565 | |
shrikar | 5d1b816 | 2023-01-25 19:31:23 +0000 | [diff] [blame] | 566 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) { |
| 567 | verifyProperty(VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 568 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 569 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
shrikar | 808a294 | 2022-12-21 17:07:32 +0000 | [diff] [blame] | 570 | } |
| 571 | |
shrikar | d440ed4 | 2023-01-31 00:25:14 +0000 | [diff] [blame] | 572 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTypeConfig) { |
| 573 | verifyProperty(VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE, |
| 574 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 575 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 576 | } |
| 577 | |
shrikar | 2753b9e | 2023-01-31 00:25:14 +0000 | [diff] [blame] | 578 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) { |
| 579 | verifyProperty(VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ, |
| 580 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 581 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 582 | } |
| 583 | |
shrikar | 5df0f95 | 2023-02-02 00:15:39 +0000 | [diff] [blame] | 584 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) { |
| 585 | verifyProperty(VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE, |
| 586 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 587 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 588 | } |
| 589 | |
shrikar | fde8c24 | 2023-02-02 01:10:33 +0000 | [diff] [blame] | 590 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTargetSpeedConfig) { |
| 591 | verifyProperty(VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ, |
| 592 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 593 | VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); |
| 594 | } |
| 595 | |
shrikar | b9661d3 | 2023-02-02 19:22:50 +0000 | [diff] [blame] | 596 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlTargetTimeGapConfig) { |
| 597 | verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, |
| 598 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 599 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 600 | } |
| 601 | |
shrikar | f62d747 | 2023-02-03 00:20:04 +0000 | [diff] [blame] | 602 | TEST_P(VtsHalAutomotiveVehicleTargetTest, |
| 603 | verifyAdaptiveCruiseControlLeadVehicleMeasuredDistanceConfig) { |
| 604 | verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, |
| 605 | VehiclePropertyAccess::READ, VehiclePropertyChangeMode::CONTINUOUS, |
| 606 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 607 | } |
| 608 | |
shrikar | 37833e1 | 2022-12-15 20:13:14 +0000 | [diff] [blame] | 609 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { |
| 610 | verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 611 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 612 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 613 | } |
| 614 | |
shrikar | 6d88bf5 | 2023-01-17 17:04:21 +0000 | [diff] [blame] | 615 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionDriverStateConfig) { |
| 616 | verifyProperty(VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ, |
| 617 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 618 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 619 | } |
| 620 | |
shrikar | a678599 | 2023-01-18 23:07:06 +0000 | [diff] [blame] | 621 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionWarningConfig) { |
| 622 | verifyProperty(VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ, |
| 623 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 624 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 625 | } |
| 626 | |
Aaqib Ismail | c69e968 | 2022-11-22 12:50:00 -0800 | [diff] [blame] | 627 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { |
| 628 | verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, |
| 629 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 630 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 631 | } |
| 632 | |
shrikar | 2dae80f | 2022-12-21 23:50:17 +0000 | [diff] [blame] | 633 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvStoppingModeConfig) { |
| 634 | verifyProperty(VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE, |
| 635 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 636 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 637 | } |
| 638 | |
Aaqib Ismail | aec678a | 2022-12-07 16:22:42 -0800 | [diff] [blame] | 639 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvCurrentBatteryCapacityConfig) { |
| 640 | verifyProperty(VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ, |
| 641 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 642 | VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); |
| 643 | } |
| 644 | |
shrikar | 8391447 | 2022-12-16 20:28:47 +0000 | [diff] [blame] | 645 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEngineIdleAutoStopEnabledConfig) { |
| 646 | verifyProperty(VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, |
| 647 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 648 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 649 | } |
| 650 | |
Aaqib Ismail | 2048670 | 2022-10-27 16:58:50 -0700 | [diff] [blame] | 651 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { |
| 652 | verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 653 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 654 | VehicleArea::DOOR, VehiclePropertyType::BOOLEAN); |
| 655 | } |
| 656 | |
Aaqib Ismail | 63d52d1 | 2023-01-30 12:35:10 -0800 | [diff] [blame] | 657 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersPeriodConfig) { |
| 658 | verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ, |
| 659 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 660 | VehicleArea::WINDOW, VehiclePropertyType::INT32); |
| 661 | } |
| 662 | |
Aaqib Ismail | 732a1d7 | 2023-01-31 10:25:45 -0800 | [diff] [blame] | 663 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersStateConfig) { |
| 664 | verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ, |
| 665 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 666 | VehicleArea::WINDOW, VehiclePropertyType::INT32); |
| 667 | } |
| 668 | |
Aaqib Ismail | c37a211 | 2023-02-02 11:30:08 -0800 | [diff] [blame] | 669 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersSwitchConfig) { |
| 670 | verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE, |
| 671 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 672 | VehicleArea::WINDOW, VehiclePropertyType::INT32); |
| 673 | } |
| 674 | |
Aaqib Ismail | 7f941b4 | 2022-11-04 14:55:13 -0700 | [diff] [blame] | 675 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) { |
| 676 | verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE, |
| 677 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 678 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 679 | } |
| 680 | |
Aaqib Ismail | 34fe92f | 2022-11-04 21:41:23 -0700 | [diff] [blame] | 681 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthMoveConfig) { |
| 682 | verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE, |
| 683 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 684 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 685 | } |
| 686 | |
Aaqib Ismail | 53b81c9 | 2022-11-07 17:47:04 -0800 | [diff] [blame] | 687 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightPosConfig) { |
| 688 | verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE, |
| 689 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 690 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 691 | } |
| 692 | |
Aaqib Ismail | 6c4bf19 | 2022-11-08 15:00:32 -0800 | [diff] [blame] | 693 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightMoveConfig) { |
| 694 | verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE, |
| 695 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 696 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 697 | } |
| 698 | |
Aaqib Ismail | 8d05118 | 2022-11-09 13:28:48 -0800 | [diff] [blame] | 699 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelTheftLockEnabledConfig) { |
| 700 | verifyProperty(VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, |
| 701 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 702 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 703 | } |
| 704 | |
Aaqib Ismail | 68d3f12 | 2022-11-09 14:43:32 -0800 | [diff] [blame] | 705 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLockedConfig) { |
| 706 | verifyProperty(VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE, |
| 707 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 708 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 709 | } |
| 710 | |
Aaqib Ismail | d4d6adf | 2022-11-09 16:59:47 -0800 | [diff] [blame] | 711 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelEasyAccessEnabledConfig) { |
| 712 | verifyProperty(VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, |
| 713 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 714 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 715 | } |
| 716 | |
Aaqib Ismail | 0dc7ba0 | 2022-11-10 14:28:09 -0800 | [diff] [blame] | 717 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsStateConfig) { |
| 718 | verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ, |
| 719 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 720 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 721 | } |
| 722 | |
Aaqib Ismail | 4b8688f | 2022-11-15 15:13:35 -0800 | [diff] [blame] | 723 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsSwitchConfig) { |
| 724 | verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE, |
| 725 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 726 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 727 | } |
| 728 | |
Arati Gerdes | d86c7fd | 2022-12-19 12:32:29 -0800 | [diff] [blame] | 729 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxDoorPosConfig) { |
| 730 | verifyProperty(VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE, |
| 731 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 732 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 733 | } |
| 734 | |
Aaqib Ismail | 57be403 | 2023-02-02 14:15:03 -0800 | [diff] [blame] | 735 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxLockedConfig) { |
| 736 | verifyProperty(VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE, |
| 737 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 738 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 739 | } |
| 740 | |
shrikar | a136721 | 2022-11-02 16:07:35 +0000 | [diff] [blame] | 741 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { |
| 742 | verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 743 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 744 | VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); |
| 745 | } |
| 746 | |
| 747 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) { |
| 748 | verifyProperty(VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 749 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 750 | VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); |
| 751 | } |
| 752 | |
Aaqib Ismail | 4e6144c | 2022-12-15 15:32:18 -0800 | [diff] [blame] | 753 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatHeadrestHeightPosV2Config) { |
| 754 | verifyProperty(VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess::READ_WRITE, |
| 755 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 756 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 757 | } |
| 758 | |
shrikar | 6ae7916 | 2022-12-16 03:03:25 +0000 | [diff] [blame] | 759 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatWalkInPosConfig) { |
| 760 | verifyProperty(VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE, |
| 761 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 762 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 763 | } |
| 764 | |
shrikar | fb65ae5 | 2022-11-03 23:12:51 +0000 | [diff] [blame] | 765 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsStateConfig) { |
| 766 | verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ, |
| 767 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 768 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 769 | } |
| 770 | |
shrikar | 93cf1be | 2022-11-30 15:00:52 -0800 | [diff] [blame] | 771 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsSwitchConfig) { |
| 772 | verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE, |
| 773 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 774 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 775 | } |
| 776 | |
shrikar | 3326de0 | 2022-11-07 23:51:20 +0000 | [diff] [blame] | 777 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { |
| 778 | verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 779 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 780 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 781 | } |
| 782 | |
shrikar | b96e376 | 2022-11-08 16:49:58 -0800 | [diff] [blame] | 783 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatAirbagEnabledConfig) { |
| 784 | verifyProperty(VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 785 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 786 | VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); |
| 787 | } |
| 788 | |
shrikar | 802ecb5 | 2022-11-09 18:27:06 +0000 | [diff] [blame] | 789 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportPosConfig) { |
| 790 | verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, |
| 791 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 792 | VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 793 | } |
| 794 | |
shrikar | 1f0ce0d | 2022-11-11 17:46:06 +0000 | [diff] [blame] | 795 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportMoveConfig) { |
| 796 | verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, |
| 797 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 798 | VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 799 | } |
| 800 | |
shrikar | eff71b2 | 2022-11-11 11:02:43 -0800 | [diff] [blame] | 801 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalPosConfig) { |
| 802 | verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE, |
| 803 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 804 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 805 | } |
| 806 | |
shrikar | 2a081c5 | 2022-11-11 16:49:58 -0800 | [diff] [blame] | 807 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalMoveConfig) { |
| 808 | verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE, |
| 809 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 810 | VehicleArea::SEAT, VehiclePropertyType::INT32); |
| 811 | } |
| 812 | |
Aaqib Ismail | 5d53aa3 | 2022-12-13 22:30:23 +0000 | [diff] [blame] | 813 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabledConfig) { |
| 814 | verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, |
| 815 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 816 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 817 | } |
| 818 | |
Aaqib Ismail | 28ee23c | 2023-01-04 23:04:46 -0800 | [diff] [blame] | 819 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingStateConfig) { |
| 820 | verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ, |
| 821 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 822 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 823 | } |
| 824 | |
Aaqib Ismail | a251367 | 2022-12-15 00:55:27 +0000 | [diff] [blame] | 825 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledConfig) { |
| 826 | verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, |
| 827 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 828 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 829 | } |
| 830 | |
Aaqib Ismail | 0a1ab29 | 2023-01-19 21:33:56 +0000 | [diff] [blame] | 831 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) { |
| 832 | verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ, |
| 833 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 834 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 835 | } |
| 836 | |
Aaqib Ismail | 3f7177a | 2022-12-17 09:20:00 -0800 | [diff] [blame] | 837 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { |
| 838 | verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 839 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 840 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 841 | } |
| 842 | |
Aaqib Ismail | 5fc97bb | 2023-01-10 17:07:47 -0800 | [diff] [blame] | 843 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningStateConfig) { |
| 844 | verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ, |
| 845 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 846 | VehicleArea::MIRROR, VehiclePropertyType::INT32); |
| 847 | } |
| 848 | |
Aaqib Ismail | 7a46cef | 2022-12-17 10:00:59 -0800 | [diff] [blame] | 849 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfig) { |
| 850 | verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, |
| 851 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 852 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 853 | } |
| 854 | |
Aaqib Ismail | 8462db5 | 2023-01-27 19:59:49 -0800 | [diff] [blame] | 855 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningStateConfig) { |
| 856 | verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess::READ, |
| 857 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 858 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 859 | } |
| 860 | |
Aaqib Ismail | 20cc66a | 2022-12-22 05:38:28 -0800 | [diff] [blame] | 861 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistEnabledConfig) { |
| 862 | verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, |
| 863 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 864 | VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 865 | } |
| 866 | |
Aaqib Ismail | 78db2ca | 2023-01-10 17:34:28 -0800 | [diff] [blame] | 867 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistStateConfig) { |
| 868 | verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ, |
| 869 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 870 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 871 | } |
| 872 | |
Aaqib Ismail | b1680a7 | 2022-12-14 23:28:49 +0000 | [diff] [blame] | 873 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { |
| 874 | verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, |
| 875 | VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, |
| 876 | VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); |
| 877 | } |
| 878 | |
Aaqib Ismail | 0ffd39c | 2023-01-11 12:19:10 -0800 | [diff] [blame] | 879 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistCommandConfig) { |
| 880 | verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE, |
| 881 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 882 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 883 | } |
| 884 | |
Aaqib Ismail | db03444 | 2023-01-10 18:14:28 -0800 | [diff] [blame] | 885 | TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistStateConfig) { |
| 886 | verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ, |
| 887 | VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, |
| 888 | VehicleArea::GLOBAL, VehiclePropertyType::INT32); |
| 889 | } |
| 890 | |
Yu Shan | 8a1ab87 | 2023-10-09 14:43:36 -0700 | [diff] [blame] | 891 | bool VtsHalAutomotiveVehicleTargetTest::checkIsSupported(int32_t propertyId) { |
| 892 | auto result = mVhalClient->getPropConfigs({propertyId}); |
| 893 | return result.ok(); |
| 894 | } |
| 895 | |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 896 | std::vector<ServiceDescriptor> getDescriptors() { |
| 897 | std::vector<ServiceDescriptor> descriptors; |
| 898 | for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { |
| 899 | descriptors.push_back({ |
| 900 | .name = name, |
| 901 | .isAidlService = true, |
| 902 | }); |
| 903 | } |
Yu Shan | 928062c | 2024-01-25 17:40:41 -0800 | [diff] [blame] | 904 | for (std::string name : getAllHalInstanceNames( |
| 905 | android::hardware::automotive::vehicle::V2_0::IVehicle::descriptor)) { |
Yu Shan | 726d51a | 2022-02-22 17:37:21 -0800 | [diff] [blame] | 906 | descriptors.push_back({ |
| 907 | .name = name, |
| 908 | .isAidlService = false, |
| 909 | }); |
| 910 | } |
| 911 | return descriptors; |
| 912 | } |
| 913 | |
| 914 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalAutomotiveVehicleTargetTest); |
| 915 | |
| 916 | INSTANTIATE_TEST_SUITE_P(PerInstance, VtsHalAutomotiveVehicleTargetTest, |
| 917 | testing::ValuesIn(getDescriptors()), |
| 918 | [](const testing::TestParamInfo<ServiceDescriptor>& info) { |
| 919 | std::string name = ""; |
| 920 | if (info.param.isAidlService) { |
| 921 | name += "aidl_"; |
| 922 | } else { |
| 923 | name += "hidl_"; |
| 924 | } |
| 925 | name += info.param.name; |
| 926 | return Sanitize(name); |
| 927 | }); |
| 928 | |
| 929 | int main(int argc, char** argv) { |
| 930 | ::testing::InitGoogleTest(&argc, argv); |
| 931 | ABinderProcess_setThreadPoolMaxThreadCount(1); |
| 932 | return RUN_ALL_TESTS(); |
| 933 | } |