From bccfad592cd80b3d81ae21435a001515011bd9c6 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 5 Apr 2022 23:12:30 -0500 Subject: [PATCH 1/2] Allow colored output when using `make --output-sync` Using `make -jN simulator-tests` wasn't producing colored output because it was not detecting the output as a terminal correctly. This change restores the terminal coloring when running the simulator. Signed-off-by: Michael Richters --- testing/googletest/googletest/src/gtest.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/googletest/googletest/src/gtest.cc b/testing/googletest/googletest/src/gtest.cc index 21c611af..b30d9410 100644 --- a/testing/googletest/googletest/src/gtest.cc +++ b/testing/googletest/googletest/src/gtest.cc @@ -3240,6 +3240,10 @@ bool ShouldUseColor(bool stdout_is_tty) { // console there does support colors. return stdout_is_tty; #else + // In case we're running from `make --output-sync`, we need to check + // MAKE_TERMOUT to determine if the output is going to a terminal. + const char* const make_termout = posix::GetEnv("MAKE_TERMOUT"); + if (make_termout != nullptr) stdout_is_tty = true; // On non-Windows platforms, we rely on the TERM variable. const char* const term = posix::GetEnv("TERM"); const bool term_supports_color = From 97b5de717a43d20d99d61e46c22e3bf51a7c6900 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Wed, 6 Apr 2022 00:29:40 -0500 Subject: [PATCH 2/2] Send ktest-to-cxx info output to stdout instead of stderr The output of test results from gtest gets sent to stdout, so it makes more sense to send this to stdout, as well. Signed-off-by: Michael Richters --- testing/bin/ktest-to-cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/bin/ktest-to-cxx b/testing/bin/ktest-to-cxx index 5f1f2aac..c2285714 100644 --- a/testing/bin/ktest-to-cxx +++ b/testing/bin/ktest-to-cxx @@ -361,7 +361,7 @@ sub generate_script { # We should do this better, inside the core. But until we do # I'd rather stick the macro in the code generator so nobody # gets to use it from regular tests, boxing us in - cxx('#define GTEST_COUT std::cerr << "[ INFO ] "'); + cxx('#define GTEST_COUT std::cout << "[ INFO ] "'); generate_start_new_test('KtestSourceFilename'); cxx(