mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-05 18:09:29 +08:00
* test: expect the JIT host's fused multiply-add, tail call and chaining caps, and export jitTail() beside jitSimd() and jitFma() The JIT rework added caps bits 6 (fused relaxed multiply-adds), 7 (cheap tail calls), 8 (module format v2, KW_JIT_V2=1) and 9 (chaining, unless KW_JIT_CHAIN=0), but the JitHost test still expected bits 0-5 only, so it failed on every run (755, not 51, on Node 24 on x86-64). The test now derives the expected caps from the same probes and variables. * test: expect shm views in place in worker mode with an SMP kernel With UNKERNEL_TEST_CPUS=2 the worker shares the kernel's memory with this thread (shm.ts, In place), so views() works there instead of failing with EOPNOTSUPP; the shm test failed on every 2-CPU run. It now checks the views on the shared memory there, and the EOPNOTSUPP on the UP kernel. * test: find the forced H.264 key frame by the source's request, not by a chunk window The camera H.264 test wanted the key frame kwcap forces after the 16th chunk among chunks 16 to 22. The source makes it next, but the chunks it made before reach the guest first: the host's queue and the guest's filled buffers, as many as the guest lags behind the source's clock. With the full suite at once the inline kernel's timer ran late, the pattern source caught up several frames at a time, and the forced key frame came later (or on the GOP's own key frame at 24). The test now records the chunk the source makes after each key frame request, checks that the guest gets that chunk as a key frame, with only the GOP's key frames before it and the GOP counting from it, and streams 60 chunks, enough for the queue's 32 and the guest's buffers. * test: judge shm reads through the ring by the reads during which this thread was free The ring's answer comes as a message to this thread, which also runs the suite's inline kernels. The check skipped itself when this thread's timer delay was high, but it measured that delay only after the 25 reads, so a busy spell during the reads failed it (median 32.5 ms with a delay of 1.4 ms measured afterwards). Each read now records this thread's longest timer delay while it runs, and the median is asserted over the reads that saw no delay of 3 ms or more (when there are at least 3 of them). * test: run worker-mode capture from a read() source after the concurrent suite In worker mode the sound in and camera tests' read() sources answer on this thread, and the worker records silence or a black frame wherever the answer comes late. With the whole suite at once this thread runs every inline kernel, and the source fell 200 ms or more behind at the start of a stream: kwrec got 2357 and 2854 of its 3000 samples (worker; worker with messages), the camera 3 of 8 pictures (worker with messages). Those four tests now run in a suite of their own after the concurrent one, alongside each other only, with their assertions unchanged; the inline ones and the onRing ones (a producer on a thread of its own) stay in the concurrent suite. * test: read a guest's background counter again when its file is empty The snapshot and session tests' guests count in the background with echo $i > FILE, which truncates the file before it writes, so a cat in between reads nothing, 0, and fails a "counts on" check (or weakens the next one). The host now reads the counter again while its file is empty, at most 50 times. A rename per write in the guest would also do, but at a fork per write it loads the guest (and, inline, this thread) twice as much. * test: let a restored recording end before boot() returns in the snapshot capture test A restore hides the stopped time from the guest's clock, so the restored guest has what was left of its 3 s recording. Where the snapshot landed late in it (a busy host), kwrec's own stop and close came before boot() returned, and the test, which wanted nothing after the replayed open, prepare and start, failed. It now asserts the replay first, then nothing or the guest's stop and close, with capturing to match. * test: derive the SMP kernel once for UNKERNEL_TEST_CPUS runs instead of at every boot Given the bundle and more than one CPU, createKernel() derives the SMP kernel from it on the calling thread at every boot (about 0.2 s of patching), and in a 2-CPU run every boot() did that. The suite's boots at once held this thread, which runs the inline kernels and the device sources, for over 3 s: glimmer's 3 s of sound took 6.3 to 6.8 s, the PCM ring from the worker CPU (2.97 s of that stream) overflowed and dropped 346 to 890 frames glimmer had written without an underrun, and the H.264 source made too few chunks during the guest's stall to overflow the queue. With UNKERNEL_TEST_CPUS > 1, boot() now boots the SMP kernel that compileTestKernel() derives once wherever it runs on more than one CPU; sharedKernel() still boots the bundle. --------- Co-authored-by: Pooya Parsa <pooya@pi0.io>