blob: e1ca5ee6dfb899abe4a1b399764b47c5615dc1e4 [file] [log] [blame]
Richard Burtondc0c6ed2020-04-08 16:39:05 +01001# Copyright © 2020 Arm Ltd. All rights reserved.
2# SPDX-License-Identifier: MIT
3import os
4import platform
5import pytest
6import pyarmnn as ann
7
8
9@pytest.fixture()
10def get_supported_backends_setup(shared_data_folder):
11 options = ann.CreationOptions()
12 runtime = ann.IRuntime(options)
13
14 get_device_spec = runtime.GetDeviceSpec()
15 supported_backends = get_device_spec.GetSupportedBackends()
16
17 yield supported_backends
18
19
20def test_ownership():
21 options = ann.CreationOptions()
22 runtime = ann.IRuntime(options)
23
24 device_spec = runtime.GetDeviceSpec()
25
26 assert not device_spec.thisown
27
28
29def test_to_string():
30 options = ann.CreationOptions()
31 runtime = ann.IRuntime(options)
32
33 device_spec = runtime.GetDeviceSpec()
34 expected_str = "IDeviceSpec {{ supportedBackends: [" \
35 "{}" \
36 "]}}".format(', '.join(map(lambda b: str(b), device_spec.GetSupportedBackends())))
37
38 assert expected_str == str(device_spec)
39
40
41def test_get_supported_backends_cpu_ref(get_supported_backends_setup):
42 assert "CpuRef" in map(lambda b: str(b), get_supported_backends_setup)
43
44
45@pytest.mark.aarch64
46class TestNoneCpuRefBackends:
47
48 @pytest.mark.parametrize("backend", ["CpuAcc"])
49 def test_get_supported_backends_cpu_acc(self, get_supported_backends_setup, backend):
50 assert backend in map(lambda b: str(b), get_supported_backends_setup)