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

Move tests from doctest to Catch2 #301

Merged
merged 36 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
37e125c
Modified dependencies to add Catch2
Gulin7 Nov 27, 2024
fcbdb8e
Modified CMake to use Catch2 lib and added new Catch2 target
Gulin7 Nov 27, 2024
77beaf2
Modified the CI github action files
Gulin7 Nov 27, 2024
afa5943
Port test_algorithm.cpp from Doctest to Catch2
Gulin7 Nov 27, 2024
3f06a72
Fixed according to comments
Gulin7 Nov 27, 2024
1aaf166
Fix build
Gulin7 Nov 27, 2024
661ee39
Change target_link_libraries for Catch2
Gulin7 Nov 27, 2024
882391f
Remove target_compile_definitions
Gulin7 Nov 27, 2024
39981ff
Fix MSCV compiler issue
Gulin7 Nov 28, 2024
d9fd4a8
Force build type to release
Gulin7 Nov 28, 2024
14d1739
Modified test CMakeList
Gulin7 Nov 28, 2024
727bfd4
Enforce Catch2 version and apply ITERATOR_DEBUG_LEVEL
Gulin7 Dec 4, 2024
fd56cf7
Add builtin-baseline to vcpkg.json
Gulin7 Dec 4, 2024
211ccef
Fetch catch2 repository for exotic architectures
Alex-PLACET Dec 10, 2024
6566ae7
Reformat conda environment-dev.yml
Alex-PLACET Dec 10, 2024
268d2f0
Try fix vcpkg
Alex-PLACET Dec 10, 2024
a60d50c
Try fix vcpkg
Alex-PLACET Dec 10, 2024
3065411
Try fix
Alex-PLACET Dec 10, 2024
83cc0c1
Fix
Alex-PLACET Dec 10, 2024
22a7e78
Try fix
Alex-PLACET Dec 11, 2024
8b44df8
Try fix
Alex-PLACET Dec 11, 2024
11c48c8
WIP
Alex-PLACET Dec 11, 2024
9d63af9
Fix
Alex-PLACET Dec 11, 2024
ba97333
Fix test report paths for upload
Alex-PLACET Dec 11, 2024
2989f09
Fix
Alex-PLACET Dec 11, 2024
440154c
Fix
Alex-PLACET Dec 11, 2024
b3a1827
Add CMake option to get dependencies
Alex-PLACET Dec 11, 2024
45d0765
Try fix
Alex-PLACET Dec 11, 2024
b883e4d
Try fix install
Alex-PLACET Dec 11, 2024
9968218
Try fix
Alex-PLACET Dec 11, 2024
1230b91
Try fix
Alex-PLACET Dec 11, 2024
2016b86
Try fix
Alex-PLACET Dec 11, 2024
c6558b8
Fix
Alex-PLACET Dec 11, 2024
1a71f39
Improvements
Alex-PLACET Dec 12, 2024
aff8303
Move FETCH_DEPENDENCIES_WITH_CMAKE option to test CmakeLists.txt
Alex-PLACET Dec 17, 2024
2683b29
Fix
Alex-PLACET Dec 17, 2024
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
28 changes: 8 additions & 20 deletions .github/workflows/analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults:
shell: bash -e -l {0}
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Install LLVM and Clang
Expand All @@ -19,12 +19,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout nanoarrow
uses: actions/checkout@v4
with:
repository: apache/arrow-nanoarrow
path: dependencies/tests/nanoarrow

- name: Set conda environment
uses: mamba-org/setup-micromamba@main
with:
Expand All @@ -33,21 +27,15 @@ jobs:
init-shell: bash
cache-downloads: true

- name: Configure nanoarrow
working-directory: dependencies/tests/nanoarrow
- name: Configure using CMake
run: |
cmake -G Ninja \
-Bbuild \
${{matrix.sys.config-flags}} \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX

- name: Build nanoarrow
working-directory: dependencies/tests/nanoarrow/build
run: cmake --build . --config Release --target install

- name: Configure using CMake
run: cmake -G Ninja -Bbuild -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DBUILD_TESTS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-Bbuild \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DBUILD_TESTS=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING

- name: Run C++ analysis
uses: cpp-linter/cpp-linter-action@v2
Expand Down
29 changes: 6 additions & 23 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout nanoarrow
uses: actions/checkout@v4
with:
repository: apache/arrow-nanoarrow
path: dependencies/tests/nanoarrow

