Merge lp:~michihenning/persistent-cache-cpp/gtest-fixes into lp:persistent-cache-cpp/devel

Proposed by Michi Henning
Status: Merged
Approved by: James Henstridge
Approved revision: 48
Merged at revision: 45
Proposed branch: lp:~michihenning/persistent-cache-cpp/gtest-fixes
Merge into: lp:persistent-cache-cpp/devel
Diff against target: 502 lines (+86/-91)
8 files modified
debian/control (+1/-1)
tests/CMakeLists.txt (+0/-21)
tests/copyright/check_copyright.sh (+1/-1)
tests/core/CMakeLists.txt (+2/-1)
tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp (+63/-60)
tests/core/persistent_cache/persistent_cache_test.cpp (+10/-6)
tests/core/persistent_string_cache/persistent_string_cache_test.cpp (+5/-1)
tests/core/persistent_string_cache/speed_test.cpp (+4/-0)
To merge this branch: bzr merge lp:~michihenning/persistent-cache-cpp/gtest-fixes
Reviewer Review Type Date Requested Status
James Henstridge Approve
unity-api-1-bot continuous-integration Approve
Review via email: mp+311907@code.launchpad.net

Commit message

Updated CMakeLists.txt to work with gtest 1.8.
Suppressed warnings from gtests.

Description of the change

Updated CMakeLists.txt to work with gtest 1.8.
Suppressed warnings from gtests.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:45
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/17/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/1188/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1195
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/981/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/981
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/981/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/981/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/981
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/981/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/981/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/981
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/981/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/17/rebuild

review: Needs Fixing (continuous-integration)
46. By Michi Henning

Fixed failing copyright test.

47. By Michi Henning

Moved GMock find_package one level down.

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:46
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/18/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/1189/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1196
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/982/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/982
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/982/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/982/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/982
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/982/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/982/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/982
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/982/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/18/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:47
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/19/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/1190/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1197
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/983/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/983
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/983/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/983/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/983
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/983/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/983/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/983
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/983/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/19/rebuild

review: Needs Fixing (continuous-integration)
48. By Michi Henning

Replaced libgtest-dev with google-mock build test.

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:48
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/20/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1191
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1198
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/984
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/984/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/984
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/984/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/984
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/984/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/984
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/984/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/984
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/984/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/984
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/984/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-persistent-cache-cpp-ci/20/rebuild

