Review of the test system
Date: 2026-11-12. Method: static review. Nothing was built or run.
Sources: src/tools/test_all, src/e2e, src/tools/e2e, src/tools/wpt, src/tools/test262, the unit tests,
.github/workflows/ci.yml, and three CI logs of 2026-11-09 kept in build/ (ci_win.log, ci_win2.log,
ci_win3.log, ci_linux.log).
Each finding gives a location, the cost, and a fix. Findings are ordered by gain in each section. A time marked "measured" comes from the CI logs. A time marked "estimate" is a calculation from those numbers.
Summary
The tests are mostly built on conditions. The lint of sleeps works. Fixed delays are not the main cost.
The main costs are these:
- The Windows runner is saturated.
test_alltakes 1810 s with 100 % of its two slots busy and 3.8 of 4 processors in use (measured). A shorter wait does not help there. Less CPU work or more runners help. - One job runs everything. Three groups of steps do not depend on each other and can run on three runners.
- Bounds are long. A failed barrier costs 240 s. A stuck step costs 900 s. Some steps have a bound of 4 hours. Some waits have no bound.
- Nothing stops a run in which the same failure repeats in every step. This is the most probable cause of a job that reaches its 90 minutes.
Expected gains:
| Change | Windows job | Linux job | Local run |
|---|---|---|---|
| Split the Windows job in three (3.1) | 34 min to 14-16 min (estimate) | ||
| No software frames for tests that read no pixel (4.1) | minus 3 to 4 min before the split (estimate) | minus some CPU | |
| Cache the JavaScript engine on Linux (4.3) | minus 3 min (measured) | ||
| Cache the test server programs (4.4) | minus 1 min (estimate) | ||
| One sweep of the check build, not two (4.2) | minus 5 min or more (estimate) | ||
| Short deadlines and a circuit breaker (2.1, 2.2) | worst case 90 min to 45 min; a failing test 240 s to 60 s | same | same |
e2e_test does not wait for the browser build (3.2) | minus 18 to 107 s after a change of the browser |
Measured baseline
Windows job, run ci_win3.log (4 vCPU, -Jobs 2):
- Setup and caches: 150 s.
wrentool build: 64 s.test_all: 1810 s. Total: about 34 min. test_all: 3871 s of steps, 6787 s of CPU, 1707 processes, 211 steps.
The steps that use the most CPU (measured):
| Step | Wall | CPU |
|---|---|---|
Local pages on the check build (wrentool sweep) | 376 s | 964 s |
| Check build: scripted session and endurance | 278 s | 760 s |
busy_page (two steps) | 222 s | 428 s |
cursor | 185 s | 265 s |
Build of e2e_test | 81 s | 240 s |
text_decoration | 74 s | 233 s |
inline_svg_hover (failed on a capture timeout) | 139 s | 202 s |
| web-platform-tests | 220 s | 172 s |
Build of the test server, and go test | 135 s + 122 s | 68 s + 75 s |
| Unit tests on poisoned memory: style | 131 s | 103 s |
Linux job, run ci_linux.log: test_all takes 117 s. The step "Native libraries" takes 216 s. In that step,
buildjs takes 177 s. The job has no cache for the engine.
1. Fixed delays and waits that are not conditions
The lint src/tools/test_all/lint_sleeps.odin finds time.sleep. It does not find the forms below.
The total cost per run is 15 to 25 s of real time, spread over parallel steps. The gain in wall clock is small.
The gain in reliability is larger: each item below depends on the speed of the machine.
1.1 wait_at_rest costs 500 ms at each call
- Location:
src/e2e/e2e.odin:58(REST_QUIET),src/e2e/e2e.odin:519. - Callers:
devtools_fold.odin:66,menu_wheel.odin:36,pointer_gesture.odin:113,scroll_driven.odin:299, and six calls inframes_at_rest.odin. - Cost: 0.5 s of real time at each call, in each run. The wait ends only when the time has passed.
- Fix: ask the browser for the state. Add a field
at_resttoapi.Stats: no frame is requested, no animation runs, no timer that draws is armed. Wait for that field withwait_until. KeepREST_QUIETonly inframes_at_rest.odin, where the absence of frames in real time is the subject.
1.2 busy_wait is a fixed delay in real time
- Location:
src/e2e/busy.odin:44. Callers:busy_page.odin:278(300 ms),busy_page.odin:344(400 ms),busy_page.odin:408(5 waits of 90 ms),chrome_frames.odin:323(100 ms). - Cost: about 1.3 s per run. The larger cost is the flaky test of 5.2.
- Fix: use
busy_clock(ms)for each of them.scroll_driven.odindoes this for animations. The caret and the autoscroll must read the clock of the chrome frame for that.
1.3 Sections cut short at a set time
- Location:
src/tools/e2e/web_jsweb.odin:325. 37 sections, each abandoned after 0, 10, 100 and 300 ms. - Cost: about 15 s of real waits per run (37 x 0.41 s), in three steps.
- Fix: cut on an event count, not on a time. Close the page after N turns of the loop (0, 1, 10, 100). The result does not depend on the machine then, and the steps take milliseconds.
1.4 A hung GPU process is waited for 10 s
- Location:
src/tools/e2e/webgl_process.odin:19(HANG_MS :: 10_000), used at lines 123, 152, 175, 277. - Cost: 10 s of real time in the test of the hung process. The comment says 1 s and 3 s failed under load.
- Fix: give the watcher an injectable clock. The test advances that clock past the limit after the process hangs.
1.5 A second start waits 3 s for a first one that does not answer
- Location:
src/tools/e2e/instance.odin:136. The test passes only when the product's 3 s timeout expires. - Cost: 2.5 to 9 s per run.
- Fix: make the hand-over timeout a preference of the launch (
browser.instance.answer_ms), set to 100 ms in this test. The test still proves the path. This is not a variable only for tests: it is the product's limit.
1.6 WebSocket closing handshake: 50 repetitions
- Location:
src/tools/e2e/web_wsclose.odin:17(RUNS :: 50), line 165 (3 runs x 300 ms), line 154 (5 runs x 200 ms server delay). - Cost: 39 s on the CI (measured). The file says the repetitions make a race of one in two "certain to show".
- Fix: 10 runs give a detection probability of 99.9 % for a race of one in two. Use
RUNS :: 10. Replaceclosedelay=200with a gate of the test server (?gate=K). Gain: about 30 s of a light slot.
1.7 Real server delays in the web tests
- Locations:
web_jsload.odin:35-43(delays of 5 to 300 ms, one of 3000 ms),web_jsload.odin:53(COMPILE_TAKES_IT_MS :: 500),web_sitecompat.odin:26-27,web_net.odin:61(BURST_SERVER_MS :: 400),web_net.odin:52(500 ms receive timeout, run for each of two backends),download.odin:17. - Cost: 2 to 4 s per run. Each "A arrives before B" proven by two delays fails on a slow runner.
- Fix: use gates. The test opens gate A, waits for the event, then opens gate B. The order is then a fact.
The receive timeout in
web_net.odin:268is a real client timer: it can stay.
1.8 Other real waits
src/tools/e2e/remote_channel.odin:81: 1 s sleep to measure CPU of a Wren with no channel. This is a measure of time. Move it behindbase.perf_skip, as the two other sleeps of the file.src/tools/e2e/remote_channel.odin:96: 300 ms sleep. Replace it with a condition on the channel's state.src/tools/e2e/urlbar.odin:127: a 400 ms busy loop in the page. Hold the page until a condition, aschrome_frames.odindoes withhold().src/tools/e2e/crash_recovery.odin:16-18: snapshot timers of 500 ms and 1000 ms in real time. Lower both preferences to 20 ms, or give the session writer the loop's virtual clock.src/tools/e2e/frames_at_rest.odin:20:REST_TURNS :: 120turns of at least 1 ms. Legitimate: the subject is what the browser does in real time. The step is.No_CI.
1.9 base.await spins on a processor
- Location:
src/base/await.odin:17-24. 15 callers in unit tests. - Cost: the wait calls
thread.yield()in a loop. It uses a full processor during the wait. With 12 jobs, each spinning test slows the other steps. The limit is 60 s. - Fix: wait on a
sync.Futexor a semaphore with a timeout of 1 ms between looks. The condition stays the same. Addbase.await(andthread.yield(loops to the patterns oflint_sleeps.odin.
1.10 The lint does not see every wait
- Location:
src/tools/test_all/lint_sleeps.odin:15(TEST_SLEEP_CALLS). - Missing patterns:
thread.yield((images_test.odin:335,webaudio/worklet_test.odin:38),busy_wait(,wait_at_rest(,rest_turns(,sema_wait_with_timeout(,futex_wait_with_timeout(, and a loop ontick_since(...) <withloop_wait(web_workers.odin:457,web_jsweb.odin:325). - Fix: add these patterns. Each remaining use then has a line and a reason in
tools/test_sleeps_allowed.txt.
Legitimate bounded waits (no change)
e2e.wait_for(src/e2e/process.odin:190): 5 ms poll on what another process does. It ends on the condition.web_harness.wait_until(web_harness.odin:124):loop_waitof 5 ms that any event ends sooner.wait_frames(s, 2): 174 uses. Frames are made at once. No use asks for more than a few frames.- The scheduler's 10 ms tick and the WPT parent's 50 ms tick.
2. Bounds that are too long, and hangs that are not detected
2.1 No circuit breaker: one cause can cost 100 steps x 240 s
- Locations:
src/e2e/e2e.odin:44-46(TEST_LIMIT5 min,DEFAULT_DEADLINE4 min),src/tools/e2e/web_harness.odin:39-40(the same),src/tools/test_all/main.odin:26(900 s per step). - Scenario: the software rasterizer, the test server library or the engine image fails on the runner. Each of the 77 end-to-end steps and 22 web steps then waits 240 to 300 s, two at a time. That is more than 3 hours of work. The job stops at 90 minutes with no report.
- This is the most probable cause of the 90-minute runs. The design test: break
testserver.dlland run the CI. - Fix, in
scheduler.odin: count the steps that end asstuckor with "Test timed out". After 5 of them, stop admitting steps that have the sameneeds. Mark the othersNOT RUN: 5 steps timed out. Write the report. - Fix, in
ci.yml:70: addtimeout-minutes: 45to the step "Tests". Add a flag-RunTimeoutSec 2400totest_all: past it, the scheduler dumps and kills every running step, then writes its report. - Fix, in
ci.yml: uploadbuild/test_logs,build/test_report.txtandbuild/e2e/*/failure.pngwithif: always(). A cancelled job leaves nothing to read today.
2.2 A failed barrier costs 240 s, and a web test continues after it
- Location:
src/tools/e2e/web_harness.odin:124-134.wait_untilrecords a failure and returnsfalse. Most callers ignore the result. A test with three waits costs 720 s, cut at 300 s byTEST_LIMIT. - Then the runner ends the thread. The world of the process (
loop,pages,storage) is left in the middle of a call. Each later test of the process waits on that broken world. The step ends at its 900 s limit. - Measured example:
inline_svg_hoverfailed in 139 s on a capture timeout (ci_win.log,ci_win3.log). - Fix: one deadline of 60 s in both harnesses, and a test limit of 90 s. The CI's slowest passing step takes
186 s for 40 elements: no single barrier is near 60 s. Measure the longest barrier of a CI run first:
WREN_E2E_TRACE=1prints each call with its time. - Fix: make the first timeout of a web test final.
wait_untilsets a package flagbroken, assrc/e2e/e2e.odin:135does.beginfails at once when the flag is set. The step then ends in seconds. - Fix:
process.odin:63(PROCESS_WAIT_MS= 4 min) is used in cleanups (process.odin:79,process.odin:143). A cleanup must not wait 4 minutes for a process that it has killed. Use 10 s there.
2.3 Tasks cannot be killed: a hung build has no bound
- Location:
src/tools/test_all/scheduler.odin:468-481. For a stuck task, the scheduler setstask.kill. Onlytask_exec(scheduler.odin:443) reads that flag. - These tasks do not use
task_exec:task_browser,task_dependencies,task_js_engine,task_launcher,task_testserver,task_runner(tasks.odin:13-76). They calltooling.runwith no limit (src/tools/wrentool/builder/builder.odin:209). - Result: a compiler that does not end keeps the run alive for ever.
ci.yml:41-42describes this exact event for the dev build and gives that step 20 minutes. The check build insidetest_all(steps.odin:248) has the same compiler and no bound. - Fix: one way to start a process from a task.
tooling.runtakes a^boolkill flag and a limit.builder.Optionscarries both. The scheduler's limit then ends every child. Remove the second path. - Fix: after a task is told to stop, give it 60 s. Then mark the step
stuck, finish it, and let the thread go. The run must end even if a thread does not.
2.4 Step limits of 4 hours on the CI
- Location:
src/tools/test_all/steps.odin:106(LONG_STEP_SECONDS :: 4 * 3600). Used at lines 241, 247, 248, 375, 377, 397, 449, 483, 498, 503 and inasan.odin:154. - The CI jobs have limits of 45 to 90 minutes. A limit of 4 hours is no limit there.
- Fix: a limit per step from its measured time. Under
-Quickor-CI: 10 minutes for a build, 15 minutes for WPT, test262 and the endurance run. Keep 4 hours only for full runs.Step.limitbecomes a procedure ofcfg.
2.5 The first WPT child is waited for without a bound
- Location:
src/tools/wpt/queue.odin:257.os.process_waithas no timeout. This child compiles the engine image and writes the disk cache. - Second case:
queue.odin:269. A child is declared hung only whenlen(c.handed) > 0. A child in theDrainingphase that has reported every test and does not exit keepsbusytrue for ever. - Fix: poll the first child with the same hang limit as the others. Remove the condition on
handed: a child with nothing in hand and no exit afterhang_msis killed. Its exit is not aCRASHof a test.
2.6 test262 waits for its threads without a bound
- Location:
src/tools/test262/main.odin:763-770. The loop waits for every worker thread. A test is stopped by the engine's interrupt flag, which is cooperative. A native call that does not return is never stopped. - Fix: each worker publishes the start time of its current test. The main loop fails the run when one test has
run for more than 10 times
-timeout. It prints the test's name and exits with a code other than 0.
2.7 A unit test has no time limit
- Fact: no
*_test.odinfile undersrccallstesting.set_fail_timeout(0 of 296 files).core:testinggives a test no limit by default. - Result: a unit test that hangs costs the step limit, 900 s, and the log does not name the test.
- Fix: build every unit step with
-define:ODIN_TEST_LOG_STATE_CHANGES=true(as the ASan steps do), so that the log names the test that was running. Set the step limit of a unit step to 10 times its last duration, with a floor of 120 s.build/test_all_times.txthas the durations.
2.8 A second failure in one e2e process waits for ever
- Location:
src/e2e/e2e.odin:307-311anddocs/testing.md("the next signal waits for ever").stop_testavoids the defect ofcore:testingon Windows. An assertion or a fault in a test does not. - Result: after two faults in one process, the process hangs until the step limit (900 s).
- Fix: do not depend on the runner here. In
e2e, install the assertion handler of the session (s.ctx.assertion_failure_proc) to log the message and callstop_test. For a fault, the crash handler ofwb:crashtraceends the process at once: with one process per file, the rest of the file isNOT RUNand is said so. This is a bounded and visible result.
2.9 Smaller unbounded waits
src/tools/test_all/tasks.odin:252:tooling.wait(&p)onbuild/fetchwith no limit, in a task that cannot be killed. Fix:tooling.wait(&p, 120 * time.Second).src/tools/tooling/process.odin:106:capturehas no limit. It runsgit,node,vswhere, and inasan.odin:69a whole compile of the browser while it holds a mutex that three steps wait on. Fix: a limit parameter with a default of 60 s; 20 minutes for the call ofasan.odin:69.src/tools/test_all/scheduler.odin:533-537: afterkill_tree, the scheduler waits forpollwith no bound. Fix: after 30 s, release the process and finish the step.src/tools/wpt/queue.odin:249and:272:process_waitafter a kill, with no timeout. Fix: 30 s.
3. Parallelism
3.1 Split the Windows job in three
- Location:
.github/workflows/ci.yml:17-76. - Fact: the job is bound by CPU, not by waits.
-Jobs 3and-Jobs 4were measured slower (ci.yml:52-56). More runners are the only way to more parallelism. Three groups with no dependency between them (measured CPU of
ci_win3.log):- A, the check build:
wrentool build check, the sweep, the scripted session, the endurance run,remote_check. About 1800 s of CPU, 27 % of the run. - B, the browser shell: the 77
e2e_stepsteps. About 2700 s of CPU. - C, everything else: unit tests, web tests, WPT, toolkit suites, lints, the package. About 2300 s of CPU.
- A, the check build:
- Each job pays the setup (150 s), and B also pays
wrentool build(64 s) and the build ofe2e_test(81 s). - Result (estimate): the longest job takes 14 to 16 minutes, against 34 minutes.
- Fix: use
-Onlyand-Exceptwith three patterns, as theasanandtest262jobs do. GiveStepa fieldgroupso that the patterns do not depend on step names.test_all -Listmust print the group. - Option: one build job uploads
build/wren.exe,build/e2e_test.exe,build/testserver.*andbuild/nativeas an artifact. The three jobs download it. This removes 150 to 300 s of CPU per job.
3.2 The build of e2e_test waits for the browser build
- Location:
src/tools/test_all/steps.odin:422(needs = COMMON_NEEDS + {.Browser}), and line 483 for WPT. - The comment says the program links
build/native, "which the browser's build makes". The step of line 241 makes.Native, andCOMMON_NEEDScontains.Native. - Cost: locally, after a change of a browser source,
e2e_teststarts only whenwren.exeis linked. That is 18 to 107 s of critical path (the times of thedevbuild inAGENTS.md). No cost on the CI: the browser is built before. - Fix: verify that
builder.dependenciesleavesbuild/nativein its final state. Then remove.Browserfrom the twoneeds. If the browser build changesbuild/nativeafter that, move that work tobuilder.dependencies: two steps must not write one product.
3.3 The network test runs its two backends one after the other
- Location:
src/tools/test_all/steps.odin:463-464. Twoweb_run("net", ...)actions in one step. - Cost: about 25 s in one light slot. The two runs share nothing: each has its own process and port block.
- Fix: two steps, one per backend. Gain: about 12 s when a light slot is free.
3.4 ODIN_TEST_THREADS=1
E2E_BUILD_FLAGS(steps.odin:102-104): needed. The browser's state is the process's. The split by file, andeach_testfor five files, give the parallelism. No change.steps.odin:254(images): one test sets the idle time of the process-wide decoder pool. Fix: the pool takes its settings at creation, and the test makes its own pool. The step takes 3 s: low gain, but it removes a shared global.steps.odin:271-274(remote, remote api, remote client),steps.odin:363(wasm),steps.odin:414-419(toolkit suites): each step takes 1 to 8 s. No gain worth a change.
3.5 Shared resources
- Ports: solved. A block of ports per process, from the worktree's path (
docs/testing.md, "The test server"). - Profiles: solved.
e2e.temp_profile, andbuild/web_profile/<pid>(web_harness.odin:38). build/wrentool_step.exe: three steps build the same file (steps.odin:236,:452,:492). In a full local run, the steps of lines 236 and 452 run at the same time and write the same file. See 4.5.build/tmp/license_tool_test.wrenlicense(tasks.odin:134): a fixed name. Two runs in one worktree collide. Fix: add the pid to the name, astasks.odin:210does.- The GPU: on the CI every frame is drawn by the software rasterizer. See 4.1.
3.6 Order of a run
- The scheduler starts the longest path first (
scheduler.odin:279-287). This is correct. - On the CI, the test server took 136 s to build, and the 99 steps that need it waited (measured). The two heavy slots stayed busy with unit tests, so no slot was idle. See 4.4 for the fix.
- The first run on a runner has no durations (
build/test_all_times.txtis not cached). Each step is then taken for itsweightor 60 s. Fix: commit a file of typical CI durations, or cache the file between runs.
4. Redundant or wasteful work
4.1 The software rasterizer draws frames that no test reads
- Fact: on a runner a frame takes 15 to 22 ms to draw, against 0.1 ms on a GPU (
docs/testing.md). - Example:
src/tools/e2e/cursor.odin:33-45. For each of 40 elements the test asks for frames, then readsstats.cursor. It reads no pixel. It takes 185 s and 265 s of CPU on the CI (measured), at a scale of 2. - The chrome world already has this idea: "no renderer unless the test asks for pixels"
(
chrome_world.odin:108), 7 to 40 ms a test. - Fix:
e2e.Options.pixels. Without it, the session builds the display list and skips the rasterization.e2e.capturefails with a clear message in such a session. Start withcursor,config,page_scrollbars(if it reads geometry),keyboard_owner,search,urlbar,history. - Gain (estimate): 600 to 900 s of CPU on the CI, 3 to 4 minutes of the unsplit job.
4.2 The sweep of the check build runs on both systems, and costs the most
- Locations:
steps.odin:451-452(Windows: 376 s, 964 s of CPU, measured),ci.yml:259-263(Linux: a full./build.sh check, then the sweep underxvfband a software Vulkan driver). - Every end-to-end test already runs with freed memory poisoned (
steps.odin:422,POISON). - Fix: run the sweep in one place per system, in a job of its own (group A of 3.1 on Windows, a second Linux job). The main jobs then do not wait for it.
- Fix: the sweep passes
-CloseMs 60000 -PingMs 60000. Check that no page waits for one of these limits in a passing run: 14 pages in 376 s is 27 s per page.
4.3 The Linux job builds the JavaScript engine in every run
- Location:
ci.yml:239-248.buildjstook 177 s (measured,ci_linux.log00:02:36 to 00:05:33). - The Windows setup caches
build/js(.github/actions/setup/action.yml, "Cache the JavaScript engine"). - Fix: the same
actions/cachestep in the Linux job, with the same key and alinux-prefix. Cachebuild/wasmtime-linux,build/lexbor-linuxand the wgpu archive too. Gain: about 3 minutes. - Fix: the
apt-getand LLVM steps run in every job. Build a container image with them once (ghcr.io/.../wren-ci:bookworm-llvm18) and use it incontainer:. Gain: 1 to 2 minutes (estimate).
4.4 The test server is compiled three times with no Go cache
- Location:
.github/actions/setup/action.yml:48-51(cache: false),steps.odin:442-443. - Cost: "build testserver" 135 s and
go test122 s (measured). The DLL, the program and the test binary compile the same packages (quic-go, HTTP/2) from nothing. - Fix: cache
build/testserver.exeandbuild/testserver.dllwith a key fromtools/testserver/**. A hit makes the step a no-op, as for Lexbor. Also setcache: truewithcache-dependency-path: tools/testserver/go.sumfor the build cache. - Gain: 140 s of CPU, and the end-to-end steps can start 2 minutes sooner.
4.5 wrentool is built up to five times
- Locations:
ci.yml:35,ci.yml:106,ci.yml:143, andsteps.odin:236,:452,:492(build/wrentool_step.exe). - Fix: one step that makes a product
.Wrentool(build/wrentool_step.exe). The three steps need it. This also removes the two writers of 3.5. Inci.yml:106, remove the second build: the file of line 35 is still there. - The same for
src/tools/license:steps.odin:433and:435build it twice under two names. One product.
4.6 Packages compiled and tested two to four times
base,style,layout: a normal step (steps.odin:250-256), a poisoned step (:257-259) and an ASan step (asan.odin:20).page: normal, poisoned with pages (:281-284) and ASan.- Measured on the CI: style 31 s and 131 s; layout 50 s and 54 s.
- The two variants run the same tests. The poisoned build detects more. The normal build is what ships.
- Fix (option): on the CI, run only the poisoned variant of these three packages. Keep both in a full run. Gain: about 80 s of step time. Decide this with care: the allocators differ between the two builds.
4.7 odin check of each package on Linux
- Location:
src/tools/test_all/steps_linux.odin:18-19and:39-43. 46 checks. odin check src/tools/e2etype-checks every package that it imports. Most of the 46 checks repeat that work.- Cost: small (0 to 2 s each, about 30 s of CPU). Fix: keep the leaf programs (
tools/e2e,tools/wpt,tools/endurance,tools/test_all,crashtrace) and the packages that no program imports. Verify first that-vetapplies to imported packages of thewbcollection.
4.8 Tests that are benchmarks
- The four
bench_*_test.odinfiles (src/browser,src/layout) are opt-in by a define or a variable. Good. - The measures in the end-to-end files are behind
base.perf_skip(12 places). Good. src/tools/test_all/steps.odin:378-397: the JIT step runs 15jsenginecommands onexamples/jsbenchfiles, then the whole of test262 with the JIT. It is in its own CI job. No change.src/tools/e2e/busy_page.odin: 428 s of CPU on the CI (measured), because pages hold a thread in a busy loop for a real duration. Withbusy_clock(1.2) the holds can be short. Gain (estimate): 200 s of CPU.
5. Tests that depend on something they must not depend on
5.1 State built by hand in three ways
app_start(src/browser/main.odin:1687) is the product's constructor.test_app(src/browser/app_test.odin:10) is a second one. 279 uses.chrome_start(src/tools/e2e/chrome_world.odin:77-125) is a third. It repeats the list of*_initcalls of the product and builds eachTabby hand (:115-120), with the comment "as tab_new does".- 18 unit tests call
new(App)directly, and others callnew(Tab)ornew(Browser_Window):about_wren_test.odin:278,bench_palette_test.odin:26,chrome_style_test.odin:251,demos_test.odin:47,desktop_shell_test.odin:39and:66,devtools_test.odin:30and:128,download_test.odin:13,history_tree_test.odin:176,local_paths_test_windows.odin:43,pacing_test.odin:129,palette_test.odin:98,selection_shell_test.odin:8,urlbar_test.odin:219and:321,wheel_step_test_windows.odin:9,windows_test.odin:86(withtab_idsfilled by hand at:168). - This is the cause of the two harnesses that broke on
tab_ids. - Fix: one constructor in stages, in
src/browser.app_make(Options)makes an App that satisfies every invariant with no window.app_chrome_init(app, window)adds what the interface reads.app_startcalls both, then the rest.test_appandchrome_startcall the same stages. - Fix: one procedure adds a tab to a window:
tab_adopt(app, window, tab). It writestab_ids.tab_newand the tests call it. A test that needs a tab with no page callstab_new_bare(app, title). - Fix: a lint in
test_all, besidelint_address.odin: nonew(App),new(browser.App),new(Tab),new(Browser_Window)orApp{outside the files of the constructors. - The design test: add an invariant to
tab_newand run the unit tests. With one constructor, no test fails.
5.2 Marks that hide a defect
Each mark below says "cause not found" or "to be understood". Each hides a possible product defect.
| Location | Mark | Reason given | Judgment |
|---|---|---|---|
steps.odin:331 | flaky on the_caret_blinks_while_the_page_is_busy | "failed once on the CI... nothing found" | The test samples a 200 ms blink with real waits of 90 ms (busy_page.odin:58-60, :408). The result depends on the frame times. Use the test's clock (1.2), then remove the mark. |
steps.odin:301 | .No_CI on frames_at_rest | "the caret drew 5 frames for 3 flips once: cause not found" | A possible defect of the product: an extra frame. The test counts frames in real time. Count frames per caret flip on a virtual clock, then run it on the CI. |
steps.odin:355 | .No_CI on setup | "the running copy was not out of the way once: cause not found" | A possible race in the uninstall of a running copy. Users can meet it. Keep the mark, open an issue, log the file operations in the test. |
steps.odin:357 | .No_CI on crash reports | "overflow_thread left no report once: cause not found" | A crash report that is lost is a product defect. Run the step on the CI as .Flaky with its log uploaded: a skipped step gives no data. |
steps.odin:306 | .No_CI on dnd | "without a GPU... the read-back stays pending. To be understood." | A read-back that never completes on a software adapter is a product defect for users with no GPU. |
steps_linux.odin:17 | idb unit tests not run | "two of them fail on the GitHub runner and pass in WSL; not understood yet" | The two tests are about a failed request and a failed write. Probably a file-system difference. The whole package is skipped for two tests: run the others with ODIN_TEST_NAMES. |
ci.yml:55-56 | three checks removed from the CI | failed under load | Correct for the two that measure time. Verify that each is behind -Perf and still runs somewhere. |
steps.odin:285, :337 | .No_CI on devtools_resize, real_window | the runner's screen and scale | Legitimate: a real window depends on the machine. |
steps.odin:297, :315 | .No_CI on video_layers, devtools_split | 160 s and 420 s of CPU on the software rasterizer | Legitimate cost. Both read pixels. |
wpt/expectations | 79 lines with A|B | flaky expectations | Acceptable in number. List them in the report, so that the number does not grow unseen. |
Rule to add to docs/testing.md: a .Flaky or .No_CI mark with no known cause has an issue number and
still runs somewhere with its logs kept. A mark of type .Flaky is preferable to a skip: it gives data.
5.3 Assertions on real time in default tests
examples/jsdom/animations.html:22:document.timeline.currentTimewithin 50 ms ofperformance.now(). It failed on the CI with 144 ms against 220 ms (ci_win2.log, step "DOM for JavaScript"). The two clocks are read at different moments of a frame. Fix: assert the relation that the specification gives (currentTime <= performance.now(), and equal to the frame's time), or run the page on the virtual clock.src/tools/e2e/web_net.odin:365and:370: a request "left the queue" before or afterBURST_SERVER_MS / 2(200 ms). On a loaded runner an HTTP/2 request can take more than 200 ms to start. Fix: assert the order of events with a gate: the server holds the first answers, and the test counts the requests that have arrived.src/tools/e2e/busy_page.odin:37and:56: "moved at least 8 px in 300 ms", "clock within 150 ms". Fix:busy_clock.src/tools/e2e/webgl_process.odin:264: an answer within 60 s. This is a bound that only fails a hang. Good.src/webaudio/worklet_test.odin:178and:226: under 30 s and 15 s. These are bounds, not measures. Good.
5.4 Global state shared between tests
- The web tests share one world per process (
web_harness.odin:57-71). The last test,zz_the_process_ends_with_nothing_left, depends on the alphabetical order ofcore:testing(runner.odin:375). A test that leaves a page open makes that last test fail, not itself. - Fix: check the leak at the end of each test, in
end(): the count of live pages and of tracked bytes returns to its value atbegin. The failure then names the test. Keep the last test for the world itself. web_harness.odin:186:virtual_clockuses a@(static)clock. Correct with one thread. It is one more reason why these tests cannot run in parallel in one process.src/browser/main.odin:330and:355: the tab ids come from a process-wide counter, by design. Unit tests ofbrowserrun on several threads, so a test must not assert an id value.chrome_world.odin:116writes ids 1, 2, 3 by hand, which can collide with ids fromtab_new. Fix:tab_new_bareof 5.1 takes the id from the counter.steps.odin:254: the decoder pool ofimages(see 3.4).
5.5 Dependence on map order and on addresses
- Odin seeds the hash of a map from the address of its data. The order of iteration changes with the allocator, the build and the run. The recent layout failure came from this.
- No test file was found that asserts on the order of a map directly. The risk is in product code whose output is ordered by a map iteration.
- Fix: a lint for
for ... in <map>insrc/layout,src/style,src/dom,src/page, with an allow-list for loops whose result does not depend on order (a sum, a lookup, a free).core:odin/parseris already intest_all(lint_test_inits.odin), and gives the type of the iterated expression's declaration in most cases. - Fix: the poisoned unit steps already change every address between passes. Keep
layoutandstylethere: they are the tests that find this class of defect.
5.6 Dependence on the machine
- Fonts: the web tests use fixed fake metrics (
web_harness.odin:177-181). Good. The chrome world loads embedded fonts (chrome_world.odin:96-99). Good. The end-to-end sessions use the system's fonts through the browser:text_decoration.odinreads pixels of text. Verify that it sets an embedded font for every text that it measures. - GPU:
e2e.start(t, {software = true})exists. Tests that compare pixels to a level must use it on every machine, so that a developer's GPU and the runner's rasterizer give one result. - Theme: forced to dark in
e2e.odin:213. Good. - Locale: no test was found that sets or reads the system's locale.
src/i18nhas no test file: it is only type-checked on Linux (steps_linux.odin:18). - Network:
tasks.odin:237fetcheshttps://example.com/in the network stress of a full run. Every step inheritsWREN_NETWORK_LOOPBACK_ONLY=1. Either the case fails, orfetch.exeignores the variable. Verify, then remove the case or serve it from the test server.
5.7 Tests that assert little
src/browser/bench_text_test.odin:67:testing.expect(t, best > 0). It is opt-in, so it costs nothing.src/browser/remote_test.odin:153:process_uptime_ms() > 0. It proves only that the call returns.- The web tests have a strong rule here:
close_pagefails a section that ran fewer checks than it declares (web_harness.odin:273). Extend the idea to the end-to-end tests:test_allcounts tests, not checks (docs/testing.md). A scenario with notesting.expect*passes. Fix:e2e.end_of_testfails a test that made no check, with a counter that theexpectwrappers ofe2eincrease.
Order of work
ci.yml: step timeout, upload of logs, Go and engine caches (2.1, 4.3, 4.4). Half a day. No risk.- Scheduler: tasks that can be killed, limits per step, circuit breaker, run budget (2.1, 2.3, 2.4).
- Split of the Windows job (3.1).
- Deadlines of 60 s and the
brokenflag in the web harness (2.2), after a measure of the longest barrier. - One constructor for
Appand its lint (5.1). - Sessions with no pixels (4.1).
- WPT and test262 bounds (2.5, 2.6).
- The marks of 5.2, one issue each.
- The real waits of section 1, with the lint patterns of 1.10 first so that the list is complete.