mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Adding the last character in a null terminated string
Change-Id: I4a9cad0974c8b9f1474e79e5c3d78b88dd4b004c
This commit is contained in:
committed by
sys_ocldev
parent
dcce788ace
commit
dd21164b3e
@@ -318,6 +318,7 @@ set(TEST_KERNELS
|
||||
test_files/CopyBuffer_simd32.cl
|
||||
test_files/CopyBuffer_simd8.cl
|
||||
test_files/copybuffer_with_header.cl
|
||||
test_files/emptykernel.cl
|
||||
test_files/kernel_data_param.cl
|
||||
test_files/kernel_num_args.cl
|
||||
test_files/media_kernels_backend.cl
|
||||
|
||||
@@ -488,6 +488,27 @@ TEST(OfflineCompilerTest, buildSourceCode) {
|
||||
EXPECT_NE(0u, mockOfflineCompiler->getGenBinarySize());
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, GivenKernelWhenNoCharAfterKernelSourceThenBuildWithSuccess) {
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
|
||||
auto retVal = mockOfflineCompiler->buildSourceCode();
|
||||
EXPECT_EQ(CL_INVALID_PROGRAM, retVal);
|
||||
|
||||
const char *argv[] = {
|
||||
"cloc",
|
||||
"-file",
|
||||
"test_files/emptykernel.cl",
|
||||
"-device",
|
||||
gEnvironment->devicePrefix.c_str()};
|
||||
|
||||
retVal = mockOfflineCompiler->initialize(ARRAY_COUNT(argv), argv);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
retVal = mockOfflineCompiler->buildSourceCode();
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST(OfflineCompilerTest, generateElfBinary) {
|
||||
auto mockOfflineCompiler = std::unique_ptr<MockOfflineCompiler>(new MockOfflineCompiler());
|
||||
ASSERT_NE(nullptr, mockOfflineCompiler);
|
||||
|
||||
25
unit_tests/test_files/emptykernel.cl
Normal file
25
unit_tests/test_files/emptykernel.cl
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
/* No character after the last "}" */
|
||||
__kernel void empty()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user