compute-runtime/unit_tests/api/cl_enqueue_nd_range_kernel_...

96 lines
2.8 KiB
Plaintext
Raw Normal View History

/*
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "cl_api_tests.h"
#include "runtime/command_queue/command_queue.h"
#include "unit_tests/mocks/mock_kernel.h"
using namespace OCLRT;
typedef api_tests clEnqueueNDRangeKernelTests;
namespace ULT {
TEST_F(clEnqueueNDRangeKernelTests, returnsSuccess) {
cl_uint workDim = 1;
size_t globalWorkOffset[3] = {0, 0, 0};
size_t globalWorkSize[3] = {1, 1, 1};
size_t localWorkSize[3] = {1, 1, 1};
cl_uint numEventsInWaitList = 0;
cl_event *eventWaitList = nullptr;
cl_event *event = nullptr;
retVal = clEnqueueNDRangeKernel(
pCommandQueue,
pKernel,
workDim,
globalWorkOffset,
globalWorkSize,
localWorkSize,
numEventsInWaitList,
eventWaitList,
event);
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST_F(clEnqueueNDRangeKernelTests, NullCommandQueue_returnsError) {
size_t globalWorkSize[3] = {1, 1, 1};
retVal = clEnqueueNDRangeKernel(
nullptr,
pKernel,
1,
nullptr,
globalWorkSize,
nullptr,
0,
nullptr,
nullptr);
EXPECT_EQ(CL_INVALID_COMMAND_QUEUE, retVal);
}
TEST_F(clEnqueueNDRangeKernelTests, returnsFailWithEventWaitList) {
cl_uint workDim = 1;
size_t globalWorkOffset[3] = {0, 0, 0};
size_t globalWorkSize[3] = {1, 1, 1};
size_t localWorkSize[3] = {1, 1, 1};
cl_uint numEventsInWaitList = 1;
cl_event *eventWaitList = nullptr;
cl_event *event = nullptr;
retVal = clEnqueueNDRangeKernel(
pCommandQueue,
pKernel,
workDim,
globalWorkOffset,
globalWorkSize,
localWorkSize,
numEventsInWaitList,
eventWaitList,
event);
EXPECT_EQ(CL_INVALID_EVENT_WAIT_LIST, retVal);
}
} // namespace ULT