review: Approve (continuous-integration)
Revision history for this message
James Henstridge (jamesh) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-07-19 23:20:43 +0000
3+++ debian/control 2016-11-28 07:42:15 +0000
4@@ -6,8 +6,8 @@
5 debhelper (>= 9),
6 devscripts,
7 doxygen,
8+ google-mock,
9 libboost-filesystem-dev,
10- libgtest-dev,
11 libleveldb-dev,
12 lsb-release,
13 pkg-config,
14
15=== modified file 'tests/CMakeLists.txt'
16--- tests/CMakeLists.txt 2015-07-21 06:22:48 +0000
17+++ tests/CMakeLists.txt 2016-11-28 07:42:15 +0000
18@@ -1,24 +1,3 @@
19-if (NOT DEFINED GTEST_ROOT)
20- set(GTEST_ROOT /usr/src/gtest)
21-endif()
22-
23-set(GTEST_SRC_DIR "${GTEST_ROOT}/src")
24-set(GTEST_INCLUDE_DIR ${GTEST_ROOT})
25-
26-add_library(gtest STATIC
27- ${GTEST_SRC_DIR}/gtest-all.cc
28- ${GTEST_SRC_DIR}/gtest_main.cc
29-)
30-set_target_properties(gtest PROPERTIES INCLUDE_DIRECTORIES ${GTEST_INCLUDE_DIR})
31-target_link_libraries(gtest ${CMAKE_THREAD_LIBS_INIT})
32-
33-# Make sure we always build gtest with debug info, otherwise we don't
34-# get line numbers for the code that is dragged in by the test macros.
35-set_property(TARGET gtest APPEND_STRING PROPERTY COMPILE_FLAGS " -g")
36-
37-# gtest won't compile cleanly without this.
38-set_property(TARGET gtest APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-missing-field-initializers -Wno-old-style-cast")
39-
40 add_subdirectory(copyright)
41 add_subdirectory(core)
42 add_subdirectory(headers)
43
44=== modified file 'tests/copyright/check_copyright.sh'
45--- tests/copyright/check_copyright.sh 2016-05-05 02:10:05 +0000
46+++ tests/copyright/check_copyright.sh 2016-11-28 07:42:15 +0000
47@@ -35,7 +35,7 @@
48 exit 0
49 }
50
51-ignore_pat="\\.sci$|debian|HACKING|README"
52+ignore_pat="\\.sci$|debian|HACKING|README|\\.txt$|\\.in$|\\.pm$"
53
54 #
55 # We don't use the -i option of licensecheck to add ignore_dir to the pattern because Jenkins creates directories
56
57=== modified file 'tests/core/CMakeLists.txt'
58--- tests/core/CMakeLists.txt 2015-07-21 06:22:48 +0000
59+++ tests/core/CMakeLists.txt 2016-11-28 07:42:15 +0000
60@@ -1,7 +1,8 @@
61 include(FindPkgConfig)
62+find_package(GMock)
63 find_package(Boost COMPONENTS system filesystem)
64
65-set(TESTLIBS ${LIBNAME} boost_filesystem boost_system leveldb gtest)
66+set(TESTLIBS ${LIBNAME} boost_filesystem boost_system leveldb gtest_main)
67
68 add_subdirectory(persistent_cache)
69 add_subdirectory(persistent_string_cache)
70
71=== modified file 'tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp'
72--- tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp 2015-08-19 05:31:09 +0000
73+++ tests/core/internal/persistent_string_cache_impl/persistent_string_cache_impl_test.cpp 2016-11-28 07:42:15 +0000
74@@ -21,7 +21,10 @@
75 #include <boost/algorithm/string.hpp>
76 #include <boost/filesystem.hpp>
77
78+#pragma GCC diagnostic push
79+#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
80 #include <gtest/gtest.h>
81+#pragma GCC diagnostic pop
82
83 #include <map>
84 #include <thread>
85@@ -372,7 +375,7 @@
86 // That must evict entry "2", which is the second-oldest, and leave
87 // entry "3" intact.
88 val += 'a';
89- ASSERT_EQ(45, val.size());
90+ ASSERT_EQ(45u, val.size());
91 EXPECT_TRUE(c.put_metadata("1", val));
92 EXPECT_FALSE(c.contains_key("2"));
93 EXPECT_TRUE(c.contains_key("3"));
94@@ -1480,7 +1483,7 @@
95 auto hist = s.histogram();
96 for (unsigned i = 0; i < hist.size(); ++i)
97 {
98- EXPECT_EQ(0, hist[i]); // Histogram must be empty
99+ EXPECT_EQ(0u, hist[i]); // Histogram must be empty
100 }
101
102 c.put("x", "y");
103@@ -1502,74 +1505,74 @@
104 EXPECT_EQ(2, s.size_in_bytes());
105 EXPECT_EQ(128, s.max_size_in_bytes());
106 EXPECT_EQ(0, s.hits());
107- EXPECT_EQ(1, s.histogram()[0]);
108+ EXPECT_EQ(1u, s.histogram()[0]);
109
110 c.put("x", "y"); // Value was already there
111 s = c.stats();
112 hist = s.histogram();
113- EXPECT_EQ(1, hist[0]);
114+ EXPECT_EQ(1u, hist[0]);
115 for (unsigned i = 1; i < hist.size(); ++i)
116 {
117- EXPECT_EQ(0, hist[i]);
118+ EXPECT_EQ(0u, hist[i]);
119 }
120
121 c.put("y", ""); // New value
122 s = c.stats();
123 hist = s.histogram();
124- EXPECT_EQ(2, hist[0]);
125+ EXPECT_EQ(2u, hist[0]);
126 for (unsigned i = 1; i < hist.size(); ++i)
127 {
128- EXPECT_EQ(0, hist[i]);
129+ EXPECT_EQ(0u, hist[i]);
130 }
131
132 c.put("y", "ab"); // Replace value with larger one in same bin.
133 s = c.stats();
134 hist = s.histogram();
135- EXPECT_EQ(2, hist[0]); // Bin count must still be the same.
136+ EXPECT_EQ(2u, hist[0]); // Bin count must still be the same.
137 for (unsigned i = 1; i < hist.size(); ++i)
138 {
139- EXPECT_EQ(0, hist[i]);
140+ EXPECT_EQ(0u, hist[i]);
141 }
142
143 c.put("y", string(9, 'y')); // Replace value with larger one in next bin.
144 s = c.stats();
145 hist = s.histogram();
146- EXPECT_EQ(1, hist[0]);
147- EXPECT_EQ(1, hist[1]); // Value must have moved to new bin.
148+ EXPECT_EQ(1u, hist[0]);
149+ EXPECT_EQ(1u, hist[1]); // Value must have moved to new bin.
150 for (unsigned i = 2; i < hist.size(); ++i)
151 {
152- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
153+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
154 }
155
156 c.put_metadata("y", string(1, 'm')); // Add small metadata, value stays in same bin.
157 s = c.stats();
158 hist = s.histogram();
159- EXPECT_EQ(1, hist[0]);
160- EXPECT_EQ(1, hist[1]); // Value must have moved to new bin.
161+ EXPECT_EQ(1u, hist[0]);
162+ EXPECT_EQ(1u, hist[1]); // Value must have moved to new bin.
163 for (unsigned i = 2; i < hist.size(); ++i)
164 {
165- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
166+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
167 }
168
169 c.put_metadata("y", string(10, 'm')); // Add larger metadata, value moves to next bin.
170 s = c.stats();
171 hist = s.histogram();
172- EXPECT_EQ(1, hist[0]);
173- EXPECT_EQ(0, hist[1]);
174- EXPECT_EQ(1, hist[2]);
175+ EXPECT_EQ(1u, hist[0]);
176+ EXPECT_EQ(0u, hist[1]);
177+ EXPECT_EQ(1u, hist[2]);
178 for (unsigned i = 3; i < hist.size(); ++i)
179 {
180- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
181+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
182 }
183
184 c.put_metadata("y", string(1, 'm')); // Shrink metadata, value moves to previous bin.
185 s = c.stats();
186 hist = s.histogram();
187- EXPECT_EQ(1, hist[0]);
188- EXPECT_EQ(1, hist[1]);
189+ EXPECT_EQ(1u, hist[0]);
190+ EXPECT_EQ(1u, hist[1]);
191 for (unsigned i = 2; i < hist.size(); ++i)
192 {
193- EXPECT_EQ(0, hist[i]) << i; // Other bins must still be empty.
194+ EXPECT_EQ(0u, hist[i]) << i; // Other bins must still be empty.
195 }
196
197 c.put("new key", string(1, 'k'));
198@@ -1583,7 +1586,7 @@
199 hist = s.histogram();
200 for (unsigned i = 0; i < hist.size(); ++i)
201 {
202- EXPECT_EQ(0, hist[i]); // Histogram must have been emptied.
203+ EXPECT_EQ(0u, hist[i]); // Histogram must have been emptied.
204 }
205 EXPECT_EQ(0, s.hits()); // invalidate() also clears the ephemeral stats.
206
207@@ -1594,25 +1597,25 @@
208 c.invalidate({"2", "3"});
209 s = c.stats();
210 hist = s.histogram();
211- EXPECT_EQ(1, hist[0]);
212- EXPECT_EQ(0, hist[1]);
213- EXPECT_EQ(0, hist[2]);
214- EXPECT_EQ(1, hist[3]);
215+ EXPECT_EQ(1u, hist[0]);
216+ EXPECT_EQ(0u, hist[1]);
217+ EXPECT_EQ(0u, hist[2]);
218+ EXPECT_EQ(1u, hist[3]);
219 for (unsigned i = 4; i < hist.size(); ++i)
220 {
221- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
222+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
223 }
224
225 c.invalidate("1"); // Invalidate specific entry
226 s = c.stats();
227 hist = s.histogram();
228- EXPECT_EQ(0, hist[0]);
229- EXPECT_EQ(0, hist[1]);
230- EXPECT_EQ(0, hist[2]);
231- EXPECT_EQ(1, hist[3]);
232+ EXPECT_EQ(0u, hist[0]);
233+ EXPECT_EQ(0u, hist[1]);
234+ EXPECT_EQ(0u, hist[2]);
235+ EXPECT_EQ(1u, hist[3]);
236 for (unsigned i = 4; i < hist.size(); ++i)
237 {
238- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
239+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
240 }
241
242 // Rather than testing all 74 bins, we test a few critical ones.
243@@ -1663,13 +1666,13 @@
244
245 // Histogram must be re-established when opened.
246 auto hist = s.histogram();
247- EXPECT_EQ(0, hist[0]);
248- EXPECT_EQ(0, hist[1]);
249- EXPECT_EQ(0, hist[2]);
250- EXPECT_EQ(1, hist[3]);
251+ EXPECT_EQ(0u, hist[0]);
252+ EXPECT_EQ(0u, hist[1]);
253+ EXPECT_EQ(0u, hist[2]);
254+ EXPECT_EQ(1u, hist[3]);
255 for (unsigned i = 4; i < hist.size(); ++i)
256 {
257- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
258+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
259 }
260
261 // Ephemeral counters must still be intact.
262@@ -1731,13 +1734,13 @@
263
264 // Histogram must be re-established when opened.
265 auto hist = s.histogram();
266- EXPECT_EQ(0, hist[0]);
267- EXPECT_EQ(0, hist[1]);
268- EXPECT_EQ(0, hist[2]);
269- EXPECT_EQ(1, hist[3]);
270+ EXPECT_EQ(0u, hist[0]);
271+ EXPECT_EQ(0u, hist[1]);
272+ EXPECT_EQ(0u, hist[2]);
273+ EXPECT_EQ(1u, hist[3]);
274 for (unsigned i = 4; i < hist.size(); ++i)
275 {
276- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
277+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
278 }
279
280 // Ephemeral counters must all be zero.
281@@ -1914,7 +1917,7 @@
282 // Check Put events.
283
284 c.put("1", "x");
285- ASSERT_EQ(1, map->size());
286+ ASSERT_EQ(1u, map->size());
287 er = (*map)["1"];
288 EXPECT_EQ(CacheEvent::put, er.ev);
289 EXPECT_EQ(1, er.stats.size());
290@@ -1922,7 +1925,7 @@
291
292 this_thread::sleep_for(chrono::milliseconds(5)); // Make sure we have different time stamps.
293 c.put("2", "x");
294- ASSERT_EQ(2, map->size());
295+ ASSERT_EQ(2u, map->size());
296 er = (*map)["2"];
297 EXPECT_EQ(CacheEvent::put, er.ev);
298 EXPECT_EQ(2, er.stats.size());
299@@ -1930,7 +1933,7 @@
300
301 this_thread::sleep_for(chrono::milliseconds(5));
302 c.put("3", "x");
303- ASSERT_EQ(3, map->size());
304+ ASSERT_EQ(3u, map->size());
305 er = (*map)["3"];
306 EXPECT_EQ(CacheEvent::put, er.ev);
307 EXPECT_EQ(3, er.stats.size());
308@@ -1938,7 +1941,7 @@
309
310 this_thread::sleep_for(chrono::milliseconds(5));
311 c.put("4", "x");
312- ASSERT_EQ(4, map->size());
313+ ASSERT_EQ(4u, map->size());
314 er = (*map)["4"];
315 EXPECT_EQ(CacheEvent::put, er.ev);
316 EXPECT_EQ(4, er.stats.size());
317@@ -1949,7 +1952,7 @@
318 this_thread::sleep_for(chrono::milliseconds(5));
319 c.get("3", val);
320 map = &event_maps[CacheEvent::get];
321- ASSERT_EQ(1, map->size());
322+ ASSERT_EQ(1u, map->size());
323 er = (*map)["3"];
324 EXPECT_EQ(CacheEvent::get, er.ev);
325 EXPECT_EQ(4, er.stats.size());
326@@ -1960,7 +1963,7 @@
327
328 map = &event_maps[CacheEvent::invalidate];
329 c.invalidate("1");
330- ASSERT_EQ(1, map->size());
331+ ASSERT_EQ(1u, map->size());
332 er = (*map)["1"];
333 EXPECT_EQ(CacheEvent::invalidate, er.ev);
334 EXPECT_EQ(3, er.stats.size());
335@@ -1969,7 +1972,7 @@
336
337 c.take("2", val);
338 map = &event_maps[CacheEvent::get];
339- ASSERT_EQ(1, map->size());
340+ ASSERT_EQ(1u, map->size());
341 er = (*map)["2"];
342 EXPECT_EQ(CacheEvent::get, er.ev);
343 EXPECT_EQ(2, er.stats.size());
344@@ -1977,7 +1980,7 @@
345 map->clear();
346
347 map = &event_maps[CacheEvent::invalidate];
348- ASSERT_EQ(1, map->size());
349+ ASSERT_EQ(1u, map->size());
350 er = (*map)["2"];
351 EXPECT_EQ(CacheEvent::invalidate, er.ev);
352 EXPECT_EQ(2, er.stats.size());
353@@ -1985,7 +1988,7 @@
354 map->clear();
355
356 c.invalidate();
357- ASSERT_EQ(2, map->size());
358+ ASSERT_EQ(2u, map->size());
359 er = (*map)["4"];
360 EXPECT_EQ(CacheEvent::invalidate, er.ev);
361 EXPECT_EQ(1, er.stats.size());
362@@ -2003,7 +2006,7 @@
363 c.put("1", "1");
364 map = &event_maps[CacheEvent::touch];
365 c.touch("1");
366- ASSERT_EQ(1, map->size());
367+ ASSERT_EQ(1u, map->size());
368 er = (*map)["1"];
369 EXPECT_EQ(CacheEvent::touch, er.ev);
370 EXPECT_EQ(1, er.stats.size());
371@@ -2016,7 +2019,7 @@
372
373 map = &event_maps[CacheEvent::miss];
374 c.get(bad_key, val);
375- ASSERT_EQ(1, map->size());
376+ ASSERT_EQ(1u, map->size());
377 er = (*map)[bad_key];
378 EXPECT_EQ(CacheEvent::miss, er.ev);
379 EXPECT_EQ(0, er.stats.size());
380@@ -2031,11 +2034,11 @@
381 this_thread::sleep_for(chrono::milliseconds(5));
382 }
383 c.get(bad_key, val); // Already expired, so we must get a miss.
384- ASSERT_EQ(1, map->size());
385+ ASSERT_EQ(1u, map->size());
386 er = (*map)[bad_key];
387 EXPECT_EQ(CacheEvent::miss, er.ev);
388 EXPECT_EQ(1, er.stats.size());
389- EXPECT_EQ(bad_key.size(), er.stats.size_in_bytes());
390+ EXPECT_EQ(int(bad_key.size()), er.stats.size_in_bytes());
391 c.invalidate();
392 map->clear();
393
394@@ -2048,9 +2051,9 @@
395 c.invalidate(bad_key); // Already expired, so we must get an invalidate, but not a miss.
396
397 map = &event_maps[CacheEvent::miss];
398- ASSERT_EQ(0, map->size());
399+ ASSERT_EQ(0u, map->size());
400 map = &event_maps[CacheEvent::invalidate];
401- ASSERT_EQ(1, map->size());
402+ ASSERT_EQ(1u, map->size());
403 er = (*map)[bad_key];
404 EXPECT_EQ(CacheEvent::invalidate, er.ev);
405 EXPECT_EQ(0, er.stats.size());
406@@ -2075,7 +2078,7 @@
407 // Both entries have expired. Even though we asked for a trim_to(1),
408 // both entries will be deleted as part of the trim_to().
409 map = &event_maps[CacheEvent::evict_ttl];
410- ASSERT_EQ(2, map->size());
411+ ASSERT_EQ(2u, map->size());
412 er = (*map)["1"];
413 EXPECT_EQ(CacheEvent::evict_ttl, er.ev);
414 // Entry "1" expired first so, when it is deleted, entry "2" is still around.
415@@ -2094,7 +2097,7 @@
416 c.trim_to(0);
417
418 map = &event_maps[CacheEvent::evict_lru];
419- ASSERT_EQ(2, map->size());
420+ ASSERT_EQ(2u, map->size());
421 er = (*map)["1"];
422 EXPECT_EQ(CacheEvent::evict_lru, er.ev);
423 // Entry "1" is oldest, so gets evicted first.
424
425=== modified file 'tests/core/persistent_cache/persistent_cache_test.cpp'
426--- tests/core/persistent_cache/persistent_cache_test.cpp 2015-08-05 00:11:19 +0000
427+++ tests/core/persistent_cache/persistent_cache_test.cpp 2016-11-28 07:42:15 +0000
428@@ -19,7 +19,11 @@
429 #include <core/persistent_cache.h>
430
431 #include <boost/filesystem.hpp>
432+
433+#pragma GCC diagnostic push
434+#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
435 #include <gtest/gtest.h>
436+#pragma GCC diagnostic pop
437
438 using namespace std;
439 using namespace core;
440@@ -212,15 +216,15 @@
441
442 typedef std::underlying_type<CacheEvent>::type EventValue;
443
444- EXPECT_EQ(0x7f, EventValue(AllCacheEvents));
445- EXPECT_EQ(0x7e, EventValue(~CacheEvent::get));
446- EXPECT_EQ(0x3, EventValue(CacheEvent::get | CacheEvent::put));
447- EXPECT_EQ(0x2, EventValue(AllCacheEvents & CacheEvent::put));
448+ EXPECT_EQ(0x7fu, EventValue(AllCacheEvents));
449+ EXPECT_EQ(0x7eu, EventValue(~CacheEvent::get));
450+ EXPECT_EQ(0x3u, EventValue(CacheEvent::get | CacheEvent::put));
451+ EXPECT_EQ(0x2u, EventValue(AllCacheEvents & CacheEvent::put));
452 CacheEvent v = CacheEvent::get | CacheEvent::put;
453 v |= CacheEvent::invalidate;
454- EXPECT_EQ(0x7, EventValue(v));
455+ EXPECT_EQ(0x7u, EventValue(v));
456 v &= ~CacheEvent::get;
457- EXPECT_EQ(0x6, EventValue(v));
458+ EXPECT_EQ(0x6u, EventValue(v));
459
460 // Loader methods
461
462
463=== modified file 'tests/core/persistent_string_cache/persistent_string_cache_test.cpp'
464--- tests/core/persistent_string_cache/persistent_string_cache_test.cpp 2015-12-09 06:15:09 +0000
465+++ tests/core/persistent_string_cache/persistent_string_cache_test.cpp 2016-11-28 07:42:15 +0000
466@@ -19,7 +19,11 @@
467 #include <core/persistent_string_cache.h>
468
469 #include <boost/filesystem.hpp>
470+
471+#pragma GCC diagnostic push
472+#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
473 #include <gtest/gtest.h>
474+#pragma GCC diagnostic pop
475
476 #include <thread>
477
478@@ -145,7 +149,7 @@
479 auto hist = s.histogram();
480 for (unsigned i = 0; i < hist.size(); ++i)
481 {
482- EXPECT_EQ(0, hist[i]); // Other bins must still be empty.
483+ EXPECT_EQ(0u, hist[i]); // Other bins must still be empty.
484 }
485 }
486
487
488=== modified file 'tests/core/persistent_string_cache/speed_test.cpp'
489--- tests/core/persistent_string_cache/speed_test.cpp 2015-07-21 06:22:48 +0000
490+++ tests/core/persistent_string_cache/speed_test.cpp 2016-11-28 07:42:15 +0000
491@@ -19,7 +19,11 @@
492 #include <core/persistent_string_cache.h>
493
494 #include <boost/filesystem.hpp>
495+
496+#pragma GCC diagnostic push
497+#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
498 #include <gtest/gtest.h>
499+#pragma GCC diagnostic pop
500
501 #include <chrono>
502 #include <iostream>

Subscribers

People subscribed via source and target branches

to all changes: