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

fix: Ensure that test suite passes with system-provided SQLite on MacOS #1499

Merged
merged 3 commits into from
Apr 5, 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ MANIFEST
compile_commands.json
build.ninja
.clangd
.cache

# Generated Visual Studio files
*.vcxproj
Expand Down
16 changes: 15 additions & 1 deletion c/driver/sqlite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ else()
set(SQLite3_INCLUDE_DIRS)
endif()

# Check for sqlite3_load_extension() in sqlite3.h
if(EXISTS "${SQLite3_INCLUDE_DIRS}/sqlite3.h")
file(READ "${SQLite3_INCLUDE_DIRS}/sqlite3.h" ADBC_SQLITE_H_CONTENT)
string(FIND "${ADBC_SQLITE_H_CONTENT}" "sqlite3_load_extension"
ADBC_SQLITE_WITH_LOAD_EXTENSION)
endif()

if(NOT ADBC_SQLITE_WITH_LOAD_EXTENSION)
set(ADBC_SQLITE_COMPILE_DEFINES "-DADBC_SQLITE_WITH_NO_LOAD_EXTENSION")
endif()

add_arrow_lib(adbc_driver_sqlite
SOURCES
sqlite.cc
Expand All @@ -50,7 +61,8 @@ add_arrow_lib(adbc_driver_sqlite
${LIBPQ_STATIC_LIBRARIES})

foreach(LIB_TARGET ${ADBC_LIBRARIES})
target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING)
target_compile_definitions(${LIB_TARGET} PRIVATE ADBC_EXPORTING
${ADBC_SQLITE_COMPILE_DEFINES})
target_include_directories(${LIB_TARGET} SYSTEM
PRIVATE ${REPOSITORY_ROOT}
${REPOSITORY_ROOT}/c/
Expand Down Expand Up @@ -82,6 +94,8 @@ if(ADBC_BUILD_TESTS)
adbc_validation
nanoarrow
${TEST_LINK_LIBS})
target_compile_definitions(adbc-driver-sqlite-test
PRIVATE ${ADBC_SQLITE_COMPILE_DEFINES})
target_compile_features(adbc-driver-sqlite-test PRIVATE cxx_std_17)
target_include_directories(adbc-driver-sqlite-test SYSTEM
PRIVATE ${REPOSITORY_ROOT}
Expand Down
4 changes: 4 additions & 0 deletions c/driver/sqlite/sqlite_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ class SqliteConnectionTest : public ::testing::Test,
ADBCV_TEST_CONNECTION(SqliteConnectionTest)

TEST_F(SqliteConnectionTest, ExtensionLoading) {
#if defined(ADBC_SQLITE_WITH_NO_LOAD_EXTENSION)
GTEST_SKIP() << "Linking to SQLite without extension loading";
#endif

ASSERT_THAT(AdbcConnectionNew(&connection, &error),
adbc_validation::IsOkStatus(&error));

Expand Down
Loading