From a68e2635cbc9a555cfd1dab69a826d9af786aae2 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Tue, 8 Jul 2025 11:33:50 -0700 Subject: Improve slang-test output verbosity control (#7625) * Improve slang-test output verbosity control This commit improves the existing command-line argument for slang-test, "-v". Previously it printed more information when "-v" was used. This commit adds a new option to silence the information output so that LLM processes less tokens when things are working as expected. * format code (#74) --------- Co-authored-by: slangbot --- tools/slang-test/test-reporter.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tools/slang-test/test-reporter.cpp') diff --git a/tools/slang-test/test-reporter.cpp b/tools/slang-test/test-reporter.cpp index 352245028..3aba10566 100644 --- a/tools/slang-test/test-reporter.cpp +++ b/tools/slang-test/test-reporter.cpp @@ -3,6 +3,7 @@ #include "../../source/core/slang-process-util.h" #include "../../source/core/slang-string-util.h" +#include "options.h" #include #include @@ -91,7 +92,7 @@ TestReporter::TestReporter() m_inTest = false; m_dumpOutputOnFailure = false; - m_isVerbose = false; + m_verbosity = VerbosityLevel::Info; } Result TestReporter::init( @@ -371,8 +372,17 @@ void TestReporter::_addResult(TestInfo info) m_testInfos.add(info); - auto defaultOutputFunc = [](const TestInfo& info) + auto defaultOutputFunc = [this](const TestInfo& info) { + // Skip output for passed/ignored tests if verbosity < Info + if (m_verbosity < VerbosityLevel::Info) + { + if (info.testResult == TestResult::Pass || info.testResult == TestResult::Ignored) + { + return; + } + } + char const* resultString = "UNEXPECTED"; switch (info.testResult) { @@ -589,7 +599,7 @@ void TestReporter::message(TestMessageType type, const String& message) if (type == TestMessageType::Info) { - if (m_isVerbose && canWriteStdError()) + if (m_verbosity == VerbosityLevel::Verbose && canWriteStdError()) { fputs(message.getBuffer(), stderr); } -- cgit v1.2.3