-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.htm
76 lines (71 loc) · 2.04 KB
/
test.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TestU01.js</title>
<script>
var worker = new Worker("worker.js");
function start() {
var battery = document.getElementById("battery").value;
var numTests = 0;
switch (battery) {
case "SmallCrush": numTests = 10; break;
case "Crush": numTests = 96; break;
case "BigCrush": numTests = 106; break;
default: console.error("Invalid battery"); return;
}
var done = false;
var curTest = 0;
var t0 = new Date;
worker.postMessage(battery);
document.getElementById("battery").disabled = true;
worker.onmessage = function(e) {
if (typeof e.data.output === "string") {
if (e.data.output.indexOf("HOST =") >= 0) {
curTest++;
}
var output = document.getElementById("output");
output.value += e.data.output + "\n";
output.scrollTop = output.scrollHeight;
return;
}
if (e.data.done === true) {
done = true;
return;
}
}
document.getElementById("start").disabled = true;
var interval = setInterval(function() {
var sec = ((new Date - t0) / 1000)|0;
var status = done ? "Done." : "Running...";
status += " (" + sec + " seconds";
if (!done) {
status += ", test " + curTest + " of " + numTests;
}
status += ")";
document.getElementById("status").innerHTML = status;
if (done)
clearInterval(interval);
}, 500);
}
</script>
<style>
body { font-family: sans-serif; }
</style>
</head>
<body>
<form>
Suite:
<select id="battery">
<option>SmallCrush</option>
<option>Crush</option>
<option>BigCrush</option>
</select>
<span style="font-size:11px">(warning: running Crush and BigCrush will take a long time!)</span>
</form>
<button onclick="start()" id="start">Start!</button>
<hr>
<span id="status">Ready</span><br>
<textarea id="output" style="width:800px; height:500px; font-family:monospace; font-size:11px;"></textarea>
</body>
</html>