mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-31 20:13:04 +08:00
test: StreamCapture on pipes
Enhance StreamCapture class to mimic gtest's CaptureStdout/Stderr functionality. Store data in a pipe instead of a temporary file like gtest resulting in faster test execution Signed-off-by: Marcel Skierkowski <marcel.skierkowski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
767755df94
commit
a52260ce63
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/program/print_formatter.h"
|
||||
#include "shared/test/common/helpers/stream_capture.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_kernel_info.h"
|
||||
|
||||
@@ -1009,9 +1010,10 @@ TEST_F(PrintFormatterTest, GivenTypeSmallerThan4BThenItIsReadAs4BValue) {
|
||||
}
|
||||
|
||||
TEST(printToStdoutTest, GivenStringWhenPrintingToStdoutThenOutputOccurs) {
|
||||
testing::internal::CaptureStdout();
|
||||
StreamCapture capture;
|
||||
capture.captureStdout();
|
||||
printToStdout("test");
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
std::string output = capture.getCapturedStdout();
|
||||
EXPECT_STREQ("test", output.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user