Skip to content

Commit 13a8df7

Browse files
committed
Simplify 'add_ydb_multiple_tests' command again
1 parent 71f2646 commit 13a8df7

File tree

2 files changed

+17
-37
lines changed

2 files changed

+17
-37
lines changed

cmake/testing.cmake

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,12 @@ function(add_ydb_test)
151151
vcs_info(${YDB_TEST_NAME})
152152
endfunction()
153153

154-
#[=============================================================================[
155-
This wrapper over `add_ydb_test` adds a separate test for each test file in
156-
FILES list. Mandatory PREFIX will prepend the test name. If test files have
157-
a relative path, their paths will be prepended by CMAKE_CURRENT_SOURCE_DIR.
158-
All other parameters of `add_ydb_test` except NAME and SOURCES are passed
159-
after ADD_YDB_TEST_ARGS keyword.
160-
#]=============================================================================]
154+
# This wrapper over `add_ydb_test` adds a separate test for each test file in
155+
# FILES list. Mandatory PREFIX will prepend the test name.
161156
function(add_ydb_multiple_tests)
162-
set(opts "")
157+
set(opts GTEST)
163158
set(oneval_args PREFIX)
164-
set(multival_args FILES ADD_YDB_TEST_ARGS)
159+
set(multival_args FILES INCLUDE_DIRS LINK_LIBRARIES LABELS)
165160
cmake_parse_arguments(ARGS
166161
"${opts}"
167162
"${oneval_args}"
@@ -177,17 +172,18 @@ function(add_ydb_multiple_tests)
177172
message(FATAL_ERROR "Missing the FILES list.")
178173
endif()
179174

175+
if (ARGS_GTEST)
176+
set(ARGS_GTEST "GTEST")
177+
endif()
178+
180179
foreach (testPath IN LISTS ARGS_FILES)
181180
get_filename_component(testSuffix "${testPath}" NAME_WLE)
182-
183-
if (NOT IS_ABSOLUTE "${testPath}")
184-
set(testPath "${CMAKE_CURRENT_SOURCE_DIR}/${testPath}")
185-
endif()
186-
187-
add_ydb_test(NAME "${ARGS_PREFIX}-${testSuffix}"
181+
add_ydb_test(NAME "${ARGS_PREFIX}-${testSuffix}" ${ARGS_GTEST}
188182
SOURCES
189183
"${testPath}"
190-
${ARGS_ADD_YDB_TEST_ARGS}
184+
INCLUDE_DIRS ${ARGS_INCLUDE_DIRS}
185+
LINK_LIBRARIES ${ARGS_LINK_LIBRARIES}
186+
LABELS ${ARGS_LABELS}
191187
)
192188
endforeach()
193189
endfunction()

util/CMakeLists.txt

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ if (YDB_SDK_TESTS)
1010
datetime/parser_ut.cpp
1111
datetime/process_uptime_ut.cpp
1212
datetime/uptime_ut.cpp
13-
ADD_YDB_TEST_ARGS
1413
LINK_LIBRARIES
1514
yutil
1615
cpp-testing-unittest_main
@@ -25,7 +24,6 @@ if (YDB_SDK_TESTS)
2524
digest/multi_ut.cpp
2625
digest/murmur_ut.cpp
2726
digest/sequence_ut.cpp
28-
ADD_YDB_TEST_ARGS
2927
LINK_LIBRARIES
3028
yutil
3129
cpp-testing-unittest_main
@@ -41,7 +39,6 @@ if (YDB_SDK_TESTS)
4139
folder/iterator_ut.cpp
4240
folder/path_ut.cpp
4341
folder/pathsplit_ut.cpp
44-
ADD_YDB_TEST_ARGS
4542
LINK_LIBRARIES
4643
yutil
4744
cpp-testing-unittest_main
@@ -91,8 +88,7 @@ if (YDB_SDK_TESTS)
9188
generic/stack_ut.cpp
9289
generic/store_policy_ut.cpp
9390
generic/strbuf_ut.cpp
94-
# See fix/util-unit-tests branch
95-
# generic/string_transparent_hash_ut.cpp
91+
generic/string_transparent_hash_ut.cpp
9692
generic/string_ut.cpp
9793
generic/typelist_ut.cpp
9894
generic/typetraits_ut.cpp
@@ -102,7 +98,6 @@ if (YDB_SDK_TESTS)
10298
generic/xrange_ut.cpp
10399
generic/ylimits_ut.cpp
104100
generic/ymath_ut.cpp
105-
ADD_YDB_TEST_ARGS
106101
LINK_LIBRARIES
107102
yutil
108103
cpp-testing-unittest_main
@@ -135,7 +130,6 @@ if (YDB_SDK_TESTS)
135130
memory/pool_ut.cpp
136131
memory/smallobj_ut.cpp
137132
memory/tempbuf_ut.cpp
138-
ADD_YDB_TEST_ARGS
139133
LINK_LIBRARIES
140134
yutil
141135
cpp-testing-unittest_main
@@ -151,7 +145,6 @@ if (YDB_SDK_TESTS)
151145
network/poller_ut.cpp
152146
network/sock_ut.cpp
153147
network/socket_ut.cpp
154-
ADD_YDB_TEST_ARGS
155148
LINK_LIBRARIES
156149
yutil
157150
cpp-testing-unittest_main
@@ -162,16 +155,14 @@ if (YDB_SDK_TESTS)
162155

163156
add_ydb_multiple_tests(PREFIX util-random
164157
FILES
165-
# See fix/util-unit-tests branch
166-
# random/common_ops_ut.cpp
158+
random/common_ops_ut.cpp
167159
random/easy_ut.cpp
168160
random/entropy_ut.cpp
169161
random/fast_ut.cpp
170162
random/mersenne_ut.cpp
171163
random/normal_ut.cpp
172164
random/random_ut.cpp
173165
random/shuffle_ut.cpp
174-
ADD_YDB_TEST_ARGS
175166
LINK_LIBRARIES
176167
yutil
177168
cpp-testing-unittest_main
@@ -201,7 +192,6 @@ if (YDB_SDK_TESTS)
201192
stream/walk_ut.cpp
202193
stream/zerocopy_output_ut.cpp
203194
stream/zlib_ut.cpp
204-
ADD_YDB_TEST_ARGS
205195
LINK_LIBRARIES
206196
yutil
207197
cpp-testing-unittest_main
@@ -225,7 +215,6 @@ if (YDB_SDK_TESTS)
225215
string/type_ut.cpp
226216
string/util_ut.cpp
227217
string/vector_ut.cpp
228-
ADD_YDB_TEST_ARGS
229218
LINK_LIBRARIES
230219
yutil
231220
cpp-testing-unittest_main
@@ -246,17 +235,15 @@ if (YDB_SDK_TESTS)
246235
system/cpu_id_ut.cpp
247236
system/daemon_ut.cpp
248237
system/datetime_ut.cpp
249-
# See fix/util-unit-tests branch
250-
# system/direct_io_ut.cpp
238+
system/direct_io_ut.cpp
251239
system/env_ut.cpp
252240
system/error_ut.cpp
253241
system/event_ut.cpp
254242
system/execpath_ut.cpp
255243
system/filemap_ut.cpp
256244
system/file_ut.cpp
257245
system/flock_ut.cpp
258-
# See fix/util-unit-tests branch
259-
# system/fstat_ut.cpp
246+
system/fstat_ut.cpp
260247
system/fs_ut.cpp
261248
system/getpid_ut.cpp
262249
system/guard_ut.cpp
@@ -281,15 +268,13 @@ if (YDB_SDK_TESTS)
281268
system/src_root_ut.cpp
282269
system/tempfile_ut.cpp
283270
system/tls_ut.cpp
284-
# See fix/util-unit-tests branch
285-
# system/type_name_ut.cpp
271+
system/type_name_ut.cpp
286272
system/types_ut.cpp
287273
# TODO: add library/cpp/testing/benchmark
288274
# depends only on NBench::Clobber, that's a memory optimization barrier
289275
# system/unaligned_mem_ut.cpp
290276
system/user_ut.cpp
291277
system/yassert_ut.cpp
292-
ADD_YDB_TEST_ARGS
293278
LINK_LIBRARIES
294279
yutil
295280
cpp-testing-unittest_main
@@ -332,7 +317,6 @@ if (YDB_SDK_TESTS)
332317
thread/lfstack_ut.cpp
333318
thread/pool_ut.cpp
334319
thread/singleton_ut.cpp
335-
ADD_YDB_TEST_ARGS
336320
LINK_LIBRARIES
337321
yutil
338322
cpp-testing-unittest_main

0 commit comments

Comments
 (0)