diff options
Diffstat (limited to 'tests/run_inference_test.cpp')
-rw-r--r-- | tests/run_inference_test.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/run_inference_test.cpp b/tests/run_inference_test.cpp index 480e26f..6075d7a 100644 --- a/tests/run_inference_test.cpp +++ b/tests/run_inference_test.cpp @@ -105,6 +105,20 @@ void testNetworkInfoUnparsableBuffer(const Device &device) { } catch (std::exception &e) { throw TestFailureException("NetworkInfo unparsable buffer test: ", e.what()); } } +void testNetworkInvalidType(const Device &device) { + const std::string expected_error = + std::string("IOCTL cmd=") + std::to_string(ETHOSU_IOCTL_NETWORK_CREATE) + " failed: " + std::strerror(EINVAL); + struct ethosu_uapi_network_create net_req = {}; + net_req.type = ETHOSU_UAPI_NETWORK_INDEX + 1; + try { + int r = device.ioctl(ETHOSU_IOCTL_NETWORK_CREATE, &net_req); + FAIL(); + } catch (Exception &e) { + // The call is expected to throw + TEST_ASSERT(expected_error.compare(e.what()) == 0); + } catch (std::exception &e) { throw TestFailureException("NetworkCreate invalid type test: ", e.what()); } +} + void testRunInferenceBuffer(const Device &device) { try { auto networkBuffer = std::make_shared<Buffer>(device, sizeof(networkModelData)); @@ -154,6 +168,7 @@ int main() { testPing(device); testDriverVersion(device); testCapabilties(device); + testNetworkInvalidType(device); testNetworkInfoNotExistentIndex(device); testNetworkInfoBuffer(device); testNetworkInfoUnparsableBuffer(device); |