From 39ace3668c3c7cffec68d5fd124cb31b60793160 Mon Sep 17 00:00:00 2001 From: Cebtenzzre Date: Mon, 28 Aug 2023 01:57:57 -0400 Subject: [PATCH] tests : add a C compliance test --- Makefile | 3 +++ tests/CMakeLists.txt | 5 +++++ tests/test-c.c | 3 +++ 3 files changed, 11 insertions(+) create mode 100644 tests/test-c.c diff --git a/Makefile b/Makefile index a3400e491..a75c4d989 100644 --- a/Makefile +++ b/Makefile @@ -468,3 +468,6 @@ tests/test-sampling: tests/test-sampling.cpp build-info.h ggml.o llama.o common. tests/test-tokenizer-0: tests/test-tokenizer-0.cpp build-info.h ggml.o llama.o common.o $(OBJS) $(CXX) $(CXXFLAGS) $(filter-out %.txt,$^) -o $@ $(LDFLAGS) + +tests/test-c.o: tests/test-c.c llama.h + $(CC) $(CFLAGS) -c $(filter-out %.h,$^) -o $@ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ca1f39d31..483210d7b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -37,3 +37,8 @@ llama_build_and_test_executable(test-grammar-parser.cpp) llama_build_and_test_executable(test-llama-grammar.cpp) llama_build_and_test_executable(test-grad0.cpp) # SLOW # llama_build_and_test_executable(test-opt.cpp) # SLOW + +# dummy executable - not installed +get_filename_component(TEST_TARGET test-c.c NAME_WE) +add_executable(${TEST_TARGET} test-c.c) +target_link_libraries(${TEST_TARGET} PRIVATE llama) diff --git a/tests/test-c.c b/tests/test-c.c new file mode 100644 index 000000000..a05071080 --- /dev/null +++ b/tests/test-c.c @@ -0,0 +1,3 @@ +#include "llama.h" + +int main(void) {}