aboutsummaryrefslogtreecommitdiff
path: root/src/backends/cl/test/ClContextControlFixture.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/backends/cl/test/ClContextControlFixture.hpp')
-rw-r--r--src/backends/cl/test/ClContextControlFixture.hpp34
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>;