quakeforge/libs/util/test
Bill Currie 0ebb0717b0 [zone] Add failing test cases
The tests fail as they exercise how the cache *SHOULD* work rather than
how it does now.

The tests do currently pass for the pending work I've done on the cache
system, but while working on it, I remembered why I reworked cache
allocation...

The essential problem is that sounds are loaded into the cache, which is
fine for synchronous output targets, but has proven to be a minefield
for asynchronous output targets (JACK, ALSA).

The reason for the minefield is the hunk takes priority over the cache,
and is free to move cache blocks around, and *even dispose of them
entirely* in order to satisfy memory allocations from either end of the
hunk. Doing this in an entirely single-threaded process (as DOS Quake
was) is perfectly safe, as the users of the cache just reload the
pointer each time, and bail if it's null (meaning the block has been
freed), or even cause the data to be reloaded if possible (I'm a little
fuzzy on the details for that as I didn't write that code). However, in
multi-threaded code, especially real-time (JACK, possibly ALSA), it's a
recipe for disaster. The 4cab5b90e6 commit was a (mostly) successful
attempt to mitigate the problem by allocating the cache blocks from the
high-hunk (thus minimizing any movement caused by low-hunk allocations),
it resulted in cache allocates and regular high-hunk allocations somehow
getting intertwined: while investigating just how much memory ad_tears
needs (somewhere between 192MB and 256MB), I got "trashed sentinel"
errors and upon investigation, I found what looks very suspiciously like
audio data written across a hunk control block.

I've decided that the cache allocation *algorithm* should be reverted to
how it was originally designed by Id (details will remain "modern"), but
while working on the tests, I remembered why I had done the changes in
the first place (above story). Thus the work on reverting the cache
allocation can't go in until I get sound memory management independent
of the cache. The tests are going in now so I have a constant reminder :)
2022-06-03 12:52:59 +09:00
..
Makemodule.am [zone] Add failing test cases 2022-06-03 12:52:59 +09:00
test-bary.c [util] Get tests working with sse2 2021-06-01 18:53:53 +09:00
test-baryvf.c [util] Get tests working with sse2 2021-06-01 18:53:53 +09:00
test-bitop.c [math] Add some bit-op functions 2022-01-23 13:47:14 +09:00
test-bsearch.c [util] Add fuzzy and reentrant bsearch 2021-06-01 18:53:53 +09:00
test-cexpr.c [cexpr] Require designated initializers for exprtype_t 2022-04-24 17:31:17 +09:00
test-cmem.c [util] Implement Sys_Free for windows 2021-07-12 18:55:16 +09:00
test-cs.c [util] Loosen affine test epsilon for SEB 2021-07-29 15:03:54 +09:00
test-csvf.c [simd] Set the homogeneous coord in the csvf test 2021-12-26 12:25:06 +09:00
test-darray.c
test-dq.c
test-half.c [util] Implement Sys_Free for windows 2021-07-12 18:55:16 +09:00
test-heapsort.c [util] Add functions for binary heaps 2021-08-02 12:44:08 +09:00
test-listener.c [util] Add a listener object 2021-11-25 13:36:02 +09:00
test-mat3.c [math] Clean up vector component operations 2022-01-02 01:15:17 +09:00
test-mat4.c [math] Clean up vector component operations 2022-01-02 01:15:17 +09:00
test-plist.c
test-pqueue.c [util] Fix an out-by-one in pqueue tests 2021-08-02 23:08:14 +09:00
test-qfs.c
test-quat.c [util] Get tests working with sse2 2021-06-01 18:53:53 +09:00
test-seb.c [util] Make a number of improvements to SEB 2021-07-30 14:57:47 +09:00
test-sebvf.c [util] Loosen up the epsilon on simd seb tests 2021-08-02 23:15:20 +09:00
test-seg.c
test-set.c [util] Minimize set growth 2021-08-11 12:31:03 +09:00
test-simd.c [simd] Remove requirements for AVX2 for vec4d 2022-01-06 18:06:56 +09:00
test-utf8.c [util] Write some tests for utf8 r/w 2021-07-27 23:29:14 +09:00
test-zone.c [zone] Add failing test cases 2022-06-03 12:52:59 +09:00