diff options
author | arovir01 <Aron.Virginas-Tar@arm.com> | 2018-10-09 18:04:24 +0100 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2018-10-22 16:57:53 +0100 |
commit | 43095f31edf103d71a8e2420b549d21fd349b49e (patch) | |
tree | 1414f25d8fadd4aa84fbed008743c4672b606b26 /src/backends/cl/test/ClContextControlFixture.hpp | |
parent | 3b72db05d6f8df28728b292c8bbd27c402dc8704 (diff) | |
download | armnn-43095f31edf103d71a8e2420b549d21fd349b49e.tar.gz |
IVGCVSW-1988: Refactor backend-specific unit tests
Change-Id: I8eca81d2e0780390eaa837c186ffe1c7d41fdebe
Diffstat (limited to 'src/backends/cl/test/ClContextControlFixture.hpp')
-rw-r--r-- | src/backends/cl/test/ClContextControlFixture.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/backends/cl/test/ClContextControlFixture.hpp b/src/backends/cl/test/ClContextControlFixture.hpp new file mode 100644 index 0000000000..fd53e3fcf3 --- /dev/null +++ b/src/backends/cl/test/ClContextControlFixture.hpp @@ -0,0 +1,34 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include <backends/cl/ClContextControl.hpp> + +template<bool ProfilingEnabled> +struct ClContextControlFixtureBase +{ + static ClContextControlFixtureBase*& Instance() + { + static ClContextControlFixtureBase* s_Instance = nullptr; + return s_Instance; + } + + // Initialising ClContextControl to ensure OpenCL is loaded correctly for each test case + ClContextControlFixtureBase() + : m_ClContextControl(nullptr, ProfilingEnabled) + { + Instance() = this; + } + ~ClContextControlFixtureBase() + { + Instance() = nullptr; + } + + armnn::ClContextControl m_ClContextControl; +}; + +using ClContextControlFixture = ClContextControlFixtureBase<false>; +using ClProfilingContextControlFixture = ClContextControlFixtureBase<true>; |