From 8f918c6b624da4867224ba99432d70766612eb06 Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Thu, 12 Oct 2023 15:30:32 +0200 Subject: Add UAPI NPU driver version test A test has been added to verify that the UAPI to get the Linux kernel NPU driver version returns the expected value. Change-Id: Ib401c13100b52d6fedd41831fe9e4d2ace1c4a2c Signed-off-by: Mikael Olsson --- tests/run_inference_test.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/run_inference_test.cpp b/tests/run_inference_test.cpp index ef2266e..480e26f 100644 --- a/tests/run_inference_test.cpp +++ b/tests/run_inference_test.cpp @@ -47,6 +47,19 @@ void testPing(const Device &device) { TEST_ASSERT(r == 0); } +void testDriverVersion(const Device &device) { + int r; + struct ethosu_uapi_kernel_driver_version version = {}; + try { + r = device.ioctl(ETHOSU_IOCTL_DRIVER_VERSION_GET, &version); + } catch (std::exception &e) { throw TestFailureException("Driver version test: ", e.what()); } + + TEST_ASSERT(r == 0); + TEST_ASSERT(version.major == ETHOSU_KERNEL_DRIVER_VERSION_MAJOR); + TEST_ASSERT(version.minor == ETHOSU_KERNEL_DRIVER_VERSION_MINOR); + TEST_ASSERT(version.patch == ETHOSU_KERNEL_DRIVER_VERSION_PATCH); +} + void testCapabilties(const Device &device) { Capabilities capabilities; try { @@ -139,6 +152,7 @@ int main() { try { testPing(device); + testDriverVersion(device); testCapabilties(device); testNetworkInfoNotExistentIndex(device); testNetworkInfoBuffer(device); -- cgit v1.2.1