aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/gpu/unit/Context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/gpu/unit/Context.cpp')
-rw-r--r--tests/validation/gpu/unit/Context.cpp76
1 files changed, 7 insertions, 69 deletions
diff --git a/tests/validation/gpu/unit/Context.cpp b/tests/validation/gpu/unit/Context.cpp
index 06b4a83925..598e219fd9 100644
--- a/tests/validation/gpu/unit/Context.cpp
+++ b/tests/validation/gpu/unit/Context.cpp
@@ -21,11 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "tests/framework/Asserts.h"
-#include "tests/framework/Macros.h"
-#include "tests/validation/Validation.h"
-
-#include "arm_compute/Acl.hpp"
+#include "tests/validation/fixtures/UNIT/ContextFixture.h"
#include "src/gpu/cl/ClContext.h"
@@ -41,67 +37,9 @@ TEST_SUITE(CL)
TEST_SUITE(UNIT)
TEST_SUITE(Context)
-/** Test-case for AclCreateContext and AclDestroy Context
- *
- * Validate that AclCreateContext can create and destroy a context
- *
- * Test Steps:
- * - Call AclCreateContext with valid target
- * - Confirm that context is not nullptr and error code is AclSuccess
- * - Destroy context
- * - Confirm that AclSuccess is reported
- */
-TEST_CASE(SimpleContextCApi, framework::DatasetMode::ALL)
-{
- AclContext ctx = nullptr;
- ARM_COMPUTE_ASSERT(AclCreateContext(&ctx, AclGpuOcl, nullptr) == AclStatus::AclSuccess);
- ARM_COMPUTE_ASSERT(ctx != nullptr);
- ARM_COMPUTE_ASSERT(AclDestroyContext(ctx) == AclStatus::AclSuccess);
-}
-
-/** Test-case for Context from the C++ interface
- *
- * Test Steps:
- * - Create a Context obejct
- * - Confirm that StatusCode::Success is reported
- * - Confirm that equality operator works
- * - Confirm that inequality operator works
- */
-TEST_CASE(SimpleContextCppApi, framework::DatasetMode::ALL)
-{
- acl::StatusCode status = acl::StatusCode::Success;
- acl::Context ctx(acl::Target::GpuOcl, &status);
- ARM_COMPUTE_ASSERT(status == acl::StatusCode::Success);
-
- auto ctx_eq = ctx;
- ARM_COMPUTE_ASSERT(ctx_eq == ctx);
-
- acl::Context ctx_ienq(acl::Target::GpuOcl, &status);
- ARM_COMPUTE_ASSERT(status == acl::StatusCode::Success);
- ARM_COMPUTE_ASSERT(ctx_ienq != ctx);
-}
-
-/** Test-case for CpuCapabilities
- *
- * Validate that AclCreateContext can create/destroy multiple contexts with different options
- *
- * Test Steps:
- * - Call AclCreateContext with different targets
- * - Confirm that AclSuccess is reported
- * - Destroy all contexts
- * - Confirm that AclSuccess is reported
- */
-TEST_CASE(MultipleContexts, framework::DatasetMode::ALL)
-{
- const unsigned int num_tests = 5;
- std::array<AclContext, num_tests> ctxs{};
- for(unsigned int i = 0; i < num_tests; ++i)
- {
- ARM_COMPUTE_ASSERT(AclCreateContext(&ctxs[i], AclTarget::AclGpuOcl, nullptr) == AclStatus::AclSuccess);
- ARM_COMPUTE_ASSERT(ctxs[i] != nullptr);
- ARM_COMPUTE_ASSERT(AclDestroyContext(ctxs[i]) == AclStatus::AclSuccess);
- }
-}
+EMPTY_BODY_FIXTURE_TEST_CASE(SimpleContextCApi, SimpleContextCApiFixture<AclTarget::AclGpuOcl>, framework::DatasetMode::ALL)
+EMPTY_BODY_FIXTURE_TEST_CASE(SimpleContextCppApi, SimpleContextCppApiFixture<acl::Target::GpuOcl>, framework::DatasetMode::ALL)
+EMPTY_BODY_FIXTURE_TEST_CASE(MultipleContexts, MultipleContextsFixture<AclTarget::AclGpuOcl>, framework::DatasetMode::ALL)
/** Test-case for MLGO kernel configuration file
*
@@ -148,9 +86,9 @@ TEST_CASE(CheckMLGO, framework::DatasetMode::ALL)
ofs << mlgo_str;
ofs.close();
- AclContextOptions opts = acl_default_ctx_options;
- opts.kernel_config_file = mlgo_filename.c_str();
- arm_compute::gpu::opencl::ClContext ctx(&opts);
+ acl::Context::Options opts;
+ opts.copts.kernel_config_file = mlgo_filename.c_str();
+ arm_compute::gpu::opencl::ClContext ctx(&opts.copts);
const MLGOHeuristics &heuristics = ctx.mlgo();