Skip to content

Commit f5048d2

Browse files
committed
test: add memory leak check to LLM context size tests
Appends a call to assert_sqlite_memory_clean in three test cleanup sections to ensure no memory leaks occur after LLM context size error tests.
1 parent d936cba commit f5048d2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/c/unittest.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,7 @@ static int test_chat_system_prompt_new_chat(const test_env *env) {
859859
if (context_created) exec_expect_ok(env, db, "SELECT llm_context_free();");
860860
if (model_loaded) exec_expect_ok(env, db, "SELECT llm_model_free();");
861861
if (db) sqlite3_close(db);
862+
if (status == 0) status = assert_sqlite_memory_clean("llm_context_size_errors", env);
862863
return status;
863864
}
864865

@@ -922,6 +923,7 @@ static int test_chat_system_prompt_replace_previous_prompt(const test_env *env)
922923
if (context_created) exec_expect_ok(env, db, "SELECT llm_context_free();");
923924
if (model_loaded) exec_expect_ok(env, db, "SELECT llm_model_free();");
924925
if (db) sqlite3_close(db);
926+
if (status == 0) status = assert_sqlite_memory_clean("llm_context_size_errors", env);
925927
return status;
926928
}
927929

@@ -1002,6 +1004,7 @@ static int test_chat_system_prompt_after_first_response(const test_env *env) {
10021004
if (context_created) exec_expect_ok(env, db, "SELECT llm_context_free();");
10031005
if (model_loaded) exec_expect_ok(env, db, "SELECT llm_model_free();");
10041006
if (db) sqlite3_close(db);
1007+
if (status == 0) status = assert_sqlite_memory_clean("llm_context_size_errors", env);
10051008
return status;
10061009
}
10071010

0 commit comments

Comments
 (0)