1 // 2 // Copyright © 2017 Arm Ltd. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 #define LOG_TAG "ArmnnDriverTests" 6 #define BOOST_TEST_MODULE armnn_driver_tests 7 #include <boost/test/unit_test.hpp> 8 #include <log/log.h> 9 10 #include "DriverTestHelpers.hpp" 11 12 BOOST_AUTO_TEST_SUITE(DriverTests) 13 14 using namespace android::hardware; 15 using namespace driverTestHelpers; 16 using namespace armnn_driver; 17 BOOST_AUTO_TEST_CASE(Init)18BOOST_AUTO_TEST_CASE(Init) 19 { 20 // Making the driver object on the stack causes a weird libc error, so make it on the heap instead 21 auto driver = std::make_unique<ArmnnDriver>(DriverOptions(armnn::Compute::CpuRef)); 22 23 DeviceStatus status = driver->getStatus(); 24 // Note double-parentheses to avoid compile error from Boost trying to printf the DeviceStatus 25 BOOST_TEST((status == DeviceStatus::AVAILABLE)); 26 } 27 BOOST_AUTO_TEST_CASE(TestCapabilities)28BOOST_AUTO_TEST_CASE(TestCapabilities) 29 { 30 // Making the driver object on the stack causes a weird libc error, so make it on the heap instead 31 auto driver = std::make_unique<ArmnnDriver>(DriverOptions(armnn::Compute::CpuRef)); 32 33 V1_0::ErrorStatus error; 34 V1_0::Capabilities cap; 35 36 auto cb = [&](V1_0::ErrorStatus status, const V1_0::Capabilities& capabilities) 37 { 38 error = status; 39 cap = capabilities; 40 }; 41 42 driver->getCapabilities(cb); 43 44 BOOST_TEST((int)error == (int)V1_0::ErrorStatus::NONE); 45 BOOST_TEST(cap.float32Performance.execTime > 0.f); 46 BOOST_TEST(cap.float32Performance.powerUsage > 0.f); 47 BOOST_TEST(cap.quantized8Performance.execTime > 0.f); 48 BOOST_TEST(cap.quantized8Performance.powerUsage > 0.f); 49 } 50 51 BOOST_AUTO_TEST_SUITE_END() 52