- name: Set conda environment
uses: mamba-org/setup-micromamba@main
with:
Expand All @@ -73,21 +67,6 @@ jobs:
init-shell: bash
cache-downloads: true

- name: Configure nanoarrow
working-directory: dependencies/tests/nanoarrow
run: |
cmake -G Ninja \
-Bbuild \
${{matrix.sys.config-flags}} \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache

- name: Build nanoarrow
working-directory: dependencies/tests/nanoarrow/build
run: cmake --build . --config ${{matrix.config.name}} --target install

- name: Configure using CMake
run: |
cmake -G Ninja \
Expand All @@ -98,7 +77,8 @@ jobs:
-DBUILD_TESTS=ON \
-DBUILD_EXAMPLES=ON \
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING

- name: Build library
working-directory: build
Expand All @@ -125,7 +105,10 @@ jobs:
if: success() || failure()
with:
name: test_sparrow_lib_report_Linux_${{ matrix.sys.compiler }}_${{ matrix.sys.version }}_${{ matrix.sys.stdlib }}_${{ matrix.config.name }}_date-polyfill_${{ matrix.sys.date-polyfill}}
path: '**/test_sparrow_lib_report.xml'
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
if-no-files-found: error

- name: Run all examples
working-directory: build
Expand Down
21 changes: 5 additions & 16 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout nanoarrow
uses: actions/checkout@v4
with:
repository: apache/arrow-nanoarrow
path: dependencies/tests/nanoarrow

- name: ccache
uses: hendrikmuhs/[email protected]
with:
Expand Down Expand Up @@ -74,14 +68,6 @@ jobs:
echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV
echo "CMAKE_CXX_COMPILER=/usr/bin/clang++" >> $GITHUB_ENV

- name: Configure nanoarrow
working-directory: dependencies/tests/nanoarrow
run: cmake -Bbuild -DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX

- name: Build nanoarrow
working-directory: dependencies/tests/nanoarrow/build
run: cmake --build . --config ${{matrix.config.name}} --target install

- name: Configure using CMake
run: |
cmake -Bbuild \
Expand All @@ -91,7 +77,7 @@ jobs:
-DBUILD_EXAMPLES=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-Dnanoarrow_DIR=dependencies/tests/nanoarrow/build
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING

- name: Build
working-directory: build
Expand All @@ -114,7 +100,10 @@ jobs:
if: success() || failure()
with:
name: test_sparrow_lib_report_OSX_${{ matrix.os }}_${{ matrix.config.name }}_${{ matrix.compiler }}
path: '**/test_sparrow_lib_report.xml'
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
if-no-files-found: error

- name: Run all examples
working-directory: build
Expand Down
28 changes: 6 additions & 22 deletions .github/workflows/qemu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout nanoarrow
uses: actions/checkout@v4
with:
repository: apache/arrow-nanoarrow
path: dependencies/tests/nanoarrow

- name: Get current date
id: date
uses: Kaven-Universe/github-action-current-date-time@v1
Expand Down Expand Up @@ -104,28 +98,16 @@ jobs:
export CC
CXX=g++
export CXX
ROOT_DIR="${PWD}"
export ROOT_DIR
echo "Configure nanoarrow"
cd dependencies/tests/nanoarrow
cmake -G Ninja -B ./build \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_COMPILE_WARNING_AS_ERROR=FALSE \
-DCMAKE_C_STANDARD=17
echo "Build nanoarrow"
cmake --build ./build --target install
echo "Configuring sparrow"
cd $ROOT_DIR
cmake -G Ninja -Bbuild \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.config.name}} \
-DUSE_DATE_POLYFILL=${{matrix.target.date-polyfill}} \
-DBUILD_TESTS=ON \
-DBUILD_EXAMPLES=ON \
-DUSE_LARGE_INT_PLACEHOLDERS=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING
cd build
echo "Building sparrow library"
cmake --build . --config ${{matrix.config.name}} --target sparrow
Expand All @@ -136,11 +118,13 @@ jobs:
echo "Running sparrow tests"
cmake --build . --config ${{matrix.config.name}} --target run_tests_with_junit_report
ccache --show-stats


- name: Upload test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test_sparrow_lib_report_Linux_${{matrix.target.distro}}_${{matrix.target.arch}}_${{matrix.config.name}}_date-polyfill_${{matrix.target.date-polyfill}}
path: '**/test_sparrow_lib_report.xml'
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
if-no-files-found: error
33 changes: 7 additions & 26 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout nanoarrow
uses: actions/checkout@v4
with:
repository: apache/arrow-nanoarrow
path: dependencies/tests/nanoarrow

