forked from HDFGroup/hdf5
-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (167 loc) · 9.23 KB
/
multithread_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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"