summaryrefslogtreecommitdiffstats
path: root/src/test/librbd/CMakeLists.txt
blob: 6d8371fd22f68d5fb042e121f8409a22db2dda73 (plain)
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
set(librbd_test_support_srcs
  test_support.cc
  )
add_library(rbd_test_support STATIC ${librbd_test_support_srcs})
target_link_libraries(rbd_test_support PRIVATE
  GTest::GTest)

set(librbd_test
  test_fixture.cc
  test_librbd.cc
  test_ImageWatcher.cc
  test_internal.cc
  test_mirroring.cc
  test_BlockGuard.cc
  test_DeepCopy.cc
  test_Groups.cc
  test_Migration.cc
  test_MirroringWatcher.cc
  test_ObjectMap.cc
  test_Operations.cc
  test_Trash.cc
  journal/test_Entries.cc
  journal/test_Replay.cc)
add_library(rbd_test STATIC ${librbd_test})
target_link_libraries(rbd_test PRIVATE
  rbd_test_support
  radostest
  radostest-cxx
  librados
  Boost::thread
  GMock::GMock
  GTest::GTest)

set(librbd_test_mock_srcs
  mock/MockImageCtx.cc
  mock/MockJournal.cc)
add_library(rbd_test_mock STATIC ${librbd_test_mock_srcs})
target_link_libraries(rbd_test_mock PUBLIC
  GMock::GMock)

# unittest_librbd
# doesn't use add_ceph_test because it is called by run-rbd-unit-tests.sh
set(unittest_librbd_srcs
  test_main.cc
  test_mock_fixture.cc
  test_mock_ConfigWatcher.cc
  test_mock_DeepCopyRequest.cc
  test_mock_ExclusiveLock.cc
  test_mock_Journal.cc
  test_mock_ManagedLock.cc
  test_mock_ObjectMap.cc
  test_mock_TrashWatcher.cc
  test_mock_Watcher.cc
  cache/test_mock_WriteAroundObjectDispatch.cc
  cache/test_mock_ParentCacheObjectDispatch.cc
  crypto/test_mock_BlockCrypto.cc
  crypto/test_mock_CryptoContextPool.cc
  crypto/test_mock_CryptoObjectDispatch.cc
  crypto/test_mock_FormatRequest.cc
  crypto/test_mock_LoadRequest.cc
  crypto/test_mock_ShutDownCryptoRequest.cc
  crypto/openssl/test_DataCryptor.cc
  deep_copy/test_mock_ImageCopyRequest.cc
  deep_copy/test_mock_MetadataCopyRequest.cc
  deep_copy/test_mock_ObjectCopyRequest.cc
  deep_copy/test_mock_SetHeadRequest.cc
  deep_copy/test_mock_SnapshotCopyRequest.cc
  deep_copy/test_mock_SnapshotCreateRequest.cc
  exclusive_lock/test_mock_PreAcquireRequest.cc
  exclusive_lock/test_mock_PostAcquireRequest.cc
  exclusive_lock/test_mock_PreReleaseRequest.cc
  image/test_mock_AttachChildRequest.cc
  image/test_mock_AttachParentRequest.cc
  image/test_mock_CloneRequest.cc
  image/test_mock_DetachChildRequest.cc
  image/test_mock_DetachParentRequest.cc
  image/test_mock_ListWatchersRequest.cc
  image/test_mock_PreRemoveRequest.cc
  image/test_mock_RefreshRequest.cc
  image/test_mock_RemoveRequest.cc
  image/test_mock_ValidatePoolRequest.cc
  io/test_mock_CopyupRequest.cc
  io/test_mock_ImageRequest.cc
  io/test_mock_ObjectRequest.cc
  io/test_mock_SimpleSchedulerObjectDispatch.cc
  journal/test_mock_OpenRequest.cc
  journal/test_mock_PromoteRequest.cc
  journal/test_mock_Replay.cc
  journal/test_mock_ResetRequest.cc
  managed_lock/test_mock_AcquireRequest.cc
  managed_lock/test_mock_BreakRequest.cc
  managed_lock/test_mock_GetLockerRequest.cc
  managed_lock/test_mock_ReacquireRequest.cc
  managed_lock/test_mock_ReleaseRequest.cc
  migration/test_mock_FileStream.cc
  migration/test_mock_HttpClient.cc
  migration/test_mock_HttpStream.cc
  migration/test_mock_RawFormat.cc
  migration/test_mock_RawSnapshot.cc
  migration/test_mock_QCOWFormat.cc
  migration/test_mock_S3Stream.cc
  migration/test_mock_Utils.cc
  mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc
  mirror/snapshot/test_mock_CreatePrimaryRequest.cc
  mirror/snapshot/test_mock_ImageMeta.cc
  mirror/snapshot/test_mock_PromoteRequest.cc
  mirror/snapshot/test_mock_UnlinkPeerRequest.cc
  mirror/snapshot/test_mock_Utils.cc
  mirror/test_mock_DisableRequest.cc
  object_map/test_mock_DiffRequest.cc
  object_map/test_mock_InvalidateRequest.cc
  object_map/test_mock_LockRequest.cc
  object_map/test_mock_RefreshRequest.cc
  object_map/test_mock_ResizeRequest.cc
  object_map/test_mock_SnapshotCreateRequest.cc
  object_map/test_mock_SnapshotRemoveRequest.cc
  object_map/test_mock_SnapshotRollbackRequest.cc
  object_map/test_mock_UnlockRequest.cc
  object_map/test_mock_UpdateRequest.cc
  operation/test_mock_DisableFeaturesRequest.cc
  operation/test_mock_EnableFeaturesRequest.cc
  operation/test_mock_Request.cc
  operation/test_mock_ResizeRequest.cc
  operation/test_mock_SnapshotCreateRequest.cc
  operation/test_mock_SnapshotProtectRequest.cc
  operation/test_mock_SnapshotRemoveRequest.cc
  operation/test_mock_SnapshotRollbackRequest.cc
  operation/test_mock_SnapshotUnprotectRequest.cc
  operation/test_mock_TrimRequest.cc
  trash/test_mock_MoveRequest.cc
  trash/test_mock_RemoveRequest.cc
  watcher/test_mock_RewatchRequest.cc
  )

