diff options
Diffstat (limited to 'tools/slang-test')
| -rw-r--r-- | tools/slang-test/options.cpp | 13 | ||||
| -rw-r--r-- | tools/slang-test/options.h | 4 | ||||
| -rw-r--r-- | tools/slang-test/slang-test-main.cpp | 15 |
3 files changed, 13 insertions, 19 deletions
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp index 11188d766..ab0d3a01e 100644 --- a/tools/slang-test/options.cpp +++ b/tools/slang-test/options.cpp @@ -310,18 +310,7 @@ static bool _isSubCommand(const char* arg) // first positional argument is source shader path - if (positionalArgs.getCount()) - { - optionsOut->testPrefix = positionalArgs[0]; - positionalArgs.removeAt(0); - } - - // any remaining arguments represent an error - if (positionalArgs.getCount() != 0) - { - stdError.print("unexpected arguments\n"); - return SLANG_FAIL; - } + optionsOut->testPrefixes = std::move(positionalArgs); if (optionsOut->binDir.getLength() == 0) { diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h index 26b8e7500..e786a0a74 100644 --- a/tools/slang-test/options.h +++ b/tools/slang-test/options.h @@ -52,8 +52,8 @@ struct Options // Directory to use when looking for binaries to run. If empty it's not set. Slang::String binDir; - // only run test cases with names that have this prefix. - char const* testPrefix = nullptr; + // only run test cases with names have one of these prefixes. + Slang::List<const char *> testPrefixes; // generate extra output (notably: command lines we run) bool shouldBeVerbose = false; diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp index 71f5c04bd..51c618187 100644 --- a/tools/slang-test/slang-test-main.cpp +++ b/tools/slang-test/slang-test-main.cpp @@ -3900,15 +3900,20 @@ static bool shouldRunTest( if(!endsWithAllowedExtension(context, filePath)) return false; - if( context->options.testPrefix ) + if(!context->options.testPrefixes.getCount()) { - if( strncmp(context->options.testPrefix, filePath.begin(), strlen(context->options.testPrefix)) != 0 ) + return true; + } + + // If we have prefixes, it has to match one of them + for(auto& p : context->options.testPrefixes) + { + if(filePath.startsWith(p)) { - return false; + return true; } } - - return true; + return false; } void getFilesInDirectory(String directoryPath, List<String>& files) |
