Fix for '-q' option in ocloc

Related-To: NEO-6425
Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
Warchulski, Jaroslaw
2022-11-10 13:10:24 +00:00
committed by Compute-Runtime-Automation
parent 0a07ea94c7
commit e9f0cb30e7
2 changed files with 44 additions and 5 deletions

View File

@ -1454,6 +1454,42 @@ TEST(OclocFatBinaryHelpersTest, givenNonEmptyBuildLogWhenBuildingFatbinaryForTar
EXPECT_EQ(expectedOutput, output);
}
TEST(OclocFatBinaryHelpersTest, givenNonEmptyBuildLogWhenBuildingFatbinaryForTargetThenBuildLogIsNotPrinted) {
::testing::internal::CaptureStdout();
using namespace std::string_literals;
const std::vector<std::string> argv = {
"ocloc",
"-q",
"-file",
clFiles + "copybuffer.cl",
"-device",
gEnvironment->devicePrefix.c_str()};
MockOfflineCompiler mockOfflineCompiler{};
mockOfflineCompiler.initialize(argv.size(), argv);
const auto mockArgHelper = mockOfflineCompiler.uniqueHelper.get();
const auto deviceConfig = getDeviceConfig(mockOfflineCompiler, mockArgHelper);
const char buildWarning[] = "Warning: this is a build log!";
mockOfflineCompiler.updateBuildLog(buildWarning, sizeof(buildWarning));
mockOfflineCompiler.buildReturnValue = OclocErrorCode::SUCCESS;
// Dummy value
mockOfflineCompiler.elfBinary = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
Ar::ArEncoder ar;
const std::string pointerSize{"32"};
const int previousReturnValue{OclocErrorCode::SUCCESS};
buildFatBinaryForTarget(previousReturnValue, argv, pointerSize, ar, &mockOfflineCompiler, mockArgHelper, deviceConfig);
const auto output{::testing::internal::GetCapturedStdout()};
EXPECT_TRUE(output.empty()) << output;
}
TEST(OclocFatBinaryHelpersTest, givenQuietModeWhenBuildingFatbinaryForTargetThenNothingIsPrinted) {
using namespace std::string_literals;