diff --git a/common/common.cpp b/common/common.cpp index 9d5d2834ac..1a0aeef4ec 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -1476,6 +1476,20 @@ std::string common_get_model_endpoint() { return model_endpoint; } +char * common_get_model_or_exit(int argc, char * argv[]) { + if (argc > 1) { + return argv[1]; + } + + char * path = getenv("LLAMACPP_TEST_MODELFILE"); + if (!path || strlen(path) == 0) { + fprintf(stderr, "\033[33mWARNING: No model file provided. Skipping this test. Set LLAMACPP_TEST_MODELFILE= to silence this warning and run this test.\n\033[0m"); + exit(EXIT_SUCCESS); + } + + return path; +} + common_context_seq_rm_type common_context_can_seq_rm(llama_context * ctx) { auto * mem = llama_get_memory(ctx); if (mem == nullptr) { diff --git a/common/common.h b/common/common.h index 14889193d9..919c0ea103 100644 --- a/common/common.h +++ b/common/common.h @@ -930,6 +930,9 @@ void common_set_adapter_lora(struct llama_context * ctx, std::vector -#include -#include - -#include "get-model.h" - -char * get_model_or_exit(int argc, char *argv[]) { - char * model_path; - if (argc > 1) { - model_path = argv[1]; - - } else { - model_path = getenv("LLAMACPP_TEST_MODELFILE"); - if (!model_path || strlen(model_path) == 0) { - fprintf(stderr, "\033[33mWARNING: No model file provided. Skipping this test. Set LLAMACPP_TEST_MODELFILE= to silence this warning and run this test.\n\033[0m"); - exit(EXIT_SUCCESS); - } - } - - return model_path; -} diff --git a/tests/get-model.h b/tests/get-model.h deleted file mode 100644 index 81a3a0fefd..0000000000 --- a/tests/get-model.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma once -char * get_model_or_exit(int, char*[]); diff --git a/tests/snapshots/qwen3.5-27b.schema b/tests/snapshots/qwen3.6-27b.schema similarity index 100% rename from tests/snapshots/qwen3.5-27b.schema rename to tests/snapshots/qwen3.6-27b.schema diff --git a/tests/test-autorelease.cpp b/tests/test-autorelease.cpp index ca87c56a8f..370428809f 100644 --- a/tests/test-autorelease.cpp +++ b/tests/test-autorelease.cpp @@ -1,15 +1,13 @@ // ref: https://github.com/ggml-org/llama.cpp/issues/4952#issuecomment-1892864763 -#include -#include #include #include "llama.h" -#include "get-model.h" +#include "common.h" // This creates a new context inside a pthread and then tries to exit cleanly. int main(int argc, char ** argv) { - auto * model_path = get_model_or_exit(argc, argv); + auto * model_path = common_get_model_or_exit(argc, argv); std::thread([&model_path]() { llama_backend_init(); diff --git a/tests/test-backend-sampler.cpp b/tests/test-backend-sampler.cpp index 61ddf91fea..c24076e313 100644 --- a/tests/test-backend-sampler.cpp +++ b/tests/test-backend-sampler.cpp @@ -1,7 +1,6 @@ #include "ggml.h" #include "llama.h" #include "llama-cpp.h" -#include "get-model.h" #include "common.h" #ifdef NDEBUG @@ -1136,7 +1135,7 @@ int main(int argc, char ** argv) { test_args args = parse_cli(argc, argv); if (args.model.empty()) { - args.model = get_model_or_exit(1, argv); + args.model = common_get_model_or_exit(1, argv); } { diff --git a/tests/test-model-load-cancel.cpp b/tests/test-model-load-cancel.cpp index ecc3022711..f8139b26d7 100644 --- a/tests/test-model-load-cancel.cpp +++ b/tests/test-model-load-cancel.cpp @@ -1,10 +1,10 @@ #include "llama.h" -#include "get-model.h" +#include "common.h" #include int main(int argc, char *argv[] ) { - auto * model_path = get_model_or_exit(argc, argv); + auto * model_path = common_get_model_or_exit(argc, argv); auto * file = fopen(model_path, "r"); if (file == nullptr) { fprintf(stderr, "no model at '%s' found\n", model_path); diff --git a/tests/test-quant-type-selection.cpp b/tests/test-quant-type-selection.cpp index 3c8983360e..9a5f5e53e1 100644 --- a/tests/test-quant-type-selection.cpp +++ b/tests/test-quant-type-selection.cpp @@ -216,18 +216,18 @@ static std::string snapshot_file_from_name(const std::string & name) { } static const remote_model_spec model_specs[] = { - { "ggml-org/Qwen3-0.6B-GGUF", "Q8_0" }, - { "ggml-org/GLM-4.6V-GGUF", "Q8_0" }, - { "ggml-org/Step-3.5-Flash-GGUF", "Q4_K" }, - { "ggml-org/Qwen3-Coder-Next-GGUF", "Q8_0" }, - { "ggml-org/Qwen3-14B-GGUF", "Q8_0" }, - { "ggml-org/Nemotron-Nano-3-30B-A3B-GGUF", "Q8_0" }, - { "ggml-org/gpt-oss-120b-GGUF", "mxfp4" }, - { "ggml-org/gemma-3-4b-it-GGUF", "Q8_0" }, - { "bartowski/Meta-Llama-3.1-70B-Instruct-GGUF", "Q4_K_M" }, - { "bartowski/deepseek-ai_DeepSeek-V3.1-GGUF", "IQ1_M" }, - { "bartowski/Qwen_Qwen3.5-397B-A17B-GGUF", "IQ1_S" }, // TODO: swap with ggml-org if/when it's released - { "bartowski/Qwen_Qwen3.5-27B-GGUF", "Q8_0" }, // TODO: swap with ggml-org if/when it's released + { "ggml-org/Qwen3-0.6B-GGUF", "Q8_0" }, + { "ggml-org/GLM-4.6V-GGUF", "Q8_0" }, + { "ggml-org/Step-3.5-Flash-GGUF", "Q4_K" }, + { "ggml-org/Qwen3-Coder-Next-GGUF", "Q8_0" }, + { "ggml-org/Qwen3-14B-GGUF", "Q8_0" }, + { "ggml-org/NVIDIA-Nemotron-Nano-3-30B-A3B-GGUF", "Q8_0" }, + { "ggml-org/gpt-oss-120b-GGUF", "mxfp4" }, + { "ggml-org/gemma-3-4b-it-GGUF", "Q8_0" }, + { "bartowski/Meta-Llama-3.1-70B-Instruct-GGUF", "Q4_K_M" }, + { "bartowski/deepseek-ai_DeepSeek-V3.1-GGUF", "IQ1_M" }, + //{ "bartowski/Qwen_Qwen3.5-397B-A17B-GGUF", "IQ1_S" }, // TODO: swap with ggml-org if/when it's released + { "ggml-org/Qwen3.6-27B-GGUF", "Q8_0" }, }; static const int n_model_specs = (int) (sizeof(model_specs) / sizeof(model_specs[0])); diff --git a/tests/test-rset-release.cpp b/tests/test-rset-release.cpp index bf03c5e8bd..c60801c115 100644 --- a/tests/test-rset-release.cpp +++ b/tests/test-rset-release.cpp @@ -3,14 +3,14 @@ // thus, this test is not run by default // example model to run with: google/gemma-4-E4B-it-qat-q4_0-gguf +#include "llama.h" +#include "common.h" + #include #include #include #include -#include "llama.h" -#include "get-model.h" - static uint64_t wired_memory() { vm_statistics64_data_t vmstat; mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; @@ -21,7 +21,7 @@ static uint64_t wired_memory() { } int main(int argc, char ** argv) { - auto * model_path = get_model_or_exit(argc, argv); + auto * model_path = common_get_model_or_exit(argc, argv); llama_backend_init();