mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Ocloc return success when returning help
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
5cc970a503
commit
73264c65d4
@ -272,3 +272,37 @@ __kernel void k(){
|
||||
EXPECT_EQ(sourcesLen[0], sourceSection->data.size());
|
||||
EXPECT_STREQ(headerB, reinterpret_cast<const char *>(headerBSection->data.begin()));
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, GivenHelpParameterWhenDecodingThenHelpMsgIsPrintedAndSuccessIsReturned) {
|
||||
const char *argv[] = {
|
||||
"ocloc",
|
||||
"disasm",
|
||||
"--help"};
|
||||
unsigned int argc = sizeof(argv) / sizeof(const char *);
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = oclocInvoke(argc, argv,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_FALSE(output.empty());
|
||||
EXPECT_EQ(retVal, NEO::OfflineCompiler::ErrorCode::SUCCESS);
|
||||
}
|
||||
|
||||
TEST(OclocApiTests, GivenHelpParameterWhenEncodingThenHelpMsgIsPrintedAndSuccessIsReturned) {
|
||||
const char *argv[] = {
|
||||
"ocloc",
|
||||
"asm",
|
||||
"--help"};
|
||||
unsigned int argc = sizeof(argv) / sizeof(const char *);
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
int retVal = oclocInvoke(argc, argv,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
0, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr);
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_FALSE(output.empty());
|
||||
EXPECT_EQ(retVal, NEO::OfflineCompiler::ErrorCode::SUCCESS);
|
||||
}
|
||||
|
@ -583,9 +583,8 @@ TEST_F(OfflineCompilerTests, GivenHelpOptionThenBuildDoesNotOccur) {
|
||||
testing::internal::CaptureStdout();
|
||||
pOfflineCompiler = OfflineCompiler::create(argv.size(), argv, true, retVal, oclocArgHelperWithoutInput.get());
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_EQ(nullptr, pOfflineCompiler);
|
||||
EXPECT_STRNE("", output.c_str());
|
||||
EXPECT_EQ(OfflineCompiler::ErrorCode::PRINT_USAGE, retVal);
|
||||
EXPECT_EQ(OfflineCompiler::ErrorCode::SUCCESS, retVal);
|
||||
|
||||
delete pOfflineCompiler;
|
||||
}
|
||||
|
Reference in New Issue
Block a user