if(WITH_RBD_RWL OR WITH_RBD_SSD_CACHE)
   list(APPEND unittest_librbd_srcs
     cache/pwl/test_WriteLogMap.cc)
   if(WITH_RBD_RWL)
     list(APPEND unittest_librbd_srcs
       cache/pwl/test_mock_ReplicatedWriteLog.cc)
   endif()
   if(WITH_RBD_SSD_CACHE)
     list(APPEND unittest_librbd_srcs
       cache/pwl/test_mock_SSDWriteLog.cc)
   endif()
endif()

if(LINUX AND HAVE_LIBCRYPTSETUP)
  list(APPEND unittest_librbd_srcs
          crypto/luks/test_mock_FormatRequest.cc
          crypto/luks/test_mock_LoadRequest.cc)
endif()

add_executable(unittest_librbd
  ${unittest_librbd_srcs}
  $<TARGET_OBJECTS:common_texttable_obj>)
target_compile_definitions(unittest_librbd PRIVATE "TEST_LIBRBD_INTERNALS")
add_dependencies(unittest_librbd
  cls_journal
  cls_lock
  cls_rbd)
target_link_libraries(unittest_librbd
  rbd_test
  rbd_api
  rbd_internal
  rbd_test_mock
  journal
  journal_test_mock
  cls_rbd_client
  cls_lock_client
  cls_journal_client
  rbd_types
  rados_test_stub
  librados
  ceph_immutable_object_cache_lib
  osdc
  ceph-common
  global
  OpenSSL::SSL
  ${UNITTEST_LIBS})

if(WITH_RBD_RWL OR WITH_RBD_SSD_CACHE)
  target_link_libraries(unittest_librbd
    librbd_plugin_pwl_cache)
endif()

add_executable(ceph_test_librbd
  test_main.cc
  $<TARGET_OBJECTS:common_texttable_obj>)
target_link_libraries(ceph_test_librbd
  rbd_test
  rbd_api
  rbd_internal
  rbd_types
  journal
  cls_journal_client
  cls_rbd_client
  libneorados
  librados
  ${UNITTEST_LIBS}
  radostest)
target_compile_definitions(ceph_test_librbd PRIVATE "TEST_LIBRBD_INTERNALS")

add_executable(ceph_test_librbd_fsx
  fsx.cc
  $<TARGET_OBJECTS:common_texttable_obj>
  )
target_link_libraries(ceph_test_librbd_fsx
  librbd
  librados
  journal
  global
  m
  ${CMAKE_DL_LIBS}
  ${CRYPTO_LIBS}
  ${EXTRALIBS}
  )
if(WITH_KRBD)
  target_link_libraries(ceph_test_librbd_fsx
    krbd)
endif()
install(TARGETS
  ceph_test_librbd_fsx
  DESTINATION ${CMAKE_INSTALL_BINDIR})

install(TARGETS
  ceph_test_librbd
  DESTINATION ${CMAKE_INSTALL_BINDIR})