|
1 | 1 | /* |
2 | | - * Copyright (C) 2018-2024 Intel Corporation |
| 2 | + * Copyright (C) 2018-2025 Intel Corporation |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: MIT |
5 | 5 | * |
@@ -4606,6 +4606,44 @@ TEST(OclocCompile, GivenStatefulAddressModeWhenInvalidArgsPAssedThenErrorIsRetur |
4606 | 4606 | EXPECT_STRNE(output.c_str(), ""); |
4607 | 4607 | } |
4608 | 4608 |
|
| 4609 | +TEST(OclocCompile, GivenInvalidHeaplessModeOptionWhenOclocArgsAreParsedThenErrorIsReturned) { |
| 4610 | + |
| 4611 | + MockOfflineCompiler ocloc; |
| 4612 | + std::vector<std::string> args = { |
| 4613 | + "ocloc", |
| 4614 | + "-file", |
| 4615 | + clFiles + "copybuffer.cl", |
| 4616 | + "-device", |
| 4617 | + gEnvironment->devicePrefix.c_str(), |
| 4618 | + "-heapless_mode", |
| 4619 | + "invalid"}; |
| 4620 | + testing::internal::CaptureStdout(); |
| 4621 | + int retVal = ocloc.parseCommandLine(args.size(), args); |
| 4622 | + EXPECT_EQ(OCLOC_INVALID_COMMAND_LINE, retVal); |
| 4623 | + std::string output = testing::internal::GetCapturedStdout(); |
| 4624 | + EXPECT_STRNE(output.c_str(), ""); |
| 4625 | +} |
| 4626 | + |
| 4627 | +TEST(OclocCompile, GivenValidHeaplessModeOptionWhenOclocArgsAreParsedThenSuccessIsReturned) { |
| 4628 | + |
| 4629 | + for (auto heaplessMode : {"enable", "disable", "default"}) { |
| 4630 | + MockOfflineCompiler ocloc; |
| 4631 | + std::vector<std::string> args = { |
| 4632 | + "ocloc", |
| 4633 | + "-file", |
| 4634 | + clFiles + "copybuffer.cl", |
| 4635 | + "-device", |
| 4636 | + gEnvironment->devicePrefix.c_str(), |
| 4637 | + "-heapless_mode", |
| 4638 | + heaplessMode}; |
| 4639 | + testing::internal::CaptureStdout(); |
| 4640 | + int retVal = ocloc.parseCommandLine(args.size(), args); |
| 4641 | + EXPECT_EQ(OCLOC_SUCCESS, retVal); |
| 4642 | + std::string output = testing::internal::GetCapturedStdout(); |
| 4643 | + EXPECT_STREQ(output.c_str(), ""); |
| 4644 | + } |
| 4645 | +} |
| 4646 | + |
4609 | 4647 | TEST(OclocCompile, GivenStatefulAddressModeSetToBindlessWhenBuildThenBindlessModeInternalOptionsAreAdded) { |
4610 | 4648 | MockOfflineCompiler ocloc; |
4611 | 4649 |
|
|
0 commit comments