From 7778b89d300e37d7700297445b7ffeb0111ae92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20G=C3=A4=C3=9Fler?= Date: Sun, 15 Dec 2024 15:18:01 +0100 Subject: [PATCH] add test for no dangling pointers --- tests/test-gguf.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test-gguf.cpp b/tests/test-gguf.cpp index a4434bcaf..e5b4cb7b8 100644 --- a/tests/test-gguf.cpp +++ b/tests/test-gguf.cpp @@ -689,6 +689,17 @@ static std::pair test_handcrafted_file(const unsigned int seed) { } ntest++; + if (false && hft >= offset_has_data && !expect_context_not_null(hft)) { // FIXME + printf("%s: - no_dangling_ggml_context_pointer: ", __func__); + if (ctx) { + printf("\033[1;31mFAIL\033[0m\n"); + } else { + printf("\033[1;32mOK\033[0m\n"); + npass++; + } + ntest++; + } + if (false && expect_context_not_null(hft)) { // FIXME FILE * file_eb = get_handcrafted_file(seed, hft, /*extra_bytes =*/ 1); struct gguf_context * gguf_ctx_eb = gguf_init_from_file_impl(file_eb, gguf_params);