summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-test/slang-test-main.cpp32
-rw-r--r--tools/slang-unit-test/unit-test-record-replay.cpp10
2 files changed, 38 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();
diff --git a/tools/slang-unit-test/unit-test-record-replay.cpp b/tools/slang-unit-test/unit-test-record-replay.cpp
index 1dc1a36d2..bc5baeafd 100644
--- a/tools/slang-unit-test/unit-test-record-replay.cpp
+++ b/tools/slang-unit-test/unit-test-record-replay.cpp
@@ -256,6 +256,16 @@ static SlangResult runExample(
hashLines.add(line);
}
+ if (hashLines.getCount() == 0)
+ {
+ msgBuilder << "Hash value is not found for '" << exampleName << "'\n";
+ msgBuilder << "Process ret code: " << exeRes.resultCode << "\n";
+ msgBuilder << "Standard output:\n" << exeRes.standardOutput << "\n";
+ msgBuilder << "Standard error:\n" << exeRes.standardError << "\n";
+ getTestReporter()->message(TestMessageType::TestFailure, msgBuilder.toString().getBuffer());
+ return SLANG_FAIL;
+ }
+
res = parseHashes(hashLines, outHashes);
if (SLANG_FAILED(res))
{