Skip to content

Commit

Permalink
UnitKitSyntheticLok can pass and finish earlier than UnitSyntheticLok…
Browse files Browse the repository at this point in the history
… expects

It seems that UnitKitSyntheticLok regularly finishes successfully,
setting TestResult::Ok, before UnitSyntheticLok even gets to see that
the document is loaded.

UnitKitSyntheticLok flags UnitSyntheticLok that the test passed, so
presumably if we see that the test passed, then we are done don't
need to do anything else except exit.

Signed-off-by: Caolán McNamara <[email protected]>
Change-Id: I1111a195943789c5e31da814c8713e2b7b0070b3
  • Loading branch information
caolanm authored and vmiklos committed Jan 14, 2025
1 parent 1595644 commit 8a26f21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
1 change: 0 additions & 1 deletion test/UnitPerf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <string>
#include <thread>

/// Save torture testcase.
class UnitPerf : public UnitWSD
{
void testPerf(std::string testType, std::string fileType, std::string tracesStr);
Expand Down
16 changes: 14 additions & 2 deletions test/UnitSyntheticLok.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ namespace {
}
}

/// Save torture testcase.
bool testCompletedSuccess = false;

class UnitSyntheticLok : public UnitWSD
{
void loadAndSynthesize(const std::string& name, const std::string& docName);

public:
UnitSyntheticLok();
void invokeWSDTest() override;
void endTest(const std::string& reason) override;
};

void UnitSyntheticLok::loadAndSynthesize(
Expand All @@ -57,7 +59,11 @@ void UnitSyntheticLok::loadAndSynthesize(
poll->startThread();

Poco::URI uri(helpers::getTestServerURI());
auto wsSession = helpers::loadDocAndGetSession(poll, docName, uri, testname);
auto wsSession = helpers::loadDocAndGetSession(poll, docName, uri, testname, true, false);

// If we have already exitTest successfully when this returns, then that's fine.
if (testCompletedSuccess)
return;

std::vector<char> message
= wsSession->waitForMessage("status:", timeout, name);
Expand Down Expand Up @@ -88,6 +94,12 @@ void UnitSyntheticLok::invokeWSDTest()
// wait for result from the Kit process
}

void UnitSyntheticLok::endTest(const std::string& reason)
{
UnitWSD::endTest(reason);
testCompletedSuccess = !failed();
}

class UnitKitSyntheticLok;

UnitKitSyntheticLok *GlobalUnitKit;
Expand Down

0 comments on commit 8a26f21

Please sign in to comment.