summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-05-28 10:53:41 -0700
committerGitHub <noreply@github.com>2024-05-28 10:53:41 -0700
commitf6b755dc62df5ff796eb076ae1459a69746ee2f7 (patch)
tree6295c6aa2efd38722fa3453c4892b5a9e06d64d1 /tools
parent9323095c1aa35d8a406f3d94d7abf2d5621b01e9 (diff)
Simplify test file names for slang-test (#4227)
When slang-test.exe ran with a file name doesn't exactly match character-by-character, those tests don't run. This commit alters the file name given from the command-line and it will behave in a more expected way. - "./" are removed. - "../" gets removed along with its parent directory name. - Back-slash characters will be converted to slash on Windows.
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-test/options.cpp9
-rw-r--r--tools/slang-test/options.h2
2 files changed, 9 insertions, 2 deletions
diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp
index 895b7e2bb..0f3abfdf2 100644
--- a/tools/slang-test/options.cpp
+++ b/tools/slang-test/options.cpp
@@ -330,7 +330,14 @@ static bool _isSubCommand(const char* arg)
// first positional argument is source shader path
- optionsOut->testPrefixes = std::move(positionalArgs);
+ optionsOut->testPrefixes.clear();
+ optionsOut->testPrefixes.reserve(positionalArgs.getCount());
+ for (auto testPrefix : positionalArgs)
+ {
+ Slang::StringBuilder sb;
+ Slang::Path::simplify(testPrefix, Slang::Path::SimplifyStyle::NoRoot, sb);
+ optionsOut->testPrefixes.add(sb);
+ }
if (optionsOut->binDir.getLength() == 0)
{
diff --git a/tools/slang-test/options.h b/tools/slang-test/options.h
index ae4d02234..2b9ed946b 100644
--- a/tools/slang-test/options.h
+++ b/tools/slang-test/options.h
@@ -53,7 +53,7 @@ struct Options
Slang::String binDir;
// only run test cases with names have one of these prefixes.
- Slang::List<const char *> testPrefixes;
+ Slang::List<Slang::String> testPrefixes;
// generate extra output (notably: command lines we run)
bool shouldBeVerbose = false;