Repository navigation
tests : link each test against only the libraries it uses - #30299
Merged
Merged
Conversation
Give llama_build() and llama_build_and_test() a LINK keyword (default: llama-common) so call sites can declare what a test actually needs: - ggml-only tests now link just ggml: test-opt, test-metal-graph-optimize, test-backend-ops, test-tiled-mulmat, test-barrier, test-quantize-fns, test-quantize-perf, test-rope, test-col2im-1d, test-gguf, test-alloc - llama-only tests drop llama-common: test-unicode, test-sampling, test-grammar-parser, test-llama-grammar, test-batch-alloc, test-gbnf-validator, test-quant-type-selection - both mtmd tests link mtmd only, dropping the LLAMA_TEST_NAME / target_link_libraries workarounds Both helpers now set cxx_std_17 explicitly, since the tests no longer inherit it from llama-common's PUBLIC interface. tests/testing.h no longer includes common.h; the only symbol it used from there (string_join) is inlined. Assisted-by: pi:llama.cpp/Qwen3.8-Flash-Next
ggerganov
marked this pull request as ready for review
October 11, 2026 11:42
6 of 7 tasks
Nathanw1014
added a commit
to Nathanw1014/llama.cpp
that referenced
this pull request
Oct 18, 2026
Master links each test against only the libraries it uses (ggml-org#30299); the rebase gave test-tq2t and test-tqk LINK ggml but missed test-tqp, which then fails to link in a GGML_BACKEND_DL build. Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
llama_build()andllama_build_and_test()hard-coded their link libraries (llama llama-commonandllama-common). Sincellama-commonPUBLIC-linksllamaandllamaPUBLIC-linksggml, every test executable transitively pulled inlibllama— plusllama-common's PUBLIC interface — even when the test never references allama_*orcommon_*symbol.This PR gives both helpers a
LINKkeyword (default: unchanged,llama-common) and updates each call site to declare its real dependency:ggmlonly:test-opt,test-metal-graph-optimize,test-backend-ops,test-tiled-mulmat,test-barrier,test-quantize-fns,test-quantize-perf,test-rope,test-col2im-1d,test-gguf,test-allocllama-common:test-unicode,test-sampling,test-grammar-parser,test-llama-grammar,test-batch-alloc,test-gbnf-validator,test-quant-type-selectionmtmdonly, removing theset(LLAMA_TEST_NAME ...)/target_link_libraries(... mtmd)workaroundstests/testing.hno longer includescommon.h(it used nothing from it exceptstring_join, now inlined).Additional information
test-metal-graph-optimizenow takesLINK ggml ggml-metalinstead of a separatetarget_link_librariesline.Requirements