Skip to content

Commit

Permalink
wasm/per-file: Link to the exact line for tests that have the info
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpfard committed Jun 10, 2024
1 parent 2af17a6 commit c70c04f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
30 changes: 15 additions & 15 deletions test262/per-file/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function generateResults() {
Object.keys(results.results).map((name) => [
name,
{ [results.results[name]]: 1 },
])
]),
);

return;
Expand All @@ -80,7 +80,7 @@ function generateResults() {
for (const name in results.children) {
const childResults = results.children[name];
results.aggregatedResults = Object.keys(
childResults.aggregatedResults
childResults.aggregatedResults,
).reduce((acc, mode) => {
if (!(mode in acc)) acc[mode] = {};
const modeAcc = acc[mode];
Expand Down Expand Up @@ -109,7 +109,7 @@ function generateResults() {
summaryStatusLabel = document.getElementById("summary-status");
leafTreeNodeTemplate = document.getElementById("leaf-tree-node-template");
nonLeafTreeNodeTemplate = document.getElementById(
"nonleaf-tree-node-template"
"nonleaf-tree-node-template",
);

// Now make a nice lazy-loaded collapsible tree in `resultsNode`.
Expand Down Expand Up @@ -192,7 +192,7 @@ function navigate() {
history.pushState(
{ pathInTree },
pathInTree[pathInTree.length - 1],
generateQueryString(pathInTree)
generateQueryString(pathInTree),
);
regenerateResults(resultsNode);
}
Expand Down Expand Up @@ -235,10 +235,10 @@ function generateChildNode(childName, child, filepath) {
childNode.querySelector(".tree-node-name").textContent = childName;
childNode.querySelector(".tree-node-name").title = filepath;
childNode.querySelector(".tree-node-status").innerHTML = generateStatus(
child.aggregatedResults
child.aggregatedResults,
);
childNode.querySelector(".tree-node-github-url").href =
window.config.generateGitHubURLFromTestPath(filepath);
window.config.generateGitHubURLFromTestPath(filepath, childName);
return childNode;
}

Expand Down Expand Up @@ -266,12 +266,12 @@ let checkASTOnly = true;
function entryHasFilteredResultType([, child]) {
if (checkASTOnly && "AST" in child.aggregatedResults) {
return Object.keys(child.aggregatedResults.AST).some((type) =>
shownResultTypes.has(type)
shownResultTypes.has(type),
);
}

return Object.values(child.aggregatedResults).some((testType) =>
Object.keys(testType).some((type) => shownResultTypes.has(type))
Object.keys(testType).some((type) => shownResultTypes.has(type)),
);
}

Expand All @@ -294,7 +294,7 @@ function regenerateResults(targetNode) {
const childNode = generateChildNode(
childName,
child,
`${pathInTree.join("/")}/${childName}`
`${pathInTree.join("/")}/${childName}`,
);

const isLeaf = child.children === null;
Expand All @@ -320,7 +320,7 @@ function regenerateResults(targetNode) {
const childrenResults = searchResults(
child.children,
false,
relativePath + "/"
relativePath + "/",
);
if (isSearchedFor)
childrenResults.push([childName, child, relativePath]);
Expand Down Expand Up @@ -348,7 +348,7 @@ function regenerateResults(targetNode) {
const childrenResults = filterInternal(
child.children,
isSearchedFor,
relativePath + "/"
relativePath + "/",
);
if (!isSearchedFor && childrenResults.length === 0 && !allChildren)
return [];
Expand All @@ -361,7 +361,7 @@ function regenerateResults(targetNode) {

let results = filterInternal(
result,
pathInTree.join("/").toLowerCase().includes(needle)
pathInTree.join("/").toLowerCase().includes(needle),
);

while (results.length === 1 && results[0][3] !== null)
Expand All @@ -380,7 +380,7 @@ function regenerateResults(targetNode) {
const childNode = generateChildNode(
childName,
child,
`${pathInTree.join("/")}/${relativePath}`
`${pathInTree.join("/")}/${relativePath}`,
);

if (child.children !== null) {
Expand Down Expand Up @@ -436,7 +436,7 @@ function generateStatus(aggregatedResults) {
const stats = aggregatedResults[mode];
const total = Object.keys(stats).reduce(
(acc, name) => acc + stats[name],
0
0,
);
if (total === 0) return acc;
acc.push(`<div class="mode-summary-container">
Expand All @@ -463,7 +463,7 @@ document.addEventListener("DOMContentLoaded", () => {
promises.push(
fetchData(path)
.then((response) => response.json())
.then((data) => initialize(data, mode))
.then((data) => initialize(data, mode)),
);
}
Promise.all(promises).then(() => generateResults());
Expand Down
8 changes: 5 additions & 3 deletions wasm/per-file/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -60,10 +60,12 @@ <h2>Per-file results</h2>
window.config = {
initialPathInTree: "Spec",
loadPathsAndModes: [["wasm/per-file-master.json", "Default"]],
generateGitHubURLFromTestPath(filepath) {
generateGitHubURLFromTestPath(filepath, testName) {
const result = /^Spec\/(.*)\.js\/[^:]*::(.*)*$/.exec(filepath);
if (!result) return "";
return `https://github.com/WebAssembly/testsuite/blob/main/${result[1]}.wast`;
const lineNumber = /\(line (\d+)\)$/.exec(testName);
const line = lineNumber ? `#L${lineNumber[1]}` : "";
return `https://github.com/WebAssembly/testsuite/blob/main/${result[1]}.wast${line}`;
},
};
</script>
Expand Down

0 comments on commit c70c04f

Please sign in to comment.