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/options.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'tools/slang-test/options.cpp') diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp index aa538e75e..4103d56b5 100644 --- a/tools/slang-test/options.cpp +++ b/tools/slang-test/options.cpp @@ -69,7 +69,8 @@ static bool _isSubCommand(const char* arg) " -bindir Set directory for binaries (default: the path to the " "slang-test executable)\n" " -test-dir Set directory for test files (default: tests/)\n" - " -v Enable verbose output\n" + " -v [level] Set verbosity level (verbose, info, failure)\n" + " Default: verbose when -v used, info otherwise\n" " -hide-ignored Hide results from ignored tests\n" " -api-only Only run tests that use specified APIs\n" " -verbose-paths Use verbose paths in output\n" @@ -215,7 +216,35 @@ static bool _isSubCommand(const char* arg) } else if (strcmp(arg, "-v") == 0) { - optionsOut->shouldBeVerbose = true; + if (argCursor == argEnd) + { + // Default to verbose if no argument provided (backward compatibility) + optionsOut->verbosity = VerbosityLevel::Verbose; + } + else + { + const char* verbosityArg = *argCursor; + if (strcmp(verbosityArg, "verbose") == 0) + { + optionsOut->verbosity = VerbosityLevel::Verbose; + argCursor++; + } + else if (strcmp(verbosityArg, "info") == 0) + { + optionsOut->verbosity = VerbosityLevel::Info; + argCursor++; + } + else if (strcmp(verbosityArg, "failure") == 0) + { + optionsOut->verbosity = VerbosityLevel::Failure; + argCursor++; + } + else + { + // Not a verbosity level, treat as old-style -v + optionsOut->verbosity = VerbosityLevel::Verbose; + } + } } else if (strcmp(arg, "-hide-ignored") == 0) { -- cgit v1.2.3