Skip to content
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
18 changes: 15 additions & 3 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,30 @@ jobs:
mkdir build
pushd build

export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/sparrow-wasm-build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/sparrow-wasm-host
export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot

emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_TESTS=ON \
-DBUILD_DOCS=OFF \
-DSYSROOT_PATH=$SYSROOT_PATH \
..

emmake make -j ${{ env.ncpus }} install

# TODO: Enable tests through subsequent PRs
# - name: Run tests
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '23.x'

- name: Run tests
shell: bash
working-directory: build/bin/Release
run: |
node --version
node ./test_sparrow_lib.js
3 changes: 2 additions & 1 deletion environment-wasm-host.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ name: sparrow-wasm-host
channels:
- https://repo.prefix.dev/emscripten-forge-dev
dependencies:
- howardhinnant_date
- howardhinnant_date
- doctest
219 changes: 123 additions & 96 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,12 @@ set(SPARROW_TESTS_SOURCES
test_arrow_array_schema_utils.cpp
test_arrow_array.cpp
test_arrow_schema.cpp
test_binary_array.cpp
test_bit.cpp
test_buffer_adaptor.cpp
test_buffer.cpp
test_builder_dict_encoded.cpp
test_builder_dict_encoded.cpp
test_builder_run_end_encoded.cpp
test_builder_run_end_encoded.cpp
test_builder_utils.cpp
test_builder_utils.cpp
test_builder.cpp
test_builder.cpp
test_date_array.cpp
test_date_array.cpp
test_decimal_array.cpp
test_decimal.cpp
Expand Down Expand Up @@ -91,10 +84,8 @@ set(SPARROW_TESTS_SOURCES
test_record_batch.cpp
test_repeat_container.cpp
test_run_end_encoded_array.cpp
test_string_array.cpp
test_struct_array.cpp
test_time_array.cpp
test_timestamp_array.cpp
test_timestamp_without_timezone_array.cpp
test_traits.cpp
test_u8_buffer.cpp
Expand All @@ -105,94 +96,130 @@ set(SPARROW_TESTS_SOURCES
test_variable_size_binary_view_array.cpp
)

set(test_target "test_sparrow_lib")
add_executable(${test_target} ${SPARROW_TESTS_SOURCES})
target_link_libraries(${test_target}
PRIVATE
sparrow
doctest::doctest
better_junit_reporter
$<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_LIBRARIES}>)

# set(test_target_catch2 "test_sparrow_lib_catch2")

# add_executable(${test_target_catch2})
# target_link_libraries(${test_target_catch2}
# PRIVATE
# sparrow
# Catch2::Catch2WithMain
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_LIBRARIES}>)

# include(Catch)
# catch_discover_tests(${test_target_catch2})

include(compile_options)

target_compile_options(${test_target}
PRIVATE
${compile_options}
$<$<BOOL:USE_SANITIZER>:${SANITIZER_COMPILE_OPTIONS}>
)
target_link_options(${test_target}
PRIVATE
$<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_OPTIONS}>)
target_compile_definitions(${test_target}
PRIVATE
DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS)

if(ENABLE_COVERAGE)
enable_coverage(${test_target})
if(NOT EMSCRIPTEN)
list(APPEND SPARROW_TESTS_SOURCES
test_binary_array.cpp
test_builder.cpp
test_string_array.cpp
test_timestamp_array.cpp
)
endif()

# We do not use non-standard C++
set_target_properties(${test_target}
PROPERTIES
CMAKE_CXX_EXTENSIONS OFF)
target_compile_features(${test_target} PRIVATE cxx_std_20)

# target_compile_options(${test_target_catch2}
# PRIVATE
# ${compile_options}
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_COMPILE_OPTIONS}>
# )
# target_link_options(${test_target_catch2}
# PRIVATE
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_OPTIONS}>)
# We do not use non-standard C++
# set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
# target_compile_features(${test_target_catch2} PRIVATE cxx_std_20)

add_custom_target(run_tests
COMMAND ${test_target}
# COMMAND ${test_target_catch2} -v high
DEPENDS
${test_target}
# ${test_target_catch2}
COMMENT "Running tests for Doctest and Catch2"
USES_TERMINAL
)

set_target_properties(run_tests PROPERTIES FOLDER "Tests utilities")

set(JUNIT_REPORT_FILE_DOCTEST ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report_doctest.xml)
set(JUNIT_REPORT_FILE_CATCH2 ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report_catch2.xml)

add_custom_target(run_tests_with_junit_report
COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE_DOCTEST} --no-path-filenames=true
# COMMAND ${test_target_catch2} --reporter JUnit -o ${JUNIT_REPORT_FILE_CATCH2}
DEPENDS
${test_target}
# ${test_target_catch2}
COMMENT "Running tests with JUnit reports saved to: ${JUNIT_REPORT_FILE_DOCTEST} and ${JUNIT_REPORT_FILE_CATCH2}"
USES_TERMINAL
)

