Commit 05b6740c by Jamie Madill Committed by Commit Bot

TestRunner: Fix test result handling.

The bots expect us to explicitly label "is_unexpected" for all unexpected results (e.g. failures). Also they construct a test filter from our test names so our result names have to match the tests exactly. That means removing prefixes like we have for the test suite name. Bug: angleproject:3162 Change-Id: I1a02ff8e26545b10a8829a3ee47be91f7459aa65 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2345028Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent ba7398c8
...@@ -214,8 +214,8 @@ void WriteResultsFile(bool interrupted, ...@@ -214,8 +214,8 @@ void WriteResultsFile(bool interrupted,
doc.AddMember("version", 3, allocator); doc.AddMember("version", 3, allocator);
doc.AddMember("seconds_since_epoch", secondsSinceEpoch, allocator); doc.AddMember("seconds_since_epoch", secondsSinceEpoch, allocator);
js::Value testSuite; js::Value tests;
testSuite.SetObject(); tests.SetObject();
std::map<TestResultType, uint32_t> counts; std::map<TestResultType, uint32_t> counts;
...@@ -232,6 +232,11 @@ void WriteResultsFile(bool interrupted, ...@@ -232,6 +232,11 @@ void WriteResultsFile(bool interrupted,
jsResult.AddMember("expected", "PASS", allocator); jsResult.AddMember("expected", "PASS", allocator);
jsResult.AddMember("actual", ResultTypeToJSString(result.type, &allocator), allocator); jsResult.AddMember("actual", ResultTypeToJSString(result.type, &allocator), allocator);
if (result.type != TestResultType::Pass)
{
jsResult.AddMember("is_unexpected", true, allocator);
}
js::Value times; js::Value times;
times.SetArray(); times.SetArray();
times.PushBack(result.elapsedTimeSeconds, allocator); times.PushBack(result.elapsedTimeSeconds, allocator);
...@@ -243,7 +248,7 @@ void WriteResultsFile(bool interrupted, ...@@ -243,7 +248,7 @@ void WriteResultsFile(bool interrupted,
js::Value jsName; js::Value jsName;
jsName.SetString(testName, allocator); jsName.SetString(testName, allocator);
testSuite.AddMember(jsName, jsResult, allocator); tests.AddMember(jsName, jsResult, allocator);
} }
js::Value numFailuresByType; js::Value numFailuresByType;
...@@ -260,10 +265,6 @@ void WriteResultsFile(bool interrupted, ...@@ -260,10 +265,6 @@ void WriteResultsFile(bool interrupted,
doc.AddMember("num_failures_by_type", numFailuresByType, allocator); doc.AddMember("num_failures_by_type", numFailuresByType, allocator);
js::Value tests;
tests.SetObject();
tests.AddMember(js::StringRef(testSuiteName), testSuite, allocator);
doc.AddMember("tests", tests, allocator); doc.AddMember("tests", tests, allocator);
printf("Writing test results to %s\n", outputFile.c_str()); printf("Writing test results to %s\n", outputFile.c_str());
...@@ -495,20 +496,7 @@ bool GetTestResultsFromJSON(const js::Document &document, TestResults *resultsOu ...@@ -495,20 +496,7 @@ bool GetTestResultsFromJSON(const js::Document &document, TestResults *resultsOu
} }
const js::Value::ConstObject &tests = document["tests"].GetObject(); const js::Value::ConstObject &tests = document["tests"].GetObject();
if (tests.MemberCount() != 1) for (auto iter = tests.MemberBegin(); iter != tests.MemberEnd(); ++iter)
{
return false;
}
const js::Value::Member &suite = *tests.MemberBegin();
if (!suite.value.IsObject())
{
return false;
}
const js::Value::ConstObject &actual = suite.value.GetObject();
for (auto iter = actual.MemberBegin(); iter != actual.MemberEnd(); ++iter)
{ {
// Get test identifier. // Get test identifier.
const js::Value &name = iter->name; const js::Value &name = iter->name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment