From 79f2d921129284a850f654c6ff80ba6cfdeda16f Mon Sep 17 00:00:00 2001 From: Abir Deol <160072369+apollo-2006@users.noreply.github.com> Date: Mon, 7 Sep 2026 22:14:42 -0700 Subject: [PATCH] tests : load backends before init when built with GGML_BACKEND_DL (#4031) With GGML_BACKEND_DL=ON no backend is registered until something calls ggml_backend_load_all(). Every example does; the tests never did, so whisper_init_* and parakeet_init_* ran with devices = 0 and aborted on GGML_ASSERT(device) in ggml_backend_dev_backend_reg. Three tests aborted on such a build - test-whisper-zero-samples, test-vad and test-parakeet - taking ctest -L gh to 2 of 4. test-vad-full has the same fault and reaches it only once a real base.en model is present. No workflow caught this because none pairs the two: build-clang, build-gcc and build-sanitize run ctest -L gh but never set GGML_BACKEND_DL, while release.yml sets it and runs no tests. ggml_backend_load_all() is already reachable through whisper.h and parakeet.h via ggml-cpu.h, so no new include is needed. Resolves: https://github.com/ggml-org/whisper.cpp/issues/4030 --- tests/test-parakeet.cpp | 2 ++ tests/test-vad-full.cpp | 2 ++ tests/test-vad.cpp | 2 ++ tests/test-whisper-zero-samples.cpp | 2 ++ 4 files changed, 8 insertions(+) diff --git a/tests/test-parakeet.cpp b/tests/test-parakeet.cpp index 58b64835d..26203db7a 100644 --- a/tests/test-parakeet.cpp +++ b/tests/test-parakeet.cpp @@ -111,6 +111,8 @@ static int test_valid_model() { } int main(){ + ggml_backend_load_all(); + if(test_valid_model() != 0){ return 1; } diff --git a/tests/test-vad-full.cpp b/tests/test-vad-full.cpp index 765ef3654..f033e0580 100644 --- a/tests/test-vad-full.cpp +++ b/tests/test-vad-full.cpp @@ -13,6 +13,8 @@ #include int main() { + ggml_backend_load_all(); + std::string whisper_model_path = WHISPER_MODEL_PATH; std::string vad_model_path = VAD_MODEL_PATH; std::string sample_path = SAMPLE_PATH; diff --git a/tests/test-vad.cpp b/tests/test-vad.cpp index 0003ae3ac..a1f732d74 100644 --- a/tests/test-vad.cpp +++ b/tests/test-vad.cpp @@ -48,6 +48,8 @@ struct whisper_vad_segments * test_detect_timestamps( } int main() { + ggml_backend_load_all(); + std::string vad_model_path = VAD_MODEL_PATH; std::string sample_path = SAMPLE_PATH; diff --git a/tests/test-whisper-zero-samples.cpp b/tests/test-whisper-zero-samples.cpp index 5357e62fa..908ad843b 100644 --- a/tests/test-whisper-zero-samples.cpp +++ b/tests/test-whisper-zero-samples.cpp @@ -8,6 +8,8 @@ #include int main() { + ggml_backend_load_all(); + struct whisper_context_params cparams = whisper_context_default_params(); cparams.use_gpu = false;