Move generic VOL wrapper creation into helper #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test Multithreaded HDF5 | |
on: | |
push: | |
branches: | |
- '*' | |
env: | |
HDF5TestExpress: 1 | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
build_system: ["autotools", "cmake"] | |
api_tests_enabled: [true, false] | |
thread_build: ["multithread", "threadsafe", "singlethread"] | |
build_mode: ["production", "debug"] | |
include: | |
# Non-multi thread library builds should only run non-threaded | |
- multi_thread: "threadsafe" | |
test_thread_counts: 0 | |
connector_stacks: | |
- "" | |
- "pass_through under_vol=0\\;under_info={}" | |
- multi_thread: "singlethread" | |
test_thread_counts: 0 | |
connector_stacks: | |
- "" | |
- "pass_through under_vol=0\\;under_info={}" | |
# Only multi-threaded builds should run with -maxthreads (>0) or the MT wrapper connectors | |
- multi_thread: "--enable-multithread --disable-hl" | |
test_thread_counts: 0 1 16 | |
connector_stacks: | |
- "" # Native | |
- "mt_native_wrapper_vol_connector" # MT Native Wrapper | |
- "pass_through under_vol=0\\;under_info={}" # Passthru -> Native | |
- "pass_through under_vol=162\\;under_info={}" # Passthru -> MT Native Wrapper | |
- "mt_passthru_wrapper_vol_connector under_vol=0\\;under_info={}" # MT Passthru -> Native | |
- "mt_passthru_wrapper_vol_connector under_vol=162\\;under_info={}" # MT Passthru -> MT Native Wrapper | |
- "pass_through under_vol=163\\;under_info={under_vol=0\\;under_info={}}" # Passthru -> MT Passthru -> Native | |
- "pass_through under_vol=163\\;under_info={under_vol=162\\;under_info={}}" # Passthru -> MT Passthru -> MT Native Wrapper | |
- "mt_passthru_wrapper_vol_connector under_vol=1\\;under_info={under_vol=0\\;under_info={}}" # MT Passthru -> Passthru -> Native | |
- "mt_passthru_wrapper_vol_connector under_vol=1\\;under_info={under_vol=162\\;under_info={}}" # MT Passthru -> Passthru -> MT Native Wrapper | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up autotools | |
if: matrix.build_system == 'autotools' | |
run: | | |
sudo apt install automake autoconf libtool libtool-bin | |
sudo apt install libaec0 libaec-dev valgrind | |
- name: Configure HDF5 (Autotools) | |
if: matrix.build_system == 'autotools' | |
working-directory: ${{github.workspace}} | |
run: | | |
HDF5_ENABLE_API_TESTS=$([[ "${{ matrix.api_tests_enabled }}" == "true" ]] && echo "--enable-api-tests" || echo "--disable-api-tests") | |
HDF5_MULTITHREAD=$([[ "${{ matrix.thread_build }}" == "multithread" ]] && echo "--enable-multithread" || echo "--disable-multithread") | |
HDF5_THREADSAFE=$([[ "${{ matrix.thread_build }}" == "threadsafe" ]] && echo "--enable-threadsafe" || echo "--disable-threadsafe") | |
sh ./autogen.sh | |
./configure --enable-shared --enable-tests --disable-hl $HDF5_THREADSAFE $HDF5_MULTITHREAD $HDF5_ENABLE_API_TESTS --enable-build-mode=${{ matrix.build_mode }} | |
- name: Build HDF5 (Autotools) | |
if: matrix.build_system == 'autotools' | |
working-directory: ${{github.workspace}} | |
run: | | |
make -j | |
- name: Configure HDF5 (CMake) | |
if: matrix.build_system == 'cmake' | |
working-directory: ${{github.workspace}} | |
run: | | |
# Deal with different arguments in CMake vs Autotools | |
HDF5_BUILD_TYPE=$([[ "${{ matrix.build_mode }}" == "debug" ]] && echo "Debug" || echo "Release") | |
HDF5_ENABLE_MULTITHREAD=$([[ "${{ matrix.thread_build }}" == "multithread" ]] && echo "ON" || echo "OFF") | |
HDF5_ENABLE_THREADSAFE=$([[ "${{ matrix.thread_build }}" == "threadsafe" ]] && echo "ON" || echo "OFF") | |
HDF5_TEST_API=$([[ "${{ matrix.api_tests_enabled }}" == "true" ]] && echo "ON" || echo "OFF") | |
sudo apt install cmake | |
mkdir build | |
cd build | |
cmake --log-level=VERBOSE \ | |
-DBUILD_SHARED_LIBS:BOOL=ON \ | |
-DHDF5_ENABLE_TESTS=ON \ | |
-HDF5_BUILD_HL_LIB:BOOL=OFF \ | |
-DHDF5_BUILD_TYPE=$HDF5_BUILD_TYPE \ | |
-DHDF5_ENABLE_THREADSAFE:BOOL=$HDF5_ENABLE_THREADSAFE \ | |
-DHDF5_ENABLE_MULTITHREAD:BOOL=$HDF5_ENABLE_MULTITHREAD \ | |
-DHDF5_TEST_API=$HDF5_TEST_API \ | |
.. | |
- name: Build HDF5 (CMake) | |
if: matrix.build_system == 'cmake' | |
working-directory: ${{github.workspace}}/build | |
run: | | |
HDF5_BUILD_TYPE=$([[ "${{ matrix.build_mode }}" == "debug" ]] && echo "Debug" || echo "Release") | |
cmake --build . -j --config $HDF5_BUILD_TYPE | |
- name: API Tests | |
if: matrix.api_tests_enabled == true | |
working-directory: ${{github.workspace}} | |
run: | | |
failure=0 | |
CONNECTOR_STACKS='${{ toJson(matrix.connector_stacks) }}' | |
if [[ "${{ matrix.build_system }}" == "autotools" ]]; then | |
API_TEST_COMMAND="valgrind ./test/API/h5_api_test" | |
else | |
cd build | |
API_TEST_COMMAND="valgrind ctest -N -R 'h5_api_test'" | |
fi | |
echo "$CONNECTOR_STACKS" | jq -r '.[]' | while IFS= read -r connector_stack; do | |
if [ -n "$connector_stack" ]; then | |
HDF5_PLUGIN_PATH=${{github.workspace}}/test/.libs | |
HDF5_VOL_CONNECTOR=$connector_stack | |
fi | |
for num_threads in ${{ matrix.test_thread_counts }}; do | |
echo "::group:: API Tests with $num_threads threads, HDF5_VOL_CONNECTOR=$connector_stack" | |
if [ "$num_threads" == "0" ]; then | |
eval "$API_TEST_COMMAND" || failure=1 | |
else | |
eval "$API_TEST_COMMAND" -maxthreads $num_threads || failure=1 | |
fi | |
echo "::endgroup::" | |
done | |
done | |
# Fail the step if any test failed | |
if [ $failure -ne 0 ]; then | |
echo "Some tests failed. Exiting with error." | |
exit 1 | |
fi | |
- name: MT VL Tests | |
if: matrix.thread_build == 'multithread' | |
working-directory: ${{github.workspace}}/test/ | |
run: | | |
failure=0 | |
CONNECTOR_STACKS='${{ toJson(matrix.connector_stacks) }}' | |
if [[ "${{ matrix.build_system }}" == "autotools" ]]; then | |
MT_VL_TEST_COMMAND="valgrind ./threads/testmthdf5" | |
else | |
MT_VL_TEST_COMMAND="valgrind ctest -R 'testmthdf5'" | |
fi | |
echo "$CONNECTOR_STACKS" | jq -r '.[]' | while IFS= read -r connector_stack; do | |
if [ -n "$connector_stack" ]; then | |
HDF5_PLUGIN_PATH=${{github.workspace}}/test/.libs | |
HDF5_VOL_CONNECTOR=$connector_stack | |
fi | |
for num_threads in ${{ matrix.test_thread_counts }}; do | |
echo "::group:: MT HDF5 Tests with $num_threads, HDF5_VOL_CONNECTOR=$connector_stack" | |
if [ "$num_threads" == "0" ]; then | |
eval "$MT_VL_TEST_COMMAND" || failure=1 | |
else | |
eval "$MT_VL_TEST_COMMAND" -maxthreads $num_threads || failure=1 | |
fi | |
echo "::endgroup::" | |
done | |
done | |
# Fail the step if any test failed | |
if [ $failure -ne 0 ]; then | |
echo "Some tests failed. Exiting with error." | |
exit 1 | |
fi | |
- name: Other HDF5 Tests (Native Only, Autotools) | |
if: matrix.build_system == 'autotools' | |
working-directory: ${{github.workspace}} | |
run: | | |
unset HDF5_VOL_CONNECTOR | |
make check | |
- name: Other HDF5 Tests (Native Only, CMake) | |
if: matrix.build_system == 'cmake' | |
working-directory: ${{github.workspace}}/build | |
run: | | |
unset HDF5_VOL_CONNECTOR | |
ctest -V -E "h5_api_test" |