Revert "Fix for '-q' option in ocloc"

This reverts commit e9f0cb30e7.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2022-11-16 05:32:39 +01:00
committed by Compute-Runtime-Automation
parent 6f4e7b98dc
commit ef9a4fffcd
2 changed files with 5 additions and 44 deletions

View File

@@ -1454,42 +1454,6 @@ TEST(OclocFatBinaryHelpersTest, givenNonEmptyBuildLogWhenBuildingFatbinaryForTar
EXPECT_EQ(expectedOutput, output); 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) { TEST(OclocFatBinaryHelpersTest, givenQuietModeWhenBuildingFatbinaryForTargetThenNothingIsPrinted) {
using namespace std::string_literals; using namespace std::string_literals;

View File

@@ -416,14 +416,11 @@ int OfflineCompiler::build() {
void OfflineCompiler::updateBuildLog(const char *pErrorString, const size_t errorStringSize) { void OfflineCompiler::updateBuildLog(const char *pErrorString, const size_t errorStringSize) {
std::string errorString = (errorStringSize && pErrorString) ? std::string(pErrorString, pErrorString + errorStringSize) : ""; std::string errorString = (errorStringSize && pErrorString) ? std::string(pErrorString, pErrorString + errorStringSize) : "";
if (errorString[0] != '\0') { if (errorString[0] != '\0') {
bool errorFound = (errorString.find("Error") != std::string::npos) || (errorString.find("error") != std::string::npos); if (buildLog.empty()) {
if (!isQuiet() || errorFound) { buildLog.assign(errorString.c_str());
if (buildLog.empty()) { } else {
buildLog.assign(errorString.c_str()); buildLog.append("\n");
} else { buildLog.append(errorString.c_str());
buildLog.append("\n");
buildLog.append(errorString.c_str());
}
} }
} }
} }