Skip to content

Commit 5e90721

Browse files
committed
cmake: add functional tests
Signed-off-by: Pablo de Lara <[email protected]>
1 parent 612c210 commit 5e90721

File tree

6 files changed

+126
-0
lines changed

6 files changed

+126
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "
3838
enable_language(ASM_NASM)
3939
endif()
4040

41+
# Enable testing
42+
option(BUILD_TESTS "Build the testing tree" ON)
43+
if(BUILD_TESTS)
44+
enable_testing()
45+
include(CTest)
46+
endif()
47+
4148
# Set default build type
4249
if(NOT CMAKE_BUILD_TYPE)
4350
set(CMAKE_BUILD_TYPE Release)

cmake/crc.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,22 @@ set(CRC_HEADERS
118118

119119
# Add to main extern headers list
120120
list(APPEND EXTERN_HEADERS ${CRC_HEADERS})
121+
122+
# Add test applications for crc module
123+
if(BUILD_TESTS)
124+
# Check tests (unit tests that are run by CTest)
125+
set(CRC_CHECK_TESTS
126+
crc16_t10dif_test
127+
crc16_t10dif_copy_test
128+
crc64_funcs_test
129+
crc32_funcs_test
130+
)
131+
132+
# Create check test executables
133+
foreach(test ${CRC_CHECK_TESTS})
134+
add_executable(${test} crc/${test}.c)
135+
target_link_libraries(${test} PRIVATE isal)
136+
target_include_directories(${test} PRIVATE include)
137+
add_test(NAME ${test} COMMAND ${test})
138+
endforeach()
139+
endif()

cmake/erasure_code.cmake

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,50 @@ set(ERASURE_CODE_HEADERS
191191

192192
# Add to main extern headers list
193193
list(APPEND EXTERN_HEADERS ${ERASURE_CODE_HEADERS})
194+
195+
# Add test applications for erasure_code module
196+
if(BUILD_TESTS)
197+
# Check tests (unit tests that are run by CTest)
198+
set(ERASURE_CODE_CHECK_TESTS
199+
gf_vect_mul_test
200+
erasure_code_test
201+
gf_inverse_test
202+
erasure_code_update_test
203+
)
204+
205+
# Unit tests (additional unit tests)
206+
set(ERASURE_CODE_UNIT_TESTS
207+
gf_vect_mul_base_test
208+
gf_vect_dot_prod_base_test
209+
gf_vect_dot_prod_test
210+
gf_vect_mad_test
211+
erasure_code_base_test
212+
)
213+
214+
# Other tests
215+
set(ERASURE_CODE_OTHER_TESTS
216+
gen_rs_matrix_limits
217+
)
218+
219+
# Create check test executables
220+
foreach(test ${ERASURE_CODE_CHECK_TESTS})
221+
add_executable(${test} erasure_code/${test}.c)
222+
target_link_libraries(${test} PRIVATE isal)
223+
target_include_directories(${test} PRIVATE include)
224+
add_test(NAME ${test} COMMAND ${test})
225+
endforeach()
226+
227+
# Create unit test executables
228+
foreach(test ${ERASURE_CODE_UNIT_TESTS})
229+
add_executable(${test} erasure_code/${test}.c)
230+
target_link_libraries(${test} PRIVATE isal)
231+
target_include_directories(${test} PRIVATE include)
232+
endforeach()
233+
234+
# Create other test executables
235+
foreach(test ${ERASURE_CODE_OTHER_TESTS})
236+
add_executable(${test} erasure_code/${test}.c)
237+
target_link_libraries(${test} PRIVATE isal)
238+
target_include_directories(${test} PRIVATE include)
239+
endforeach()
240+
endif()

cmake/igzip.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,21 @@ set(IGZIP_HEADERS
115115

116116
# Add to main extern headers list
117117
list(APPEND EXTERN_HEADERS ${IGZIP_HEADERS})
118+
119+
# Add test applications for igzip module
120+
if(BUILD_TESTS)
121+
# Check tests (unit tests that are run by CTest)
122+
set(IGZIP_CHECK_TESTS
123+
igzip_rand_test
124+
igzip_wrapper_hdr_test
125+
checksum32_funcs_test
126+
)
127+
128+
# Create check test executables
129+
foreach(test ${IGZIP_CHECK_TESTS})
130+
add_executable(${test} igzip/${test}.c)
131+
target_link_libraries(${test} PRIVATE isal)
132+
target_include_directories(${test} PRIVATE include igzip)
133+
add_test(NAME ${test} COMMAND ${test})
134+
endforeach()
135+
endif()

cmake/mem.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,19 @@ set(MEM_HEADERS
7676

7777
# Add to main extern headers list
7878
list(APPEND EXTERN_HEADERS ${MEM_HEADERS})
79+
80+
# Add test applications for mem module
81+
if(BUILD_TESTS)
82+
# Check tests (unit tests that are run by CTest)
83+
set(MEM_CHECK_TESTS
84+
mem_zero_detect_test
85+
)
86+
87+
# Create check test executables
88+
foreach(test ${MEM_CHECK_TESTS})
89+
add_executable(${test} mem/${test}.c)
90+
target_link_libraries(${test} PRIVATE isal)
91+
target_include_directories(${test} PRIVATE include)
92+
add_test(NAME ${test} COMMAND ${test})
93+
endforeach()
94+
endif()

cmake/raid.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,22 @@ set(RAID_HEADERS
8989

9090
# Add to main extern headers list
9191
list(APPEND EXTERN_HEADERS ${RAID_HEADERS})
92+
93+
# Add test applications for raid module
94+
if(BUILD_TESTS)
95+
# Check tests (unit tests that are run by CTest)
96+
set(RAID_CHECK_TESTS
97+
xor_gen_test
98+
pq_gen_test
99+
xor_check_test
100+
pq_check_test
101+
)
102+
103+
# Create check test executables
104+
foreach(test ${RAID_CHECK_TESTS})
105+
add_executable(${test} raid/${test}.c)
106+
target_link_libraries(${test} PRIVATE isal)
107+
target_include_directories(${test} PRIVATE include)
108+
add_test(NAME ${test} COMMAND ${test})
109+
endforeach()
110+
endif()

0 commit comments

Comments
 (0)