Fix ordering of cache files requirements from device am: 3fd4ec4706
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15126842 Change-Id: Ic4a246435d2c5c2e356068fc1852125e768e89c8
This commit is contained in:
commit
aadf889c61
2 changed files with 17 additions and 2 deletions
|
@ -119,7 +119,7 @@ nn::GeneralResult<std::pair<uint32_t, uint32_t>> getNumberOfCacheFilesNeededFrom
|
|||
<< numberOfCacheFiles.numDataCache << " vs " << nn::kMaxNumberOfCacheFiles
|
||||
<< ")";
|
||||
}
|
||||
return std::make_pair(numberOfCacheFiles.numDataCache, numberOfCacheFiles.numModelCache);
|
||||
return std::make_pair(numberOfCacheFiles.numModelCache, numberOfCacheFiles.numDataCache);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -58,7 +58,7 @@ const std::string kInvalidName = "";
|
|||
const std::shared_ptr<BnDevice> kInvalidDevice;
|
||||
constexpr PerformanceInfo kNoPerformanceInfo = {.execTime = std::numeric_limits<float>::max(),
|
||||
.powerUsage = std::numeric_limits<float>::max()};
|
||||
constexpr NumberOfCacheFiles kNumberOfCacheFiles = {.numModelCache = nn::kMaxNumberOfCacheFiles,
|
||||
constexpr NumberOfCacheFiles kNumberOfCacheFiles = {.numModelCache = nn::kMaxNumberOfCacheFiles - 1,
|
||||
.numDataCache = nn::kMaxNumberOfCacheFiles};
|
||||
|
||||
constexpr auto makeStatusOk = [] { return ndk::ScopedAStatus::ok(); };
|
||||
|
@ -300,6 +300,21 @@ TEST(DeviceTest, getSupportedExtensionsDeadObject) {
|
|||
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
|
||||
}
|
||||
|
||||
TEST(DeviceTest, getNumberOfCacheFilesNeeded) {
|
||||
// setup call
|
||||
const auto mockDevice = createMockDevice();
|
||||
EXPECT_CALL(*mockDevice, getNumberOfCacheFilesNeeded(_)).Times(1);
|
||||
|
||||
// run test
|
||||
const auto result = Device::create(kName, mockDevice);
|
||||
|
||||
// verify result
|
||||
ASSERT_TRUE(result.has_value());
|
||||
constexpr auto kNumberOfCacheFilesPair = std::make_pair<uint32_t, uint32_t>(
|
||||
kNumberOfCacheFiles.numModelCache, kNumberOfCacheFiles.numDataCache);
|
||||
EXPECT_EQ(result.value()->getNumberOfCacheFilesNeeded(), kNumberOfCacheFilesPair);
|
||||
}
|
||||
|
||||
TEST(DeviceTest, getNumberOfCacheFilesNeededError) {
|
||||
// setup call
|
||||
const auto mockDevice = createMockDevice();
|
||||
|
|
Loading…
Reference in a new issue