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