From e4d1200cb45260b2a114d6f4f8f8d0b389a7da56 Mon Sep 17 00:00:00 2001 From: "Janne Kiviluoto (NVIDIA)" <235827468+jkiviluoto-nv@users.noreply.github.com> Date: Wed, 8 Oct 2025 20:13:47 +0300 Subject: Add deterministic shuffling of tests in directory (#8622) Fixes #8621 Add command line options for enable shuffling as well as providing a custom seed. Use Mersenne-Twister engine for a deterministic shuffle. --- tools/slang-test/options.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tools/slang-test/options.cpp') diff --git a/tools/slang-test/options.cpp b/tools/slang-test/options.cpp index 1333407d1..051e9bcd2 100644 --- a/tools/slang-test/options.cpp +++ b/tools/slang-test/options.cpp @@ -90,6 +90,8 @@ static bool _isSubCommand(const char* arg) " -use-test-server Run tests using test server\n" " -use-fully-isolated-test-server Run each test in isolated server\n" " -capability Compile with the given capability\n" + " -shuffle-tests Shuffle tests in directories\n" + " -shuffle-seed Set shuffle seed (default: 1)\n" // Recent Windows runtime versions started opening a dialog popup window when // `abort()` is called, which breaks the CI workflow and some scripts that @@ -272,6 +274,24 @@ static bool _isSubCommand(const char* arg) { optionsOut->generateHLSLBaselines = true; } + else if (strcmp(arg, "-shuffle-tests") == 0) + { + optionsOut->shuffleTests = true; + } + else if (strcmp(arg, "-shuffle-seed") == 0) + { + if (argCursor == argEnd) + { + stdError.print("error: expected operand for '%s'\n", arg); + showHelp(stdError); + return SLANG_FAIL; + } + optionsOut->shuffleSeed = stringToInt(*argCursor++); + if (optionsOut->shuffleSeed <= 0) + { + optionsOut->shuffleSeed = 1; + } + } else if (strcmp(arg, "-release") == 0) { // Assumed to be handle by .bat file that called us -- cgit v1.2.3