From aaf04e1eae1df7eefcfc837fa96a07a8082ccd42 Mon Sep 17 00:00:00 2001 From: Pawel Date: Fri, 5 Sep 2025 13:53:58 +0200 Subject: [PATCH 1/3] fixed llm unit tests in CI --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ce7a13cefa..1cadbd220a 100644 --- a/Makefile +++ b/Makefile @@ -655,10 +655,11 @@ ifeq ($(RUN_GPU_TESTS),1) -u 0 \ -v $(shell realpath ./run_unit_tests.sh):/ovms/./run_unit_tests.sh \ -v $(shell realpath ${GPU_MODEL_PATH}):/ovms/src/test/face_detection_adas/1:ro \ - -v $(shell realpath ${TEST_LLM_PATH}):/ovms/src/test/llm_testing:ro \ + -v $(shell realpath ${TEST_LLM_PATH}):${TEST_LLM_PATH}:ro \ -e https_proxy=${https_proxy} \ -e RUN_TESTS=1 \ -e RUN_GPU_TESTS=$(RUN_GPU_TESTS) \ + -e TEST_LLM_PATH=${TEST_LLM_PATH} \ -e JOBS=$(JOBS) \ -e debug_bazel_flags=${BAZEL_DEBUG_FLAGS} \ $(OVMS_CPP_DOCKER_IMAGE)-build:$(OVMS_CPP_IMAGE_TAG)$(IMAGE_TAG_SUFFIX) \ @@ -672,10 +673,11 @@ else docker run \ --name $(OVMS_CPP_IMAGE_TAG)$(IMAGE_TAG_SUFFIX) \ -v $(shell realpath ./run_unit_tests.sh):/ovms/./run_unit_tests.sh \ - -v $(shell realpath ${TEST_LLM_PATH}):/ovms/src/test/llm_testing:ro \ + -v $(shell realpath ${TEST_LLM_PATH}):${TEST_LLM_PATH}:ro \ -e https_proxy=${https_proxy} \ -e RUN_TESTS=1 \ -e JOBS=$(JOBS) \ + -e TEST_LLM_PATH=${TEST_LLM_PATH} \ -e debug_bazel_flags=${BAZEL_DEBUG_FLAGS} \ $(OVMS_CPP_DOCKER_IMAGE)-build:$(OVMS_CPP_IMAGE_TAG)$(IMAGE_TAG_SUFFIX) \ ./run_unit_tests.sh ;\ From a5abf7cef1270415d14e97894c7778b7c0d7ad5c Mon Sep 17 00:00:00 2001 From: Pawel Date: Mon, 8 Sep 2025 10:07:10 +0200 Subject: [PATCH 2/3] changed modelsPath to accept env variable instead of hardcoded value --- src/test/llm/llmnode_test.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/test/llm/llmnode_test.cpp b/src/test/llm/llmnode_test.cpp index e3a4fbbbff..bbe0901d42 100644 --- a/src/test/llm/llmnode_test.cpp +++ b/src/test/llm/llmnode_test.cpp @@ -3698,18 +3698,26 @@ class LLMOptionsHttpTestPython : public ::testing::Test { static void SetUpTestSuite() { py::initialize_interpreter(); } static void TearDownTestSuite() { py::finalize_interpreter(); } #endif + static const char* getModelPath(std::string defaultValue) { + const char* testLlmPathEnv = std::getenv("TEST_LLM_PATH"); + if (testLlmPathEnv != nullptr && std::strlen(testLlmPathEnv) > 0) { + return testLlmPathEnv; + } else { + return defaultValue.c_str(); + } + } }; class LLMOptionsHttpTest : public LLMOptionsHttpTestPython { public: std::string modelsPath; - void SetUp() { modelsPath = "/ovms/src/test/llm_testing/facebook/opt-125m"; } + void SetUp() { modelsPath = getModelPath("/ovms/src/test/llm_testing/facebook/opt-125m"); } }; class LLMVLMOptionsHttpTest : public LLMOptionsHttpTestPython { public: std::string modelsPath; - void SetUp() { modelsPath = "/ovms/src/test/llm_testing/OpenGVLab/InternVL2-1B"; } + void SetUp() { modelsPath = getModelPath("/ovms/src/test/llm_testing/OpenGVLab/InternVL2-1B"); } }; void TestLLMNodeOptionsCheckDefault(std::string& modelsPath) { From 4b93538c69edb52630435418139aed80e065e093 Mon Sep 17 00:00:00 2001 From: Pawel Date: Mon, 8 Sep 2025 11:03:06 +0200 Subject: [PATCH 3/3] ensured method is public without Python --- src/test/llm/llmnode_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/llm/llmnode_test.cpp b/src/test/llm/llmnode_test.cpp index bbe0901d42..bee95cc9a4 100644 --- a/src/test/llm/llmnode_test.cpp +++ b/src/test/llm/llmnode_test.cpp @@ -3698,6 +3698,7 @@ class LLMOptionsHttpTestPython : public ::testing::Test { static void SetUpTestSuite() { py::initialize_interpreter(); } static void TearDownTestSuite() { py::finalize_interpreter(); } #endif +public: static const char* getModelPath(std::string defaultValue) { const char* testLlmPathEnv = std::getenv("TEST_LLM_PATH"); if (testLlmPathEnv != nullptr && std::strlen(testLlmPathEnv) > 0) {