summaryrefslogtreecommitdiff
path: root/tools/slang-test/test-reporter.cpp
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-07-08 11:33:50 -0700
committerGitHub <noreply@github.com>2025-07-08 18:33:50 +0000
commita68e2635cbc9a555cfd1dab69a826d9af786aae2 (patch)
tree97a83dad77d7cd03c0829260fd5cdd82b416fac2 /tools/slang-test/test-reporter.cpp
parent69947dec841ea46e68ccdccae45a1080fcaea01c (diff)
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 <ellieh+slangbot@nvidia.com>
Diffstat (limited to 'tools/slang-test/test-reporter.cpp')
-rw-r--r--tools/slang-test/test-reporter.cpp16
1 files changed, 13 insertions, 3 deletions
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 <mutex>
#include <stdio.h>
@@ -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);
}