Adding the last character in a null terminated string

Change-Id: I4a9cad0974c8b9f1474e79e5c3d78b88dd4b004c
This commit is contained in:
Koska, Andrzej
2018-03-26 09:40:20 +02:00
committed by sys_ocldev
parent dcce788ace
commit dd21164b3e
4 changed files with 49 additions and 1 deletions

View File

@@ -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

View File

@@ -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);

View 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()
{
}