set_target_properties(run_tests_with_junit_report PROPERTIES FOLDER "Tests utilities")

if(ENABLE_INTEGRATION_TEST)
add_subdirectory(c_data_integration)
endif()
set(test_target "test_sparrow_lib")
add_executable(${test_target} ${SPARROW_TESTS_SOURCES})

if(CREATE_JSON_READER_TARGET)
add_subdirectory(json_reader)
if(EMSCRIPTEN)

target_compile_options(${test_target}
PUBLIC "SHELL: -fexceptions"
PUBLIC "SHELL: -fPIC"
)

target_link_libraries(${test_target}
PRIVATE
sparrow
doctest::doctest
better_junit_reporter)

target_link_options(${test_target}
PUBLIC "SHELL: -fexceptions"
PUBLIC "SHELL: -fPIC"
PUBLIC "SHELL: -s MAIN_MODULE=1"
PUBLIC "SHELL: -s WASM_BIGINT"
PUBLIC "SHELL: -s ASSERTIONS=0"
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
PUBLIC "SHELL: -s STACK_SIZE=32mb"
PUBLIC "SHELL: -s INITIAL_MEMORY=128mb"
PUBLIC "SHELL: --preload-file ${SYSROOT_PATH}/include@/include"
)
else()
target_link_libraries(${test_target}
PRIVATE
sparrow
doctest::doctest
better_junit_reporter
$<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_LIBRARIES}>)

# set(test_target_catch2 "test_sparrow_lib_catch2")

# add_executable(${test_target_catch2})
# target_link_libraries(${test_target_catch2}
# PRIVATE
# sparrow
# Catch2::Catch2WithMain
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_LIBRARIES}>)

# include(Catch)
# catch_discover_tests(${test_target_catch2})

include(compile_options)

target_compile_options(${test_target}
PRIVATE
${compile_options}
$<$<BOOL:USE_SANITIZER>:${SANITIZER_COMPILE_OPTIONS}>
)
target_link_options(${test_target}
PRIVATE
$<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_OPTIONS}>)
target_compile_definitions(${test_target}
PRIVATE
DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS)

if(ENABLE_COVERAGE)
enable_coverage(${test_target})
endif()

# We do not use non-standard C++
set_target_properties(${test_target}
PROPERTIES
CMAKE_CXX_EXTENSIONS OFF)
target_compile_features(${test_target} PRIVATE cxx_std_20)

# target_compile_options(${test_target_catch2}
# PRIVATE
# ${compile_options}
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_COMPILE_OPTIONS}>
# )
# target_link_options(${test_target_catch2}
# PRIVATE
# $<$<BOOL:USE_SANITIZER>:${SANITIZER_LINK_OPTIONS}>)
# We do not use non-standard C++
# set_target_properties(${test_target_catch2} PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
# target_compile_features(${test_target_catch2} PRIVATE cxx_std_20)

add_custom_target(run_tests
COMMAND ${test_target}
# COMMAND ${test_target_catch2} -v high
DEPENDS
${test_target}
# ${test_target_catch2}
COMMENT "Running tests for Doctest and Catch2"
USES_TERMINAL
)

set_target_properties(run_tests PROPERTIES FOLDER "Tests utilities")

set(JUNIT_REPORT_FILE_DOCTEST ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report_doctest.xml)
set(JUNIT_REPORT_FILE_CATCH2 ${CMAKE_CURRENT_BINARY_DIR}/test_sparrow_lib_report_catch2.xml)

add_custom_target(run_tests_with_junit_report
COMMAND ${test_target} --reporters=better_junit --out=${JUNIT_REPORT_FILE_DOCTEST} --no-path-filenames=true
# COMMAND ${test_target_catch2} --reporter JUnit -o ${JUNIT_REPORT_FILE_CATCH2}
DEPENDS
${test_target}
# ${test_target_catch2}
COMMENT "Running tests with JUnit reports saved to: ${JUNIT_REPORT_FILE_DOCTEST} and ${JUNIT_REPORT_FILE_CATCH2}"
USES_TERMINAL
)

set_target_properties(run_tests_with_junit_report PROPERTIES FOLDER "Tests utilities")

if(ENABLE_INTEGRATION_TEST)
add_subdirectory(c_data_integration)
endif()

if(CREATE_JSON_READER_TARGET)
add_subdirectory(json_reader)
endif()
endif()
6 changes: 6 additions & 0 deletions test/doctest_better_junit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ target_include_directories(better_junit_reporter
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

if(EMSCRIPTEN)
target_compile_options(better_junit_reporter
PUBLIC "SHELL: -fPIC"
)
endif()
Loading