diff --git a/runtime/program/process_elf_binary.cpp b/runtime/program/process_elf_binary.cpp index 62e2ae7903..caea198fbb 100644 --- a/runtime/program/process_elf_binary.cpp +++ b/runtime/program/process_elf_binary.cpp @@ -138,7 +138,6 @@ cl_int Program::processElfBinary( if (retVal == CL_SUCCESS) { isProgramBinaryResolved = true; - buildStatus = CL_BUILD_SUCCESS; // Create an empty build log since program is effectively built updateBuildLog(pDevice, "", 1); diff --git a/unit_tests/api/cl_get_program_build_info_tests.cpp b/unit_tests/api/cl_get_program_build_info_tests.cpp index 83c27618f5..70abedb582 100644 --- a/unit_tests/api/cl_get_program_build_info_tests.cpp +++ b/unit_tests/api/cl_get_program_build_info_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * 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"), @@ -35,7 +35,7 @@ typedef api_tests clGetProgramBuildInfoTests; namespace ULT { -TEST_F(clGetProgramBuildInfoTests, success) { +TEST_F(clGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledThenReturnClBuildNone) { cl_program pProgram = nullptr; void *pSource = nullptr; size_t sourceSize = 0; @@ -109,4 +109,45 @@ TEST_F(clGetProgramBuildInfoTests, success) { deleteDataReadFromFile(pSource); CompilerInterface::shutdown(); } + +TEST_F(clGetProgramBuildInfoTests, givenElfBinaryWhenclGetProgramBuildInfoIsCalledThenReturnClBuildNone) { + cl_program pProgram = nullptr; + cl_int binaryStatus = CL_INVALID_VALUE; + void *pBinary = nullptr; + size_t binarySize = 0; + std::string testFile; + retrieveBinaryKernelFilename(testFile, "CopyBuffer_simd8_", ".bin"); + + ASSERT_EQ(true, fileExists(testFile)); + + binarySize = loadDataFromFile( + testFile.c_str(), + pBinary); + + ASSERT_NE(0u, binarySize); + ASSERT_NE(nullptr, pBinary); + + pProgram = clCreateProgramWithBinary( + pContext, + num_devices, + devices, + &binarySize, + (const unsigned char **)&pBinary, + &binaryStatus, + &retVal); + EXPECT_EQ(CL_SUCCESS, retVal); + EXPECT_NE(nullptr, pProgram); + EXPECT_EQ(CL_SUCCESS, binaryStatus); + + cl_build_status buildStatus; + retVal = clGetProgramBuildInfo(pProgram, devices[0], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, nullptr); + EXPECT_EQ(CL_SUCCESS, retVal); + EXPECT_EQ(CL_BUILD_NONE, buildStatus); + + deleteDataReadFromFile(pBinary); + + retVal = clReleaseProgram(pProgram); + EXPECT_EQ(CL_SUCCESS, retVal); + CompilerInterface::shutdown(); +} } // namespace ULT diff --git a/unit_tests/program/program_tests.cpp b/unit_tests/program/program_tests.cpp index 99486ad2e3..49d4f1372e 100644 --- a/unit_tests/program/program_tests.cpp +++ b/unit_tests/program/program_tests.cpp @@ -373,7 +373,7 @@ TEST_P(ProgramFromBinaryTest, GetBuildInfo_Status) { EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(param_value_size, param_value_size_ret); - EXPECT_EQ(CL_BUILD_SUCCESS, buildStatus); + EXPECT_EQ(CL_BUILD_NONE, buildStatus); } ////////////////////////////////////////////////////////////////////////////////