From dd12c487d227b5aaa0a86d596d949900462f6df8 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Wed, 12 Oct 2022 22:41:28 +0000 Subject: [PATCH] IRPC test: use version from RpcHardwareInfo Check against version of the interface reported by the HAL rather than the one from generated code. AIDL interface are meant to be backwards compatible. Having the HAL report its version dynamically makes it easier to maintain legacy behavior while evolving the interface, e.g. we bump IRPC to v3 across our codebase, but devices that already shipped may still behave as v1/2 devices. Bug: 235265072 Test: VtsHalRemotelyProvisionedComponentTargetTest Change-Id: I49e3a09723590ac1a7c432b11450c1438563c787 --- .../functional/VtsRemotelyProvisionedComponentTests.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp index e1f65fec78..9b21e4e98b 100644 --- a/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp +++ b/security/keymint/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp @@ -200,9 +200,7 @@ TEST(NonParameterizedTests, eachRpcHasAUniqueId) { RpcHardwareInfo hwInfo; ASSERT_TRUE(rpc->getHardwareInfo(&hwInfo).isOk()); - int32_t version; - ASSERT_TRUE(rpc->getInterfaceVersion(&version).isOk()); - if (version >= VERSION_WITH_UNIQUE_ID_SUPPORT) { + if (hwInfo.versionNumber >= VERSION_WITH_UNIQUE_ID_SUPPORT) { ASSERT_TRUE(hwInfo.uniqueId); auto [_, wasInserted] = uniqueIds.insert(*hwInfo.uniqueId); EXPECT_TRUE(wasInserted); @@ -232,10 +230,7 @@ TEST_P(GetHardwareInfoTests, supportsValidCurve) { * Verify that the unique id is within the length limits as described in RpcHardwareInfo.aidl. */ TEST_P(GetHardwareInfoTests, uniqueId) { - int32_t version; - ASSERT_TRUE(provisionable_->getInterfaceVersion(&version).isOk()); - - if (version < VERSION_WITH_UNIQUE_ID_SUPPORT) { + if (rpcHardwareInfo.versionNumber < VERSION_WITH_UNIQUE_ID_SUPPORT) { return; }