Skip to content

Commit 030f44d

Browse files
committed
Add some progress
This is a first attempt at providing some progress, at least something that shows that things are running. Often I click play and I can't tell.
1 parent 62dbcc5 commit 030f44d

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/common/runtime/standalone.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ const worker = optionEnabled('worker') ? new TestWorker(debug) : undefined;
3232

3333
const autoCloseOnPass = document.getElementById('autoCloseOnPass') as HTMLInputElement;
3434
const resultsVis = document.getElementById('resultsVis')!;
35+
const progressElem = document.getElementById('progress')!;
36+
const progressTestNameElem = progressElem.querySelector('.progress-test-name')!;
37+
const stopButtonElem = progressElem.querySelector('button')!;
38+
let runDepth = 0;
39+
let stopRequested = false;
40+
41+
stopButtonElem.addEventListener('click', () => {
42+
stopRequested = true;
43+
});
3544

3645
dataCache.setStore({
3746
load: async (path: string) => {
@@ -119,6 +128,7 @@ function makeCaseHTML(t: TestTreeLeaf): VisualizedSubtree {
119128
if (clearRenderedResult) clearRenderedResult();
120129

121130
const result: SubtreeResult = emptySubtreeResult();
131+
progressTestNameElem.textContent = name;
122132

123133
haveSomeResults = true;
124134
const [rec, res] = logger.record(name);
@@ -212,9 +222,28 @@ function makeSubtreeHTML(n: TestSubtree, parentLevel: TestQueryLevel): Visualize
212222
);
213223

214224
const runMySubtree = async () => {
225+
if (runDepth === 0) {
226+
stopRequested = false;
227+
progressElem.style.display = '';
228+
}
229+
if (stopRequested) {
230+
const result = emptySubtreeResult();
231+
result.skip = 1;
232+
result.total = 1;
233+
return result;
234+
}
235+
236+
++runDepth;
237+
215238
if (clearRenderedResult) clearRenderedResult();
216239
subtreeResult = await runSubtree();
217240
if (updateRenderedResult) updateRenderedResult();
241+
242+
--runDepth;
243+
if (runDepth === 0) {
244+
progressElem.style.display = 'none';
245+
}
246+
218247
return subtreeResult;
219248
};
220249

standalone/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@
102102
#info {
103103
font-family: monospace;
104104
}
105+
#progress {
106+
position: fixed;
107+
display: flex;
108+
width: 100%;
109+
left: 0;
110+
top: 0;
111+
background-color: #000;
112+
color: #fff;
113+
align-items: center;
114+
}
115+
#progress .progress-test-name {
116+
flex: 1 1;
117+
min-width: 0;
118+
overflow: hidden;
119+
text-overflow: ellipsis;
120+
direction: rtl;
121+
white-space: nowrap;
122+
}
105123
#resultsJSON {
106124
font-family: monospace;
107125
width: 100%;
@@ -356,6 +374,7 @@ <h1><img class="logo" src="webgpu-logo-notext.svg">WebGPU Conformance Test Suite
356374

357375
<div id="info"></div>
358376
<div id="resultsVis"></div>
377+
<div id="progress" style="display: none;"><button type="button">stop</button><div class="progress-test-name"></div></div>
359378

360379
<p>
361380
<input type="button" id="copyResultsJSON" value="Copy results as JSON">

0 commit comments

Comments
 (0)