Commit 5ff7234f authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Fix results.html for showing results of flaky tests run multiple iterations

run_web_tests.py --iterations=100 [--exit-after-n-failures=1] is very
useful for running a slightly flaky test [until it fails]. Previously
results.html failed to display actual and expected results for a test
with multiple results like "PASS PASS PASS PASS PASS FAIL".

Now when collecting artifacts of a test, if the normal loop fails to
find any artifact, we'll use the last found artifacts.

Change-Id: I6de2be6eafcd0b0295b21df5b8d69866f55b9c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2259514Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781400}
parent 592195c4
...@@ -1126,6 +1126,7 @@ const GUI = { ...@@ -1126,6 +1126,7 @@ const GUI = {
for(let [iteration, result] of test.actual.split(' ').entries()){ for(let [iteration, result] of test.actual.split(' ').entries()){
if(test.artifacts != null){ if(test.artifacts != null){
let perIterationArtifact = Object(); let perIterationArtifact = Object();
let lastArtifact = Object();
for(let [name, paths] of Object.entries(test.artifacts)){ for(let [name, paths] of Object.entries(test.artifacts)){
for(let path of paths){ for(let path of paths){
const is_retry_artifact_path = (path.startsWith('layout-test-results/retry_') || const is_retry_artifact_path = (path.startsWith('layout-test-results/retry_') ||
...@@ -1136,9 +1137,15 @@ const GUI = { ...@@ -1136,9 +1137,15 @@ const GUI = {
perIterationArtifact[name] = []; perIterationArtifact[name] = [];
} }
perIterationArtifact[name].push(path); perIterationArtifact[name].push(path);
} else {
lastArtifact[name] = path;
} }
} }
} }
for (let [name, artifact] of Object.entries(lastArtifact)) {
if (!perIterationArtifact.hasOwnProperty(name))
perIterationArtifact[name] = [artifact];
}
actual_results.push(GUI.translateArtifactsIntoResult( actual_results.push(GUI.translateArtifactsIntoResult(
perIterationArtifact, result, test)); perIterationArtifact, result, test));
}else{ }else{
......
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