Files
LocalAI/backend/go/stablediffusion-ggml/tests
64912200a7 chore: ⬆️ Update leejet/stable-diffusion.cpp to a85db96aa5ce2c72bd5aec326f6c5c857839a50a (#12845)
* ⬆️ Update leejet/stable-diffusion.cpp

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(sd): adopt owning generation results

The sd.cpp bump replaces raw image and video outputs with owning results.
Adapt image generation, video generation and upscaling to the new API.
Use upstream destructors to release all pixels, audio and metadata.

Add model-free native checks for result ownership and failure paths.

Assisted-by: nib:gpt-6.1-sol
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>

---------

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: mudler <2420543+mudler@users.noreply.github.com>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-10-25 21:23:13 +01:00
..

Native result API regression checks

Run from the backend directory after fetching the pinned upstream sources:

sh tests/result_api.sh

Alternatively, pass an existing stable-diffusion.cpp checkout:

sh tests/result_api.sh /path/to/stable-diffusion.cpp

The test compiles the binding against the upstream header and stubs inference; no models or native libraries are required. It checks image batch cleanup, empty/failed generation, missing pixels, PNG write failures, video result cleanup (including audio and metadata), and upscaler validation and exception cleanup. It does not run successful video encoding or inference. The linker discards unused binding functions so only the exercised native API calls need stubs.

To check memory ownership with AddressSanitizer and UndefinedBehaviorSanitizer:

CXXFLAGS='-fsanitize=address,undefined -fno-omit-frame-pointer -g' \
LDFLAGS='-fsanitize=address,undefined' sh tests/result_api.sh

Set TMPDIR to choose where the runner creates its temporary files. CXX selects the compiler. Do not pass -DNDEBUG: the checks use assertions.