summaryrefslogtreecommitdiff
path: root/tools/slang-test
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2025-06-18 16:38:39 -0700
committerGitHub <noreply@github.com>2025-06-18 16:38:39 -0700
commit3cbc500118d27f82c89f401ffb34826264e9cb60 (patch)
tree0d3cb7e997f4a2fd5037f515f0e4cc8b43259ec1 /tools/slang-test
parent777ac6cae9776cd2d28bd5a9f627261ba9740153 (diff)
Fix retry logic for unit test (#7471)
* Fix the ignored unit-tests on retry * Retrigger CI * Add more error messages * Don't use test-server for retry of unit-test to see error messages * Clean up cl.yml Remove 'has-gpu' because it is unused after debug became full-gpu-test. Renamed files to make the meaning more clear: - Renamed expected-failure.txt to expected-failure-via-glsl.txt - Renamed expected-failure-github-runner.txt to expected-failure-no-gpu.txt * Rename cpu-hello-world.slang to avoid name conflict to example We have an example whose executable name is cpu-hello-world.exe. It gets built when you run `cmake --build`, but it gets overwritten by slang-test when it tests `tests/cpu-program/cpu-hello-world.slang`. This PR renames to avoid the name conflict. * Remove debug code --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tools/slang-test')
-rw-r--r--tools/slang-test/slang-test-main.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index f03ae8292..a5f5ee316 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -949,21 +949,37 @@ static Result _executeRPC(
JSONRPCConnection* rpcConnection = context->getOrCreateJSONRPCConnection();
if (!rpcConnection)
{
+ context->getTestReporter()->messageFormat(
+ TestMessageType::RunError,
+ "JSON RPC failure: getOrCreateJSONRPCConnection()");
return SLANG_FAIL;
}
// Execute
if (SLANG_FAILED(rpcConnection->sendCall(method, rttiInfo, args)))
{
+ context->getTestReporter()->messageFormat(
+ TestMessageType::RunError,
+ "JSON RPC failure: sendCall()");
+
context->destroyRPCConnection();
return SLANG_FAIL;
}
// Wait for the result
- rpcConnection->waitForResult(context->connectionTimeOutInMs);
+ if (SLANG_FAILED(rpcConnection->waitForResult(context->connectionTimeOutInMs)))
+ {
+ context->getTestReporter()->messageFormat(
+ TestMessageType::RunError,
+ "JSON RPC failure: waitForResult()");
+ }
if (!rpcConnection->hasMessage())
{
+ context->getTestReporter()->messageFormat(
+ TestMessageType::RunError,
+ "JSON RPC failure: hasMessage()");
+
// We can assume somethings gone wrong. So lets kill the connection and fail.
context->destroyRPCConnection();
return SLANG_FAIL;
@@ -971,6 +987,10 @@ static Result _executeRPC(
if (rpcConnection->getMessageType() != JSONRPCMessageType::Result)
{
+ context->getTestReporter()->messageFormat(
+ TestMessageType::RunError,
+ "JSON RPC failure: getMessageType() != JSONRPCMessageType::Result");
+
context->destroyRPCConnection();
return SLANG_FAIL;
}
@@ -979,6 +999,10 @@ static Result _executeRPC(
TestServerProtocol::ExecutionResult exeRes;
if (SLANG_FAILED(rpcConnection->getMessage(&exeRes)))
{
+ context->getTestReporter()->messageFormat(
+ TestMessageType::RunError,
+ "JSON RPC failure: getMessage()");
+
context->destroyRPCConnection();
return SLANG_FAIL;
}
@@ -4780,8 +4804,8 @@ static SlangResult runUnitTestModule(
}
// If the test failed and it is not an expected failure, add it to the list of
- // failed unit tests.
- if (isFailed &&
+ // failed unit tests so that we can retry.
+ if (isFailed && !context->isRetry &&
!context->getTestReporter()->m_expectedFailureList.contains(test.testName))
{
std::lock_guard lock(context->mutexFailedTests);
@@ -5142,7 +5166,7 @@ SlangResult innerMain(int argc, char** argv)
int main(int argc, char** argv)
{
- const SlangResult res = innerMain(argc, argv);
+ SlangResult res = innerMain(argc, argv);
slang::shutdown();
Slang::RttiInfo::deallocateAll();