- name: ccache
uses: hendrikmuhs/[email protected]
with:
Expand All @@ -124,7 +118,7 @@ jobs:
run: |
echo "SPARROW_DEPS_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
echo "SPARROW_INSTALL_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
echo "SPARROW_ADDITIONAL_OPTIONS=-DSPARROW_TARGET_32BIT=OFF" >> $GITHUB_ENV
echo "SPARROW_ADDITIONAL_OPTIONS=-DSPARROW_TARGET_32BIT=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL" >> $GITHUB_ENV


- name: Set dependencies install prefix dir for 32bit
Expand All @@ -133,6 +127,7 @@ jobs:
echo "SPARROW_DEPS_PREFIX=$VCPKG_INSTALLED_DIR" >> $GITHUB_ENV
echo "SPARROW_INSTALL_PREFIX=${{ github.workspace }}/install" >> $GITHUB_ENV
echo "VCPKG_TARGET_TRIPLET='x86-windows'" >> $GITHUB_ENV
echo "VCPKG_BUILD_TYPE='Release'" >> $GITHUB_ENV
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To remove

echo "CMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV
echo "SPARROW_ADDITIONAL_OPTIONS=-DSPARROW_TARGET_32BIT=ON" >> $GITHUB_ENV
choco install ninja
Expand All @@ -150,23 +145,6 @@ jobs:
run: |
echo "CMAKE_GENERATOR=${{ matrix.build-system.name }}" >> $GITHUB_ENV

- name: Configure nanoarrow
working-directory: dependencies/tests/nanoarrow
run: |
cmake -S ./ \
-B ./build \
$GENERATOR_EXTRA_FLAGS \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_PREFIX_PATH=$SPARROW_DEPS_PREFIX \
-DCMAKE_INSTALL_PREFIX=$SPARROW_INSTALL_PREFIX \
-DCMAKE_COMPILE_WARNING_AS_ERROR=FALSE

- name: Build nanoarrow
working-directory: dependencies/tests/nanoarrow/build
run: cmake --build . --config Release --target install

- name: Configure using CMake
run: |
cmake -S ./ -B ./build \
Expand All @@ -182,7 +160,7 @@ jobs:
$SPARROW_ADDITIONAL_OPTIONS \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING

- name: Build library
working-directory: build
Expand All @@ -205,7 +183,10 @@ jobs:
if: success() || failure()
with:
name: test_sparrow_lib_report_Windows_${{ matrix.toolchain.compiler }}_${{ matrix.build-system.name }}_${{ matrix.config.name }}_${{ matrix.target-arch.name }}_date-polyfill_${{ matrix.toolchain.date-polyfill}}
path: '**/test_sparrow_lib_report.xml'
path: |
build/test/test_sparrow_lib_report_doctest.xml
build/test/test_sparrow_lib_report_catch2.xml
if-no-files-found: error

- name: Run all examples
working-directory: build
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.22)
cmake_minimum_required(VERSION 3.28)

# This is better specified per target, but cmake keeps ignoring these language version
# specification when building this project by itself, in particular the gnu extensions,
Expand Down Expand Up @@ -87,7 +87,6 @@ OPTION(BUILD_DOCS "Build sparrow documentation" OFF)
OPTION(BUILD_EXAMPLES "Build sparrow examples" OFF)
OPTION(USE_DATE_POLYFILL "Use date polyfill implementation" ON)
OPTION(USE_LARGE_INT_PLACEHOLDERS "use types without api for big integers" OFF)

OPTION(SPARROW_TARGET_32BIT "Test 32bit support" OFF)

include(CheckCXXSymbolExists)
Expand Down
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def requirements(self):
if self.options.get_safe("use_date_polyfill"):
self.requires("date/3.0.1#032e24ad8bd1fd136dd33c932563d3d1")
self.test_requires("doctest/2.4.11")
self.test_requires("catch2/3.7.0")

def build_requirements(self):
if self.options.get_safe("generate_documentation"):
Expand Down
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dependencies:
- ninja
# Tests
- doctest
- catch2
# P0355R7 (Extending chrono to Calendars and Time Zones) has not been entirely implemented in libc++ yet.
# See: https://libcxx.llvm.org/Status/Cxx20.html#note-p0355
# For now, we use HowardHinnant/date as a replacement if we are compiling with libc++.
Expand Down
Loading
Loading