diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-07-08 11:33:50 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-08 18:33:50 +0000 |
| commit | a68e2635cbc9a555cfd1dab69a826d9af786aae2 (patch) | |
| tree | 97a83dad77d7cd03c0829260fd5cdd82b416fac2 /tools/slang-test/options.cpp | |
| parent | 69947dec841ea46e68ccdccae45a1080fcaea01c (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/options.cpp')
| -rw-r--r-- | tools/slang-test/options.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
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 <path> Set directory for binaries (default: the path to the " "slang-test executable)\n" " -test-dir <path> 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) { |
