From a5ffc88b1d3cdca8c9a995dac89f810237d5bfec Mon Sep 17 00:00:00 2001 From: aceforeverd Date: Fri, 5 Jul 2024 08:33:34 +0000 Subject: [PATCH] feat: setup SqlCaseBaseDir for hybridse TODO: also setup for tests in src/ --- hybridse/include/case/sql_case.h | 3 +++ hybridse/src/case/sql_case.cc | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/hybridse/include/case/sql_case.h b/hybridse/include/case/sql_case.h index cb2d9907b37..bdc50aa8e35 100644 --- a/hybridse/include/case/sql_case.h +++ b/hybridse/include/case/sql_case.h @@ -221,6 +221,9 @@ class SqlCase { } static std::set HYBRIDSE_LEVEL(); + // Get the base directory searching for yaml test cases. + // It is by default directory to current git repository, or you can override + // the base directory with 'SQL_CASE_BASE_DIR' environment variable static std::string SqlCaseBaseDir(); static bool IsDebug() { diff --git a/hybridse/src/case/sql_case.cc b/hybridse/src/case/sql_case.cc index a92a7c9028e..ac8e2459bd5 100644 --- a/hybridse/src/case/sql_case.cc +++ b/hybridse/src/case/sql_case.cc @@ -1759,6 +1759,10 @@ std::set SqlCase::HYBRIDSE_LEVEL() { } std::string SqlCase::SqlCaseBaseDir() { + char* value = getenv("SQL_CASE_BASE_DIR"); + if (value != nullptr) { + return std::string(value); + } return SQL_CASE_BASE_DIR; }