summaryrefslogtreecommitdiff
path: root/tools/slang-test
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-05-11 08:13:25 +0000
committerGitHub <noreply@github.com>2025-05-11 08:13:25 +0000
commitb46c342f47b61119a0dc517ce6eb75eab3398504 (patch)
treeb298a229eaca41fd8ea37461f774788f005f9c12 /tools/slang-test
parent7cd502256dde2fc32a1dd77462a69b6f8e84c288 (diff)
Add a new option "-capability" to slang-test and render-test (#7054)
Diffstat (limited to 'tools/slang-test')
-rw-r--r--tools/slang-test/options.cpp11
-rw-r--r--tools/slang-test/options.h1
-rw-r--r--tools/slang-test/slang-test-main.cpp12
3 files changed, 24 insertions, 0 deletions
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp
index da8702031..6be590ef2 100644
--- a/tools/slang-test/options.cpp
+++ b/tools/slang-test/options.cpp
@@ -87,6 +87,7 @@ static bool _isSubCommand(const char* arg)
" -use-shared-library Run tests in-process using shared library\n"
" -use-test-server Run tests using test server\n"
" -use-fully-isolated-test-server Run each test in isolated server\n"
+ " -capability <name> Compile with the given capability\n"
"\n"
"Output modes:\n"
" -appveyor Use AppVeyor output format\n"
@@ -359,6 +360,16 @@ static bool _isSubCommand(const char* arg)
{
optionsOut->emitSPIRVDirectly = false;
}
+ else if (strcmp(arg, "-capability") == 0)
+ {
+ if (argCursor == argEnd)
+ {
+ stdError.print("error: expected operand for '%s'\n", arg);
+ showHelp(stdError);
+ return SLANG_FAIL;
+ }
+ optionsOut->capabilities.add(*argCursor++);
+ }
else if (strcmp(arg, "-expected-failure-list") == 0)
{
if (argCursor == argEnd)
diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h
index bd8ee5499..7fda33198 100644
--- a/tools/slang-test/options.h
+++ b/tools/slang-test/options.h
@@ -123,6 +123,7 @@ struct Options
bool emitSPIRVDirectly = true;
+ Slang::HashSet<Slang::String> capabilities;
Slang::HashSet<Slang::String> expectedFailureList;
/// Parse the args, report any errors into stdError, and write the results into optionsOut
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 42432e328..92e50737e 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -1583,6 +1583,12 @@ static SlangResult _initSlangCompiler(TestContext* context, CommandLine& ioCmdLi
ioCmdLine.addArgIfNotFound("-verbose-paths");
}
+ for (auto& capability : context->options.capabilities)
+ {
+ ioCmdLine.addArg("-capability");
+ ioCmdLine.addArg(capability.getBuffer());
+ }
+
// Look for definition of a slot
{
@@ -3382,6 +3388,12 @@ static void _addRenderTestOptions(const Options& options, CommandLine& ioCmdLine
{
ioCmdLine.addArg("-emit-spirv-via-glsl");
}
+
+ for (auto capability : options.capabilities)
+ {
+ ioCmdLine.addArg("-capability");
+ ioCmdLine.addArg(capability);
+ }
}
static SlangResult _extractProfileTime(const UnownedStringSlice& text, double& timeOut)