From 950929442070874d45561d2a4b68b010457767de Mon Sep 17 00:00:00 2001 From: alonfaraj Date: Wed, 30 Aug 2023 12:42:51 +0300 Subject: [PATCH] make : add test and update CI (#2897) * build ci: run make test * makefile: - add all - add test * enable tests/test-tokenizer-0-llama * fix path to model * remove gcc-8 from macos build test * Update Makefile * Update Makefile --- .github/workflows/build.yml | 12 ++++++++++++ Makefile | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10320ad1f..20fd8c2b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,12 @@ jobs: run: | CC=gcc-8 make + - name: Test + id: make_test + run: | + CC=gcc-8 make tests + make test + ubuntu-latest-cmake: runs-on: ubuntu-latest @@ -157,6 +163,12 @@ jobs: run: | make + - name: Test + id: make_test + run: | + make tests + make test + macOS-latest-cmake: runs-on: macos-latest diff --git a/Makefile b/Makefile index c8b8a92d7..bd2d92869 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,23 @@ TEST_TARGETS = tests/test-llama-grammar tests/test-grammar-parser tests/test-dou default: $(BUILD_TARGETS) +test: + @echo "Running tests..." + @for test_target in $(TEST_TARGETS); do \ + if [ "$$test_target" = "tests/test-tokenizer-0-llama" ]; then \ + ./$$test_target $(CURDIR)/models/ggml-vocab-llama.gguf; \ + elif [ "$$test_target" = "tests/test-tokenizer-0-falcon" ]; then \ + continue; \ + elif [ "$$test_target" = "tests/test-tokenizer-1" ]; then \ + continue; \ + else \ + ./$$test_target; \ + fi; \ + done + @echo "All tests have been run." + +all: $(BUILD_TARGETS) $(TEST_TARGETS) + ifndef UNAME_S UNAME_S := $(shell uname -s) endif