couchbase 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/couchbase/CMakeLists.txt +2 -0
- data/ext/couchbase/cmake/ThirdPartyDependencies.cmake +4 -0
- data/ext/couchbase/core/cluster_options.hxx +0 -1
- data/ext/couchbase/core/config_profile.cxx +23 -1
- data/ext/couchbase/core/config_profile.hxx +2 -12
- data/ext/couchbase/core/impl/analytics.cxx +236 -0
- data/ext/couchbase/core/impl/cluster.cxx +0 -1
- data/ext/couchbase/core/impl/dns_srv_tracker.cxx +5 -3
- data/ext/couchbase/core/impl/query.cxx +5 -5
- data/ext/couchbase/core/io/dns_client.cxx +225 -0
- data/ext/couchbase/core/io/dns_client.hxx +19 -188
- data/ext/couchbase/core/transactions/active_transaction_record.hxx +2 -2
- data/ext/couchbase/core/transactions/attempt_context_impl.cxx +3 -0
- data/ext/couchbase/core/transactions/attempt_context_impl.hxx +1 -1
- data/ext/couchbase/core/transactions/internal/transaction_context.hxx +12 -12
- data/ext/couchbase/core/transactions/internal/transactions_cleanup.hxx +7 -1
- data/ext/couchbase/core/transactions/transaction_context.cxx +1 -0
- data/ext/couchbase/core/transactions/transactions_cleanup.cxx +144 -155
- data/ext/couchbase/core/utils/connection_string.cxx +10 -3
- data/ext/couchbase/core/utils/connection_string.hxx +3 -3
- data/ext/couchbase/couchbase/analytics_error_context.hxx +143 -0
- data/ext/couchbase/couchbase/analytics_meta_data.hxx +155 -0
- data/ext/couchbase/couchbase/analytics_metrics.hxx +163 -0
- data/ext/couchbase/couchbase/analytics_options.hxx +359 -0
- data/ext/couchbase/couchbase/analytics_result.hxx +102 -0
- data/ext/couchbase/couchbase/analytics_scan_consistency.hxx +46 -0
- data/ext/couchbase/couchbase/analytics_status.hxx +41 -0
- data/ext/couchbase/couchbase/analytics_warning.hxx +85 -0
- data/ext/couchbase/couchbase/cluster.hxx +33 -0
- data/ext/couchbase/couchbase/fmt/analytics_status.hxx +76 -0
- data/ext/couchbase/couchbase/query_options.hxx +0 -1
- data/ext/couchbase/couchbase/scope.hxx +33 -0
- data/ext/couchbase/couchbase/transactions/attempt_context.hxx +1 -1
- data/ext/couchbase/test/CMakeLists.txt +1 -2
- data/ext/couchbase/test/test_helper.hxx +1 -1
- data/ext/couchbase/test/test_integration_analytics.cxx +289 -13
- data/ext/couchbase/test/test_integration_crud.cxx +8 -1
- data/ext/couchbase/test/test_integration_examples.cxx +41 -0
- data/ext/couchbase/test/test_integration_management.cxx +15 -3
- data/ext/couchbase/test/test_integration_search.cxx +601 -0
- data/ext/couchbase/test/test_transaction_transaction_simple.cxx +73 -0
- data/ext/couchbase/test/test_unit_config_profiles.cxx +12 -12
- data/ext/couchbase/test/test_unit_connection_string.cxx +35 -0
- data/ext/couchbase/third_party/snappy/CMakeLists.txt +150 -27
- data/ext/couchbase/third_party/snappy/cmake/config.h.in +28 -24
- data/ext/couchbase/third_party/snappy/snappy-internal.h +189 -25
- data/ext/couchbase/third_party/snappy/snappy-sinksource.cc +26 -9
- data/ext/couchbase/third_party/snappy/snappy-sinksource.h +11 -11
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.cc +1 -1
- data/ext/couchbase/third_party/snappy/snappy-stubs-internal.h +227 -308
- data/ext/couchbase/third_party/snappy/snappy-stubs-public.h.in +0 -11
- data/ext/couchbase/third_party/snappy/snappy.cc +1176 -410
- data/ext/couchbase/third_party/snappy/snappy.h +19 -4
- data/ext/couchbase.cxx +27 -6
- data/ext/revisions.rb +3 -3
- data/lib/couchbase/cluster.rb +13 -9
- data/lib/couchbase/cluster_registry.rb +7 -2
- data/lib/couchbase/configuration.rb +3 -4
- data/lib/couchbase/options.rb +85 -2
- data/lib/couchbase/search_options.rb +158 -240
- data/lib/couchbase/version.rb +1 -1
- metadata +17 -6
- data/ext/couchbase/core/CMakeLists.txt +0 -0
@@ -52,14 +52,17 @@ TEST_CASE("unit: can apply wan_development profile", "[unit]")
|
|
52
52
|
// for details and latest info on expectations.
|
53
53
|
couchbase::core::cluster_options opts{};
|
54
54
|
opts.apply_profile("wan_development");
|
55
|
-
CHECK(opts.key_value_timeout.count() ==
|
56
|
-
CHECK(opts.key_value_durable_timeout.count() ==
|
57
|
-
CHECK(opts.connect_timeout.count() ==
|
58
|
-
CHECK(opts.view_timeout.count() ==
|
59
|
-
CHECK(opts.query_timeout.count() ==
|
60
|
-
CHECK(opts.analytics_timeout.count() ==
|
61
|
-
CHECK(opts.search_timeout.count() ==
|
62
|
-
CHECK(opts.management_timeout.count() ==
|
55
|
+
CHECK(opts.key_value_timeout.count() == 20'000);
|
56
|
+
CHECK(opts.key_value_durable_timeout.count() == 20'000);
|
57
|
+
CHECK(opts.connect_timeout.count() == 20'000);
|
58
|
+
CHECK(opts.view_timeout.count() == 120'000);
|
59
|
+
CHECK(opts.query_timeout.count() == 120'000);
|
60
|
+
CHECK(opts.analytics_timeout.count() == 120'000);
|
61
|
+
CHECK(opts.search_timeout.count() == 120'000);
|
62
|
+
CHECK(opts.management_timeout.count() == 120'000);
|
63
|
+
CHECK(opts.bootstrap_timeout.count() == 120'000);
|
64
|
+
CHECK(opts.resolve_timeout.count() == 20'000);
|
65
|
+
CHECK(opts.dns_config.timeout().count() == 20'000);
|
63
66
|
}
|
64
67
|
|
65
68
|
TEST_CASE("unit: all other options remain unchanged", "[unit]")
|
@@ -71,11 +74,9 @@ TEST_CASE("unit: all other options remain unchanged", "[unit]")
|
|
71
74
|
// we'd expect default_opts to be equal to opts:
|
72
75
|
CHECK(opts.tracer == default_opts.tracer);
|
73
76
|
CHECK(opts.meter == default_opts.meter);
|
74
|
-
CHECK(opts.bootstrap_timeout == default_opts.bootstrap_timeout);
|
75
77
|
CHECK(opts.config_idle_redial_timeout == default_opts.config_idle_redial_timeout);
|
76
78
|
CHECK(opts.config_poll_floor == default_opts.config_poll_floor);
|
77
79
|
CHECK(opts.config_poll_interval == default_opts.config_poll_interval);
|
78
|
-
CHECK(opts.dns_srv_timeout == default_opts.dns_srv_timeout);
|
79
80
|
CHECK(opts.enable_clustermap_notification == opts.enable_clustermap_notification);
|
80
81
|
CHECK(opts.enable_compression == default_opts.enable_compression);
|
81
82
|
CHECK(opts.enable_dns_srv == default_opts.enable_dns_srv);
|
@@ -88,7 +89,6 @@ TEST_CASE("unit: all other options remain unchanged", "[unit]")
|
|
88
89
|
CHECK(opts.idle_http_connection_timeout == default_opts.idle_http_connection_timeout);
|
89
90
|
CHECK(opts.max_http_connections == default_opts.max_http_connections);
|
90
91
|
CHECK(opts.network == default_opts.network);
|
91
|
-
CHECK(opts.resolve_timeout == default_opts.resolve_timeout);
|
92
92
|
CHECK(opts.show_queries == default_opts.show_queries);
|
93
93
|
CHECK(opts.tcp_keep_alive_interval == default_opts.tcp_keep_alive_interval);
|
94
94
|
CHECK(opts.tls_verify == default_opts.tls_verify);
|
@@ -129,4 +129,4 @@ TEST_CASE("unit: can have profile with constructor args", "[unit]")
|
|
129
129
|
std::string("something_extra"));
|
130
130
|
opts.apply_profile("test_with_args");
|
131
131
|
CHECK(opts.user_agent_extra == "something_extra");
|
132
|
-
}
|
132
|
+
}
|
@@ -52,6 +52,8 @@ TEST_CASE("unit: connection string", "[unit]")
|
|
52
52
|
CHECK(couchbase::core::utils::parse_connection_string("http://127.0.0.1").scheme == "http");
|
53
53
|
CHECK(couchbase::core::utils::parse_connection_string("couchbase://").scheme == "couchbase");
|
54
54
|
CHECK(couchbase::core::utils::parse_connection_string("my+scheme://").scheme == "my+scheme");
|
55
|
+
CHECK(couchbase::core::utils::parse_connection_string("127.0.0.1").scheme == "couchbase");
|
56
|
+
CHECK(couchbase::core::utils::parse_connection_string("127.0.0.1:8091").scheme == "couchbase");
|
55
57
|
|
56
58
|
SECTION("default bootstrap mode")
|
57
59
|
{
|
@@ -155,6 +157,13 @@ TEST_CASE("unit: connection string", "[unit]")
|
|
155
157
|
couchbase::core::utils::connection_string::address_type::dns,
|
156
158
|
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
157
159
|
});
|
160
|
+
CHECK(couchbase::core::utils::parse_connection_string("1.2.3.4").bootstrap_nodes ==
|
161
|
+
std::vector<couchbase::core::utils::connection_string::node>{
|
162
|
+
{ "1.2.3.4",
|
163
|
+
0,
|
164
|
+
couchbase::core::utils::connection_string::address_type::ipv4,
|
165
|
+
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
166
|
+
});
|
158
167
|
}
|
159
168
|
|
160
169
|
SECTION("multiple nodes")
|
@@ -207,6 +216,17 @@ TEST_CASE("unit: connection string", "[unit]")
|
|
207
216
|
couchbase::core::utils::connection_string::address_type::ipv4,
|
208
217
|
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
209
218
|
});
|
219
|
+
CHECK(couchbase::core::utils::parse_connection_string("1.2.3.4,4.3.2.1").bootstrap_nodes ==
|
220
|
+
std::vector<couchbase::core::utils::connection_string::node>{
|
221
|
+
{ "1.2.3.4",
|
222
|
+
0,
|
223
|
+
couchbase::core::utils::connection_string::address_type::ipv4,
|
224
|
+
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
225
|
+
{ "4.3.2.1",
|
226
|
+
0,
|
227
|
+
couchbase::core::utils::connection_string::address_type::ipv4,
|
228
|
+
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
229
|
+
});
|
210
230
|
}
|
211
231
|
|
212
232
|
SECTION("custom ports")
|
@@ -259,6 +279,21 @@ TEST_CASE("unit: connection string", "[unit]")
|
|
259
279
|
couchbase::core::utils::connection_string::address_type::ipv4,
|
260
280
|
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
261
281
|
});
|
282
|
+
CHECK(couchbase::core::utils::parse_connection_string("example.com:123,[::1]:456;127.0.0.1:789").bootstrap_nodes ==
|
283
|
+
std::vector<couchbase::core::utils::connection_string::node>{
|
284
|
+
{ "example.com",
|
285
|
+
123,
|
286
|
+
couchbase::core::utils::connection_string::address_type::dns,
|
287
|
+
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
288
|
+
{ "::1",
|
289
|
+
456,
|
290
|
+
couchbase::core::utils::connection_string::address_type::ipv6,
|
291
|
+
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
292
|
+
{ "127.0.0.1",
|
293
|
+
789,
|
294
|
+
couchbase::core::utils::connection_string::address_type::ipv4,
|
295
|
+
couchbase::core::utils::connection_string::bootstrap_mode::unspecified },
|
296
|
+
});
|
262
297
|
}
|
263
298
|
|
264
299
|
SECTION("custom bootstrap mode")
|
@@ -27,7 +27,7 @@
|
|
27
27
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
28
28
|
|
29
29
|
cmake_minimum_required(VERSION 3.1)
|
30
|
-
project(Snappy VERSION 1.1.
|
30
|
+
project(Snappy VERSION 1.1.10 LANGUAGES C CXX)
|
31
31
|
|
32
32
|
# C++ standard can be overridden when this is used as a sub-project.
|
33
33
|
if(NOT CMAKE_CXX_STANDARD)
|
@@ -37,12 +37,59 @@ if(NOT CMAKE_CXX_STANDARD)
|
|
37
37
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
38
38
|
endif(NOT CMAKE_CXX_STANDARD)
|
39
39
|
|
40
|
+
# https://github.com/izenecloud/cmake/blob/master/SetCompilerWarningAll.cmake
|
41
|
+
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
42
|
+
# Use the highest warning level for Visual Studio.
|
43
|
+
set(CMAKE_CXX_WARNING_LEVEL 4)
|
44
|
+
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
45
|
+
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
46
|
+
else(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
47
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
48
|
+
endif(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
49
|
+
|
50
|
+
# Disable C++ exceptions.
|
51
|
+
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
52
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-")
|
53
|
+
add_definitions(-D_HAS_EXCEPTIONS=0)
|
54
|
+
|
55
|
+
# Disable RTTI.
|
56
|
+
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
57
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
58
|
+
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
59
|
+
# Use -Wall for clang and gcc.
|
60
|
+
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
61
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
62
|
+
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
63
|
+
|
64
|
+
# Use -Wextra for clang and gcc.
|
65
|
+
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
|
66
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
67
|
+
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra")
|
68
|
+
|
69
|
+
# Use -Werror for clang only.
|
70
|
+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
71
|
+
if(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
72
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
73
|
+
endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror")
|
74
|
+
endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
75
|
+
|
76
|
+
# Disable C++ exceptions.
|
77
|
+
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
78
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
79
|
+
|
80
|
+
# Disable RTTI.
|
81
|
+
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
82
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
83
|
+
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
84
|
+
|
40
85
|
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
41
86
|
# it prominent in the GUI.
|
42
87
|
option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
|
43
88
|
|
44
89
|
option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
|
45
90
|
|
91
|
+
option(SNAPPY_BUILD_BENCHMARKS "Build Snappy's benchmarks" ON)
|
92
|
+
|
46
93
|
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
|
47
94
|
|
48
95
|
option(SNAPPY_REQUIRE_AVX "Target processors with AVX support." OFF)
|
@@ -55,8 +102,6 @@ include(TestBigEndian)
|
|
55
102
|
test_big_endian(SNAPPY_IS_BIG_ENDIAN)
|
56
103
|
|
57
104
|
include(CheckIncludeFile)
|
58
|
-
check_include_file("byteswap.h" HAVE_BYTESWAP_H)
|
59
|
-
check_include_file("sys/endian.h" HAVE_SYS_ENDIAN_H)
|
60
105
|
check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
|
61
106
|
check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
|
62
107
|
check_include_file("sys/time.h" HAVE_SYS_TIME_H)
|
@@ -67,6 +112,7 @@ check_include_file("windows.h" HAVE_WINDOWS_H)
|
|
67
112
|
include(CheckLibraryExists)
|
68
113
|
check_library_exists(z zlibVersion "" HAVE_LIBZ)
|
69
114
|
check_library_exists(lzo2 lzo1x_1_15_compress "" HAVE_LIBLZO2)
|
115
|
+
check_library_exists(lz4 LZ4_compress_default "" HAVE_LIBLZ4)
|
70
116
|
|
71
117
|
include(CheckCXXCompilerFlag)
|
72
118
|
CHECK_CXX_COMPILER_FLAG("/arch:AVX" HAVE_VISUAL_STUDIO_ARCH_AVX)
|
@@ -92,6 +138,10 @@ elseif (SNAPPY_REQUIRE_AVX)
|
|
92
138
|
endif(HAVE_CLANG_MAVX)
|
93
139
|
endif(SNAPPY_REQUIRE_AVX2)
|
94
140
|
|
141
|
+
# Used by googletest.
|
142
|
+
check_cxx_compiler_flag(-Wno-missing-field-initializers
|
143
|
+
SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
144
|
+
|
95
145
|
include(CheckCXXSourceCompiles)
|
96
146
|
check_cxx_source_compiles("
|
97
147
|
int main() {
|
@@ -103,6 +153,13 @@ int main() {
|
|
103
153
|
return __builtin_ctzll(0);
|
104
154
|
}" HAVE_BUILTIN_CTZ)
|
105
155
|
|
156
|
+
check_cxx_source_compiles("
|
157
|
+
__attribute__((always_inline)) int zero() { return 0; }
|
158
|
+
|
159
|
+
int main() {
|
160
|
+
return zero();
|
161
|
+
}" HAVE_ATTRIBUTE_ALWAYS_INLINE)
|
162
|
+
|
106
163
|
check_cxx_source_compiles("
|
107
164
|
#include <tmmintrin.h>
|
108
165
|
|
@@ -115,26 +172,38 @@ int main() {
|
|
115
172
|
return 0;
|
116
173
|
}" SNAPPY_HAVE_SSSE3)
|
117
174
|
|
175
|
+
check_cxx_source_compiles("
|
176
|
+
#include <immintrin.h>
|
177
|
+
int main() {
|
178
|
+
return _mm_crc32_u32(0, 1);
|
179
|
+
}" SNAPPY_HAVE_X86_CRC32)
|
180
|
+
|
181
|
+
check_cxx_source_compiles("
|
182
|
+
#include <arm_neon.h>
|
183
|
+
#include <arm_acle.h>
|
184
|
+
int main() {
|
185
|
+
return __crc32cw(0, 1);
|
186
|
+
}" SNAPPY_HAVE_NEON_CRC32)
|
187
|
+
|
118
188
|
check_cxx_source_compiles("
|
119
189
|
#include <immintrin.h>
|
120
190
|
int main() {
|
121
191
|
return _bzhi_u32(0, 1);
|
122
192
|
}" SNAPPY_HAVE_BMI2)
|
123
193
|
|
194
|
+
check_cxx_source_compiles("
|
195
|
+
#include <arm_neon.h>
|
196
|
+
int main() {
|
197
|
+
uint8_t val = 3, dup[8];
|
198
|
+
uint8x16_t v = vld1q_dup_u8(&val);
|
199
|
+
vst1q_u8(dup, v);
|
200
|
+
return 0;
|
201
|
+
}" SNAPPY_HAVE_NEON)
|
202
|
+
|
124
203
|
include(CheckSymbolExists)
|
125
204
|
check_symbol_exists("mmap" "sys/mman.h" HAVE_FUNC_MMAP)
|
126
205
|
check_symbol_exists("sysconf" "unistd.h" HAVE_FUNC_SYSCONF)
|
127
206
|
|
128
|
-
find_package(GTest QUIET)
|
129
|
-
if(GTEST_FOUND)
|
130
|
-
set(HAVE_GTEST 1)
|
131
|
-
endif(GTEST_FOUND)
|
132
|
-
|
133
|
-
find_package(Gflags QUIET)
|
134
|
-
if(GFLAGS_FOUND)
|
135
|
-
set(HAVE_GFLAGS 1)
|
136
|
-
endif(GFLAGS_FOUND)
|
137
|
-
|
138
207
|
configure_file(
|
139
208
|
"cmake/config.h.in"
|
140
209
|
"${PROJECT_BINARY_DIR}/config.h"
|
@@ -202,38 +271,92 @@ if(BUILD_SHARED_LIBS)
|
|
202
271
|
set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
203
272
|
endif(BUILD_SHARED_LIBS)
|
204
273
|
|
205
|
-
if(SNAPPY_BUILD_TESTS)
|
206
|
-
|
207
|
-
|
208
|
-
add_executable(snappy_unittest "")
|
209
|
-
target_sources(snappy_unittest
|
274
|
+
if(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS)
|
275
|
+
add_library(snappy_test_support "")
|
276
|
+
target_sources(snappy_test_support
|
210
277
|
PRIVATE
|
211
|
-
"snappy_unittest.cc"
|
212
278
|
"snappy-test.cc"
|
279
|
+
"snappy-test.h"
|
280
|
+
"snappy_test_data.cc"
|
281
|
+
"snappy_test_data.h"
|
282
|
+
"${PROJECT_BINARY_DIR}/config.h"
|
213
283
|
)
|
214
|
-
|
215
|
-
|
284
|
+
|
285
|
+
# Test files include snappy-test.h, HAVE_CONFIG_H must be defined.
|
286
|
+
target_compile_definitions(snappy_test_support PUBLIC -DHAVE_CONFIG_H)
|
287
|
+
|
288
|
+
target_link_libraries(snappy_test_support snappy)
|
216
289
|
|
217
290
|
if(HAVE_LIBZ)
|
218
|
-
target_link_libraries(
|
291
|
+
target_link_libraries(snappy_test_support z)
|
219
292
|
endif(HAVE_LIBZ)
|
220
293
|
if(HAVE_LIBLZO2)
|
221
|
-
target_link_libraries(
|
294
|
+
target_link_libraries(snappy_test_support lzo2)
|
222
295
|
endif(HAVE_LIBLZO2)
|
296
|
+
if(HAVE_LIBLZ4)
|
297
|
+
target_link_libraries(snappy_test_support lz4)
|
298
|
+
endif(HAVE_LIBLZ4)
|
223
299
|
|
224
|
-
target_include_directories(
|
225
|
-
BEFORE
|
300
|
+
target_include_directories(snappy_test_support
|
301
|
+
BEFORE PUBLIC
|
226
302
|
"${PROJECT_SOURCE_DIR}"
|
227
|
-
"${GTEST_INCLUDE_DIRS}"
|
228
|
-
"${GFLAGS_INCLUDE_DIRS}"
|
229
303
|
)
|
304
|
+
endif(SNAPPY_BUILD_TESTS OR SNAPPY_BUILD_BENCHMARKS)
|
305
|
+
|
306
|
+
if(SNAPPY_BUILD_TESTS)
|
307
|
+
enable_testing()
|
308
|
+
|
309
|
+
# Prevent overriding the parent project's compiler/linker settings on Windows.
|
310
|
+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
311
|
+
set(install_gtest OFF)
|
312
|
+
set(install_gmock OFF)
|
313
|
+
set(build_gmock ON)
|
314
|
+
|
315
|
+
# This project is tested using GoogleTest.
|
316
|
+
add_subdirectory("third_party/googletest")
|
317
|
+
|
318
|
+
# GoogleTest triggers a missing field initializers warning.
|
319
|
+
if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
320
|
+
set_property(TARGET gtest
|
321
|
+
APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
322
|
+
set_property(TARGET gmock
|
323
|
+
APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
324
|
+
endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
325
|
+
|
326
|
+
add_executable(snappy_unittest "")
|
327
|
+
target_sources(snappy_unittest
|
328
|
+
PRIVATE
|
329
|
+
"snappy_unittest.cc"
|
330
|
+
)
|
331
|
+
target_link_libraries(snappy_unittest snappy_test_support gmock_main gtest)
|
230
332
|
|
231
333
|
add_test(
|
232
334
|
NAME snappy_unittest
|
233
335
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
234
336
|
COMMAND "${PROJECT_BINARY_DIR}/snappy_unittest")
|
337
|
+
|
338
|
+
add_executable(snappy_test_tool "")
|
339
|
+
target_sources(snappy_test_tool
|
340
|
+
PRIVATE
|
341
|
+
"snappy_test_tool.cc"
|
342
|
+
)
|
343
|
+
target_link_libraries(snappy_test_tool snappy_test_support)
|
235
344
|
endif(SNAPPY_BUILD_TESTS)
|
236
345
|
|
346
|
+
if(SNAPPY_BUILD_BENCHMARKS)
|
347
|
+
add_executable(snappy_benchmark "")
|
348
|
+
target_sources(snappy_benchmark
|
349
|
+
PRIVATE
|
350
|
+
"snappy_benchmark.cc"
|
351
|
+
)
|
352
|
+
target_link_libraries(snappy_benchmark snappy_test_support benchmark_main)
|
353
|
+
|
354
|
+
# This project uses Google benchmark for benchmarking.
|
355
|
+
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
|
356
|
+
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
|
357
|
+
add_subdirectory("third_party/benchmark")
|
358
|
+
endif(SNAPPY_BUILD_BENCHMARKS)
|
359
|
+
|
237
360
|
if(SNAPPY_FUZZING_BUILD)
|
238
361
|
add_executable(snappy_compress_fuzzer "")
|
239
362
|
target_sources(snappy_compress_fuzzer
|
@@ -1,62 +1,66 @@
|
|
1
1
|
#ifndef THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
2
2
|
#define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|
3
3
|
|
4
|
+
/* Define to 1 if the compiler supports __attribute__((always_inline)). */
|
5
|
+
#cmakedefine01 HAVE_ATTRIBUTE_ALWAYS_INLINE
|
6
|
+
|
4
7
|
/* Define to 1 if the compiler supports __builtin_ctz and friends. */
|
5
|
-
#
|
8
|
+
#cmakedefine01 HAVE_BUILTIN_CTZ
|
6
9
|
|
7
10
|
/* Define to 1 if the compiler supports __builtin_expect. */
|
8
|
-
#
|
9
|
-
|
10
|
-
/* Define to 1 if you have the <byteswap.h> header file. */
|
11
|
-
#cmakedefine HAVE_BYTESWAP_H 1
|
11
|
+
#cmakedefine01 HAVE_BUILTIN_EXPECT
|
12
12
|
|
13
13
|
/* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */
|
14
|
-
#
|
14
|
+
#cmakedefine01 HAVE_FUNC_MMAP
|
15
15
|
|
16
16
|
/* Define to 1 if you have a definition for sysconf() in <unistd.h>. */
|
17
|
-
#
|
18
|
-
|
19
|
-
/* Define to 1 to use the gflags package for command-line parsing. */
|
20
|
-
#cmakedefine HAVE_GFLAGS 1
|
21
|
-
|
22
|
-
/* Define to 1 if you have Google Test. */
|
23
|
-
#cmakedefine HAVE_GTEST 1
|
17
|
+
#cmakedefine01 HAVE_FUNC_SYSCONF
|
24
18
|
|
25
19
|
/* Define to 1 if you have the `lzo2' library (-llzo2). */
|
26
|
-
#
|
20
|
+
#cmakedefine01 HAVE_LIBLZO2
|
27
21
|
|
28
22
|
/* Define to 1 if you have the `z' library (-lz). */
|
29
|
-
#
|
23
|
+
#cmakedefine01 HAVE_LIBZ
|
30
24
|
|
31
|
-
/* Define to 1 if you have the
|
32
|
-
#
|
25
|
+
/* Define to 1 if you have the `lz4' library (-llz4). */
|
26
|
+
#cmakedefine01 HAVE_LIBLZ4
|
33
27
|
|
34
28
|
/* Define to 1 if you have the <sys/mman.h> header file. */
|
35
|
-
#
|
29
|
+
#cmakedefine01 HAVE_SYS_MMAN_H
|
36
30
|
|
37
31
|
/* Define to 1 if you have the <sys/resource.h> header file. */
|
38
|
-
#
|
32
|
+
#cmakedefine01 HAVE_SYS_RESOURCE_H
|
39
33
|
|
40
34
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
41
|
-
#
|
35
|
+
#cmakedefine01 HAVE_SYS_TIME_H
|
42
36
|
|
43
37
|
/* Define to 1 if you have the <sys/uio.h> header file. */
|
44
|
-
#
|
38
|
+
#cmakedefine01 HAVE_SYS_UIO_H
|
45
39
|
|
46
40
|
/* Define to 1 if you have the <unistd.h> header file. */
|
47
|
-
#
|
41
|
+
#cmakedefine01 HAVE_UNISTD_H
|
48
42
|
|
49
43
|
/* Define to 1 if you have the <windows.h> header file. */
|
50
|
-
#
|
44
|
+
#cmakedefine01 HAVE_WINDOWS_H
|
51
45
|
|
52
46
|
/* Define to 1 if you target processors with SSSE3+ and have <tmmintrin.h>. */
|
53
47
|
#cmakedefine01 SNAPPY_HAVE_SSSE3
|
54
48
|
|
49
|
+
/* Define to 1 if you target processors with SSE4.2 and have <crc32intrin.h>. */
|
50
|
+
#cmakedefine01 SNAPPY_HAVE_X86_CRC32
|
51
|
+
|
55
52
|
/* Define to 1 if you target processors with BMI2+ and have <bmi2intrin.h>. */
|
56
53
|
#cmakedefine01 SNAPPY_HAVE_BMI2
|
57
54
|
|
55
|
+
/* Define to 1 if you target processors with NEON and have <arm_neon.h>. */
|
56
|
+
#cmakedefine01 SNAPPY_HAVE_NEON
|
57
|
+
|
58
|
+
/* Define to 1 if you have <arm_neon.h> and <arm_acle.h> and want to optimize
|
59
|
+
compression speed by using __crc32cw from <arm_acle.h>. */
|
60
|
+
#cmakedefine01 SNAPPY_HAVE_NEON_CRC32
|
61
|
+
|
58
62
|
/* Define to 1 if your processor stores words with the most significant byte
|
59
63
|
first (like Motorola and SPARC, unlike Intel and VAX). */
|
60
|
-
#
|
64
|
+
#cmakedefine01 SNAPPY_IS_BIG_ENDIAN
|
61
65
|
|
62
66
|
#endif // THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_
|