mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Update Memtrack HAL VTS Requirements
Only devices with 5.10 or later kernel are required to implement getGpuDeviceInfo(). At least one non-empty device name must be returned by getGpuDeviceInfo(). Test: atest VtsHalMemtrackTargetTest Bug: 176477627 Change-Id: I8c7121f4bed0e674407a22f0a772e95475243568
This commit is contained in:
@@ -35,6 +35,8 @@ ndk::ScopedAStatus Memtrack::getMemory(int pid, MemtrackType type,
|
||||
|
||||
ndk::ScopedAStatus Memtrack::getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_return) {
|
||||
_aidl_return->clear();
|
||||
DeviceInfo dev_info = {.id = 0, .name = "virtio_gpu"};
|
||||
_aidl_return->emplace_back(dev_info);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ cc_test {
|
||||
srcs: ["VtsHalMemtrackTargetTest.cpp"],
|
||||
shared_libs: [
|
||||
"libbinder_ndk",
|
||||
"libvintf",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.memtrack-unstable-ndk_platform",
|
||||
|
||||
@@ -21,11 +21,15 @@
|
||||
#include <aidl/android/hardware/memtrack/MemtrackType.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <vintf/VintfObject.h>
|
||||
|
||||
using aidl::android::hardware::memtrack::DeviceInfo;
|
||||
using aidl::android::hardware::memtrack::IMemtrack;
|
||||
using aidl::android::hardware::memtrack::MemtrackRecord;
|
||||
using aidl::android::hardware::memtrack::MemtrackType;
|
||||
using android::vintf::KernelVersion;
|
||||
using android::vintf::RuntimeInfo;
|
||||
using android::vintf::VintfObject;
|
||||
|
||||
class MemtrackAidlTest : public testing::TestWithParam<std::string> {
|
||||
public:
|
||||
@@ -75,7 +79,23 @@ TEST_P(MemtrackAidlTest, GetGpuDeviceInfo) {
|
||||
|
||||
auto status = memtrack_->getGpuDeviceInfo(&device_info);
|
||||
|
||||
// Devices with < 5.10 kernels aren't required to provide an implementation of
|
||||
// getGpuDeviceInfo(), and can return EX_UNSUPPORTED_OPERATION
|
||||
if (status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
|
||||
KernelVersion min_kernel_version = KernelVersion(5, 10, 0);
|
||||
KernelVersion kernel_version = VintfObject::GetInstance()
|
||||
->getRuntimeInfo(RuntimeInfo::FetchFlag::CPU_VERSION)
|
||||
->kernelVersion();
|
||||
EXPECT_LT(kernel_version, min_kernel_version)
|
||||
<< "Devices with 5.10 or later kernels must implement getGpuDeviceInfo()";
|
||||
return;
|
||||
}
|
||||
|
||||
EXPECT_TRUE(status.isOk());
|
||||
EXPECT_FALSE(device_info.empty());
|
||||
for (auto device : device_info) {
|
||||
EXPECT_FALSE(device.name.empty());
|
||||
}
|
||||
}
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MemtrackAidlTest);
|
||||
|
||||
Reference in New Issue
Block a user