mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Fix appveyor catch.hpp listener
* Don't completely lose/misappropriate errors in tests that don't have a base section * Change the filename to actually be a filename, and include the base test name as the first part of the section stack. * Don't over-multiply duration by 1000 to convert to milliseconds twice.
This commit is contained in:
Vendored
+16
-16
@@ -80,18 +80,13 @@ struct AppVeyorListener : Catch::TestEventListenerBase
|
||||
|
||||
SAFE_DELETE(sock);
|
||||
}
|
||||
|
||||
Catch::TestEventListenerBase::testRunStarting(testRunInfo);
|
||||
}
|
||||
|
||||
std::string curTest;
|
||||
std::vector<std::string> sectionStack;
|
||||
|
||||
virtual void testCaseStarting(Catch::TestCaseInfo const &testInfo) { curTest = testInfo.name; }
|
||||
virtual void sectionStarting(Catch::SectionInfo const §ionInfo)
|
||||
{
|
||||
if(curTest == sectionInfo.name)
|
||||
return;
|
||||
|
||||
sectionStack.push_back(sectionInfo.name);
|
||||
Catch::TestEventListenerBase::sectionStarting(sectionInfo);
|
||||
|
||||
if(enabled)
|
||||
{
|
||||
@@ -111,6 +106,8 @@ struct AppVeyorListener : Catch::TestEventListenerBase
|
||||
|
||||
virtual bool assertionEnded(Catch::AssertionStats const &assertionStats)
|
||||
{
|
||||
Catch::TestEventListenerBase::assertionEnded(assertionStats);
|
||||
|
||||
using namespace Catch;
|
||||
|
||||
if(!assertionStats.assertionResult.isOk())
|
||||
@@ -154,9 +151,6 @@ struct AppVeyorListener : Catch::TestEventListenerBase
|
||||
|
||||
virtual void sectionEnded(Catch::SectionStats const §ionStats)
|
||||
{
|
||||
if(curTest == sectionStats.sectionInfo.name)
|
||||
return;
|
||||
|
||||
if(enabled)
|
||||
{
|
||||
Network::Socket *sock = Network::CreateClientSocket(hostname.c_str(), port, 10);
|
||||
@@ -173,7 +167,7 @@ struct AppVeyorListener : Catch::TestEventListenerBase
|
||||
SAFE_DELETE(sock);
|
||||
}
|
||||
|
||||
sectionStack.pop_back();
|
||||
Catch::TestEventListenerBase::sectionEnded(sectionStats);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -188,14 +182,20 @@ private:
|
||||
if(update)
|
||||
outcome = passed ? "Passed" : "Failed";
|
||||
|
||||
std::string fileName;
|
||||
std::string testName;
|
||||
for(const std::string §ion : sectionStack)
|
||||
for(const Catch::SectionInfo §ion : m_sectionStack)
|
||||
{
|
||||
if(!testName.empty())
|
||||
testName += " > ";
|
||||
testName += section;
|
||||
testName += section.name;
|
||||
}
|
||||
|
||||
if(m_sectionStack.empty())
|
||||
fileName = currentTestCaseInfo->name;
|
||||
else
|
||||
fileName = m_sectionStack[0].lineInfo.file;
|
||||
|
||||
json = StringFormat::Fmt(R"(
|
||||
{
|
||||
"testName": "%s",
|
||||
@@ -208,8 +208,8 @@ private:
|
||||
"StdOut": "",
|
||||
"StdErr": ""
|
||||
})",
|
||||
testName.c_str(), curTest.c_str(), outcome,
|
||||
RDCMAX(msDuration * 1000.0, 0.0), escape(trim(errorList)).c_str());
|
||||
testName.c_str(), fileName.c_str(), outcome, RDCMAX(msDuration, 0.0),
|
||||
escape(trim(errorList)).c_str());
|
||||
|
||||
std::string http;
|
||||
http += StringFormat::Fmt("%s /api/tests HTTP/1.1\r\n", update ? "PUT" : "POST");
|
||||
|
||||
Reference in New Issue
Block a user