diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e42237c7a..e854d27d9 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -50,6 +50,7 @@ llama_build_and_test_executable(test-grad0.cpp) llama_build_and_test_executable(test-backend-ops.cpp) llama_build_and_test_executable(test-rope.cpp) +llama_build_and_test_executable(test-model-load-cancel.cpp) # dummy executable - not installed get_filename_component(TEST_TARGET test-c.c NAME_WE) diff --git a/tests/test-model-load-cancel.cpp b/tests/test-model-load-cancel.cpp new file mode 100644 index 000000000..8da21af81 --- /dev/null +++ b/tests/test-model-load-cancel.cpp @@ -0,0 +1,17 @@ +#include "llama.h" + +#include +#include + +int main(void) { + llama_backend_init(false); + auto params = llama_model_params{}; + params.use_mmap = false; + params.progress_callback = [](float progress, void * ctx){ + std::ignore = ctx; + return progress > 0.50; + }; + auto * model = llama_load_model_from_file("../models/7B/ggml-model-f16.gguf", params); + llama_backend_free(); + return model == nullptr ? EXIT_SUCCESS : EXIT_FAILURE; +}