Skip to content

Commit

Permalink
Prefer the stateless approach over the stateful one for submitting te…
Browse files Browse the repository at this point in the history
…sts.

After experimenting with the approach proposed, it appears that the new approach break many workflows that submitter adapted for, which cannot be trivially fixed due to the stateful nature of this approach.

an example of that is the test run page requires another user interaction to reflect a new change on the branch after fetching first time occurred.
  • Loading branch information
peregrineshahin authored and ppigazzini committed Aug 28, 2023
1 parent 87317f7 commit ff8fcee
Showing 1 changed file with 0 additions and 67 deletions.
67 changes: 0 additions & 67 deletions server/fishtest/templates/tests_run.mak
Original file line number Diff line number Diff line change
Expand Up @@ -692,73 +692,6 @@
update_sprt_bounds(e.target.value);
});

function stripMessage(m, regex) {
const lines = m.trim().split("\n");
let lastLine = lines[lines.length - 1].trim();

if (regex.test(lastLine))
lines[lines.length - 1] = "";

let s = lines.join("\n");
s = s.replace(/[ \t]+/g, " ");
s = s.replace(/\n+/g, "\n");
return s.trimRight();
}

async function onBranchInput(e) {
if (stopRule === "stop-rule-spsa")
return;

let testRepo = document.getElementById("tests-repo").value;
if (!testRepo) return;

testRepo = testRepo.replace(
"https://github.com",
"https://api.github.com/repos"
);

let branch = e.target.value;
if (!branch) return;

const apiUrl = testRepo + "/commits/" + branch;

const response = await fetch(apiUrl);

if (!response.ok) {
console.error("HTTP error! Status: " + response.status);
return;
}

const commitData = await response.json();
const c = commitData.commit;

const regex = /(^|\s)[Bb]ench[ :]+([1-9]\d{5,7})(?!\d)/;
const lines = c.message.split("\n");
const lastLine = lines[lines.length - 1].trim();
const match = lastLine.match(regex);

if (match) {
const bench = match[2];
if (e.target.id === "test-branch") {
document.getElementById("test-signature").value = bench;
document.getElementById("run-info").value = stripMessage(c.message, regex);
}

if (e.target.id === "base-branch")
document.getElementById("base-signature").value = bench;
}
}

if (!is_rerun) {
document
.getElementById("test-branch")
.addEventListener("input", onBranchInput);
document
.getElementById("base-branch")
.addEventListener("input", onBranchInput);
}


let initial_base_branch = document.getElementById("base-branch").value;
let initial_base_signature = document.getElementById("base-signature").value;
let spsa_do_not_save = false;
Expand Down

0 comments on commit ff8fcee

Please sign in to comment.