Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: fix compile for mcjit and improve to tests #3952

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hybridse/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ thirdsrc

src/fe_version.h
src/hyhridse_version.h
src/case/test_cfg.h

# ignore docgen
style.xml
Expand Down
6 changes: 6 additions & 0 deletions hybridse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ configure_file(
"${PROJECT_SOURCE_DIR}/src/version.h.in"
"${PROJECT_SOURCE_DIR}/src/hybridse_version.h"
)

configure_file(
"${PROJECT_SOURCE_DIR}/src/case/test_cfg.h.in"
"${PROJECT_SOURCE_DIR}/src/case/test_cfg.h"
)

if (DEFINED ENV{CI})
# suppress useless maven log (e.g download log) on CI environment
set(MAVEN_FLAGS --batch-mode)
Expand Down
3 changes: 3 additions & 0 deletions hybridse/include/case/sql_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ class SqlCase {
}
static std::set<std::string> 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() {
Expand Down
7 changes: 2 additions & 5 deletions hybridse/src/case/sql_case.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "glog/logging.h"
#include "node/sql_node.h"
#include "plan/plan_api.h"
#include "case/test_cfg.h"
#include "vm/engine.h"
#include "zetasql/parser/parser.h"
#include "planv2/ast_node_converter.h"
Expand Down Expand Up @@ -1762,11 +1763,7 @@
if (value != nullptr) {
return std::string(value);
}
value = getenv("YAML_CASE_BASE_DIR");
if (value != nullptr) {
return std::string(value);
}
return "";
return SQL_CASE_BASE_DIR;

Check warning on line 1766 in hybridse/src/case/sql_case.cc

View check run for this annotation

Codecov / codecov/patch

hybridse/src/case/sql_case.cc#L1766

Added line #L1766 was not covered by tests
}

absl::StatusOr<std::vector<codec::Row>> ExtractInsertRow(vm::HybridSeJitWrapper* jit, absl::string_view insert,
Expand Down
22 changes: 22 additions & 0 deletions hybridse/src/case/test_cfg.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright (c) 2024 OpenMLDB Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef HYBRIDSE_SRC_CASE_TEST_CFG_H_
#define HYBRIDSE_SRC_CASE_TEST_CFG_H_

#define SQL_CASE_BASE_DIR "${CMAKE_SOURCE_DIR}"

#endif // HYBRIDSE_SRC_CASE_TEST_CFG_H_
5 changes: 3 additions & 2 deletions hybridse/src/vm/jit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C" {
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
#include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
Expand Down Expand Up @@ -314,15 +315,15 @@ bool HybridSeMcJitWrapper::AddModule(
} else {
execution_engine_->addModule(std::move(module));
}
if (jit_options_.IsEnableVTune()) {
if (jit_options_.IsEnableVtune()) {
auto listener = ::llvm::JITEventListener::createIntelJITEventListener();
if (listener == nullptr) {
LOG(WARNING) << "Intel jit events is not enabled";
} else {
execution_engine_->RegisterJITEventListener(listener);
}
}
if (jit_options_.IsEnableGDB()) {
if (jit_options_.IsEnableGdb()) {
auto listener =
::llvm::JITEventListener::createGDBRegistrationListener();
if (listener == nullptr) {
Expand Down
Loading