Skip to content

Commit f4253ef

Browse files
authored
tests: Harmonize header use (ggml-org#25616)
* tests: Harmonize the use of private ggml includes * tests: In test-backend-ops, use quoted includes As with all other tests. This is to ensure that the build uses shipped headers over possibly system-installed ones.
1 parent ad8d821 commit f4253ef

3 files changed

Lines changed: 16 additions & 13 deletions

File tree

tests/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ if (NOT LLAMA_SANITIZE_ADDRESS AND NOT GGML_SCHED_NO_REALLOC)
239239
# TODO: repair known memory leaks
240240
llama_build_and_test(test-opt.cpp)
241241
endif()
242-
llama_build_and_test(test-gguf.cpp)
243242
llama_build_and_test(test-backend-ops.cpp)
244243

245244
llama_build_and_test(test-model-load-cancel.cpp LABEL "model")
@@ -299,11 +298,15 @@ get_filename_component(TEST_TARGET test-c.c NAME_WE)
299298
add_executable(${TEST_TARGET} test-c.c)
300299
target_link_libraries(${TEST_TARGET} PRIVATE llama)
301300

302-
llama_build_and_test(test-alloc.cpp)
303-
target_include_directories(test-alloc PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
301+
if (NOT LLAMA_USE_SYSTEM_GGML)
302+
# Needs non-public ggml-impl.h
303+
llama_build_and_test(test-gguf.cpp)
304+
305+
# Needs non-public ggml{,-backend}-impl.h
306+
llama_build_and_test(test-alloc.cpp)
307+
endif()
304308

305309
llama_build(test-export-graph-ops.cpp)
306-
target_include_directories(test-export-graph-ops PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
307310
if (TARGET gguf-model-data)
308311
target_link_libraries(test-export-graph-ops PRIVATE gguf-model-data)
309312
target_compile_definitions(test-export-graph-ops PRIVATE LLAMA_HF_FETCH)

tests/test-alloc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include <ggml-alloc.h>
2-
#include <ggml-backend-impl.h>
3-
#include <ggml-cpp.h>
4-
#include <ggml-impl.h>
5-
#include <ggml.h>
1+
#include "ggml-alloc.h"
2+
#include "../ggml/src/ggml-backend-impl.h"
3+
#include "ggml-cpp.h"
4+
#include "../ggml/src/ggml-impl.h"
5+
#include "ggml.h"
66

77
#include <algorithm>
88
#include <exception>

tests/test-backend-ops.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
// ##############################
1616

1717

18-
#include <ggml.h>
19-
#include <ggml-alloc.h>
20-
#include <ggml-backend.h>
21-
#include <ggml-cpp.h>
18+
#include "ggml.h"
19+
#include "ggml-alloc.h"
20+
#include "ggml-backend.h"
21+
#include "ggml-cpp.h"
2222

2323
#include <algorithm>
2424
#include <atomic>

0 commit comments

Comments
 (0)