Merge lp:~brianaker/libmemcached/merge-1.0-april-2013 into lp:libmemcached
- merge-1.0-april-2013
- Merge into 1.2
Proposed by
Brian Aker
Status: | Merged |
---|---|
Merged at revision: | 1102 |
Proposed branch: | lp:~brianaker/libmemcached/merge-1.0-april-2013 |
Merge into: | lp:libmemcached |
Diff against target: |
1410 lines (+436/-154) 32 files modified
bootstrap.sh (+151/-23) clients/memflush.cc (+1/-1) clients/memping.cc (+1/-1) clients/memrm.cc (+1/-1) libmemcached/connect.cc (+5/-2) libtest/cmdline.cc (+27/-24) libtest/cmdline.h (+0/-3) libtest/common.h (+1/-1) libtest/dream.cc (+1/-1) libtest/drizzled.cc (+5/-5) libtest/framework.cc (+1/-1) libtest/framework.h (+1/-1) libtest/has.cc (+50/-4) libtest/has.hpp (+9/-1) libtest/include.am (+13/-2) libtest/lite.h (+2/-10) libtest/main.cc (+2/-3) libtest/memcached.cc (+5/-5) libtest/memcached.hpp (+1/-1) libtest/result.cc (+1/-0) libtest/run-ci.gdb (+1/-0) libtest/run.gdb (+1/-0) libtest/server_container.cc (+7/-5) libtest/signal.cc (+3/-7) libtest/unittest.cc (+9/-0) libtest/valgrind.h (+55/-0) libtest/vchar.cc (+5/-0) libtest/vchar.hpp (+3/-0) m4/ax_harden_compiler_flags.m4 (+66/-48) tests/keys.hpp (+3/-3) tests/libmemcached-1.0/mem_functions.cc (+1/-1) tests/libmemcached-1.0/sasl.cc (+4/-0) |
To merge this branch: | bzr merge lp:~brianaker/libmemcached/merge-1.0-april-2013 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tangent Trunk | Pending | ||
Review via email: mp+159924@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bootstrap.sh' |
2 | --- bootstrap.sh 2013-03-10 12:45:58 +0000 |
3 | +++ bootstrap.sh 2013-04-20 09:57:27 +0000 |
4 | @@ -151,7 +151,8 @@ |
5 | fi |
6 | } |
7 | |
8 | -# Valid values are: darwin,fedora,rhel,ubuntu |
9 | +# Validate the distribution name, or toss an erro |
10 | +# values: darwin,fedora,rhel,ubuntu,debian,opensuse |
11 | function set_VENDOR_DISTRIBUTION () |
12 | { |
13 | local dist=`echo "$1" | tr '[A-Z]' '[a-z]'` |
14 | @@ -165,9 +166,15 @@ |
15 | rhel) |
16 | VENDOR_DISTRIBUTION='rhel' |
17 | ;; |
18 | + debian) |
19 | + VENDOR_DISTRIBUTION='debian' |
20 | + ;; |
21 | ubuntu) |
22 | VENDOR_DISTRIBUTION='ubuntu' |
23 | ;; |
24 | + suse) |
25 | + VENDOR_DISTRIBUTION='opensuse' |
26 | + ;; |
27 | opensuse) |
28 | VENDOR_DISTRIBUTION='opensuse' |
29 | ;; |
30 | @@ -177,21 +184,49 @@ |
31 | esac |
32 | } |
33 | |
34 | +# Validate a Vendor's release name/number |
35 | function set_VENDOR_RELEASE () |
36 | { |
37 | local release=`echo "$1" | tr '[A-Z]' '[a-z]'` |
38 | case "$VENDOR_DISTRIBUTION" in |
39 | darwin) |
40 | - VENDOR_RELEASE='mountain' |
41 | + case "$VENDOR_DISTRIBUTION" in |
42 | + 10.6*) |
43 | + VENDOR_RELEASE='snow_leopard' |
44 | + ;; |
45 | + 10.7*) |
46 | + VENDOR_RELEASE='mountain' |
47 | + ;; |
48 | + mountain) |
49 | + VENDOR_RELEASE='mountain' |
50 | + ;; |
51 | + 10.8*) |
52 | + VENDOR_RELEASE='mountain_lion' |
53 | + ;; |
54 | + *) |
55 | + VENDOR_RELEASE='unknown' |
56 | + ;; |
57 | + esac |
58 | ;; |
59 | fedora) |
60 | VENDOR_RELEASE="$release" |
61 | + if [[ "x$VENDOR_RELEASE" == '18' ]]; then |
62 | + VENDOR_RELEASE='sphericalcow' |
63 | + fi |
64 | ;; |
65 | rhel) |
66 | VENDOR_RELEASE="$release" |
67 | ;; |
68 | + debian) |
69 | + VENDOR_RELEASE="$release" |
70 | + ;; |
71 | ubuntu) |
72 | VENDOR_RELEASE="$release" |
73 | + if [[ "x$VENDOR_RELEASE" == 'x12.04' ]]; then |
74 | + VENDOR_RELEASE="precise" |
75 | + elif [[ "x$VENDOR_RELEASE" == 'x12.10' ]]; then |
76 | + VENDOR_RELEASE="quantal" |
77 | + fi |
78 | ;; |
79 | opensuse) |
80 | VENDOR_RELEASE="$release" |
81 | @@ -206,7 +241,7 @@ |
82 | } |
83 | |
84 | |
85 | -# Valid values are: apple, redhat, centos, canonical |
86 | +# Valid values are: apple, redhat, centos, canonical, oracle, suse |
87 | function set_VENDOR () |
88 | { |
89 | local vendor=`echo "$1" | tr '[A-Z]' '[a-z]'` |
90 | @@ -218,12 +253,30 @@ |
91 | redhat) |
92 | VENDOR='redhat' |
93 | ;; |
94 | + fedora) |
95 | + VENDOR='redhat' |
96 | + ;; |
97 | + redhat-release-server-*) |
98 | + VENDOR='redhat' |
99 | + ;; |
100 | + enterprise-release-*) |
101 | + VENDOR='oracle' |
102 | + ;; |
103 | centos) |
104 | VENDOR='centos' |
105 | ;; |
106 | canonical) |
107 | VENDOR='canonical' |
108 | ;; |
109 | + ubuntu) |
110 | + VENDOR='canonical' |
111 | + ;; |
112 | + debian) |
113 | + VENDOR='debian' |
114 | + ;; |
115 | + opensuse) |
116 | + VENDOR='suse' |
117 | + ;; |
118 | suse) |
119 | VENDOR='suse' |
120 | ;; |
121 | @@ -234,6 +287,27 @@ |
122 | |
123 | set_VENDOR_DISTRIBUTION $2 |
124 | set_VENDOR_RELEASE $3 |
125 | + |
126 | + # Set which vendor/versions we trust for autoreconf |
127 | + case $VENDOR_DISTRIBUTION in |
128 | + fedora) |
129 | + if [[ "x$VENDOR_RELEASE" == 'x18' ]]; then |
130 | + AUTORECONF_REBUILD_HOST=true |
131 | + elif [[ "x$VENDOR_RELEASE" == 'xsphericalcow' ]]; then |
132 | + AUTORECONF_REBUILD_HOST=true |
133 | + elif [[ "x$VENDOR_RELEASE" == 'x19' ]]; then |
134 | + AUTORECONF_REBUILD_HOST=true |
135 | + fi |
136 | + ;; |
137 | + canonical) |
138 | + if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then |
139 | + AUTORECONF_REBUILD_HOST=true |
140 | + elif [[ "x$VENDOR_RELEASE" == 'xquantal' ]]; then |
141 | + AUTORECONF_REBUILD_HOST=true |
142 | + fi |
143 | + ;; |
144 | + esac |
145 | + |
146 | } |
147 | |
148 | function determine_target_platform () |
149 | @@ -242,14 +316,14 @@ |
150 | UNAME_KERNEL=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown |
151 | UNAME_KERNEL_RELEASE=`(uname -r) 2>/dev/null` || UNAME_KERNEL_RELEASE=unknown |
152 | |
153 | - if [[ $(uname) == 'Darwin' ]]; then |
154 | + if [[ -x '/usr/bin/sw_vers' ]]; then |
155 | + local _VERSION=`/usr/bin/sw_vers -productVersion` |
156 | + set_VENDOR 'apple' 'darwin' $_VERSION |
157 | + elif [[ $(uname) == 'Darwin' ]]; then |
158 | set_VENDOR 'apple' 'darwin' 'mountain' |
159 | elif [[ -f '/etc/fedora-release' ]]; then |
160 | local fedora_version=`cat /etc/fedora-release | awk ' { print $3 } '` |
161 | set_VENDOR 'redhat' 'fedora' $fedora_version |
162 | - if [[ "x$VENDOR_RELEASE" == 'x17' ]]; then |
163 | - AUTORECONF_REBUILD_HOST=true |
164 | - fi |
165 | elif [[ -f '/etc/centos-release' ]]; then |
166 | local centos_version=`cat /etc/centos-release | awk ' { print $7 } '` |
167 | set_VENDOR 'centos' 'rhel' $centos_version |
168 | @@ -259,14 +333,18 @@ |
169 | set_VENDOR 'suse' $suse_distribution $suse_version |
170 | elif [[ -f '/etc/redhat-release' ]]; then |
171 | local rhel_version=`cat /etc/redhat-release | awk ' { print $7 } '` |
172 | - set_VENDOR 'redhat' 'rhel' $rhel_version |
173 | + local _vendor=`rpm -qf /etc/redhat-release` |
174 | + set_VENDOR $_vendor 'rhel' $rhel_version |
175 | + elif [[ -f '/etc/os-release' ]]; then |
176 | + source '/etc/os-release' |
177 | + set_VENDOR $ID $ID $VERSION_ID |
178 | + elif [[ -x '/usr/bin/lsb_release' ]]; then |
179 | + local _ID=`/usr/bin/lsb_release -s -i` |
180 | + local _VERSION=`/usr/bin/lsb_release -s -r` |
181 | + set_VENDOR $_ID $_ID $_VERSION_ID |
182 | elif [[ -f '/etc/lsb-release' ]]; then |
183 | - local debian_DISTRIB_ID=`cat /etc/lsb-release | grep DISTRIB_ID | awk -F= ' { print $2 } '` |
184 | - local debian_version=`cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F= ' { print $2 } '` |
185 | - set_VENDOR 'canonical' $debian_DISTRIB_ID $debian_version |
186 | - if [[ "x$VENDOR_RELEASE" == 'xprecise' ]]; then |
187 | - AUTORECONF_REBUILD_HOST=true |
188 | - fi |
189 | + source '/etc/lsb-release' |
190 | + set_VENDOR 'canonical' $DISTRIB_ID $DISTRIB_CODENAME |
191 | fi |
192 | |
193 | rebuild_host_os |
194 | @@ -808,7 +886,7 @@ |
195 | |
196 | make_install_system |
197 | ;; |
198 | - *-ubuntu-quantal-*) |
199 | + *-precise-*) |
200 | run_configure |
201 | |
202 | assert_exec_file 'configure' |
203 | @@ -996,6 +1074,13 @@ |
204 | assert_file 'Makefile' 'configure did not produce a Makefile' |
205 | } |
206 | |
207 | +function run_make_maintainer_clean_if_possible () |
208 | +{ |
209 | + if [ -f 'Makefile' ]; then |
210 | + make_maintainer_clean |
211 | + fi |
212 | +} |
213 | + |
214 | function run_autoreconf_if_required () |
215 | { |
216 | if [ ! -x 'configure' ]; then |
217 | @@ -1003,6 +1088,7 @@ |
218 | fi |
219 | |
220 | assert_exec_file 'configure' |
221 | + bash -n configure |
222 | } |
223 | |
224 | function run_autoreconf () |
225 | @@ -1068,6 +1154,14 @@ |
226 | ;; |
227 | h) # help |
228 | echo "bootstrap.sh [options] optional_target ..." |
229 | + echo " -a # Just run autoreconf"; |
230 | + echo " -p # Print ENV"; |
231 | + echo " -c # Just run configure"; |
232 | + echo " -m # Just run maintainer-clean"; |
233 | + echo " -t # Make target"; |
234 | + echo " -d # Enable debug"; |
235 | + echo " -h # Show help"; |
236 | + echo " -v # Be more verbose in output"; |
237 | exit |
238 | ;; |
239 | v) # verbose |
240 | @@ -1169,6 +1263,7 @@ |
241 | |
242 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
243 | echo "Couldn't find user supplied libtoolize, it is required" |
244 | + return 1 |
245 | fi |
246 | else |
247 | # If we are using OSX, we first check to see glibtoolize is available |
248 | @@ -1177,12 +1272,14 @@ |
249 | |
250 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
251 | echo "Couldn't find glibtoolize, it is required on OSX" |
252 | + return 1 |
253 | fi |
254 | else |
255 | BOOTSTRAP_LIBTOOLIZE=`type -p libtoolize` |
256 | |
257 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
258 | echo "Couldn't find libtoolize, it is required" |
259 | + return 1 |
260 | fi |
261 | fi |
262 | fi |
263 | @@ -1247,6 +1344,9 @@ |
264 | echo 'BOOTSTRAP ENV' |
265 | echo "AUTORECONF=$AUTORECONF" |
266 | echo "HOST_OS=$HOST_OS" |
267 | + echo "VENDOR=$VENDOR" |
268 | + echo "VENDOR_DISTRIBUTION=$VENDOR_DISTRIBUTION" |
269 | + echo "VENDOR_RELEASE=$VENDOR_RELEASE" |
270 | |
271 | echo "getopt()" |
272 | if $AUTORECONF_OPTION; then |
273 | @@ -1384,18 +1484,21 @@ |
274 | ;; |
275 | 'clang-analyzer') |
276 | ;; |
277 | - 'test-*') |
278 | - ;; |
279 | - 'valgrind-*') |
280 | - ;; |
281 | - 'gdb-*') |
282 | + test-*) |
283 | + ;; |
284 | + valgrind-*) |
285 | + ;; |
286 | + gdb-*) |
287 | ;; |
288 | 'dist') |
289 | ;; |
290 | *) |
291 | - die "Unknown MAKE_TARGET option: $1" |
292 | + echo "Matched default" |
293 | + return 1 |
294 | ;; |
295 | esac |
296 | + |
297 | + return 0 |
298 | } |
299 | |
300 | function bootstrap () |
301 | @@ -1406,7 +1509,9 @@ |
302 | |
303 | # Set up whatever we need to do to use autoreconf later |
304 | require_libtoolise |
305 | - autoreconf_setup |
306 | + if ! autoreconf_setup; then |
307 | + return 1 |
308 | + fi |
309 | |
310 | if [ -z "$MAKE_TARGET" ]; then |
311 | MAKE_TARGET="make_default" |
312 | @@ -1441,8 +1546,14 @@ |
313 | # If we are running inside of Jenkins, we want to only run some of the possible tests |
314 | if $jenkins_build_environment; then |
315 | check_make_target $target |
316 | + ret=$? |
317 | + if [ $ret -ne 0 ]; then |
318 | + die "Unknown MAKE_TARGET option: $target" |
319 | + fi |
320 | fi |
321 | |
322 | + local snapshot_run=false |
323 | + |
324 | case $target in |
325 | 'self') |
326 | self_test |
327 | @@ -1500,6 +1611,7 @@ |
328 | ;; |
329 | 'snapshot') |
330 | make_for_snapshot |
331 | + snapshot_run=true |
332 | ;; |
333 | 'rpm') |
334 | make_rpm |
335 | @@ -1518,6 +1630,13 @@ |
336 | make_target "$target" |
337 | ;; |
338 | esac |
339 | + |
340 | + if $jenkins_build_environment; then |
341 | + if ! $snapshot_run; then |
342 | + run_make_maintainer_clean_if_possible |
343 | + fi |
344 | + fi |
345 | + |
346 | done |
347 | } |
348 | |
349 | @@ -1586,7 +1705,16 @@ |
350 | # We don't want Jenkins overriding other variables, so we NULL them. |
351 | if [ -z "$MAKE_TARGET" ]; then |
352 | if $jenkins_build_environment; then |
353 | - MAKE_TARGET='jenkins' |
354 | + if [[ -n "$label" ]]; then |
355 | + check_make_target $label |
356 | + if [ $? -eq 0 ]; then |
357 | + MAKE_TARGET="$label" |
358 | + fi |
359 | + fi |
360 | + |
361 | + if [ -z "$MAKE_TARGET" ]; then |
362 | + MAKE_TARGET='jenkins' |
363 | + fi |
364 | fi |
365 | fi |
366 | |
367 | |
368 | === modified file 'clients/memflush.cc' |
369 | --- clients/memflush.cc 2013-04-03 13:14:23 +0000 |
370 | +++ clients/memflush.cc 2013-04-20 09:57:27 +0000 |
371 | @@ -159,7 +159,7 @@ |
372 | opt_expire= (time_t)strtoll(optarg, (char **)NULL, 10); |
373 | if (errno != 0) |
374 | { |
375 | - std::cerr << "Incorrect value passed to --expire: `" << optarg << "`" << std::cerr; |
376 | + std::cerr << "Incorrect value passed to --expire: `" << optarg << "`" << std::endl; |
377 | exit(EXIT_FAILURE); |
378 | } |
379 | break; |
380 | |
381 | === modified file 'clients/memping.cc' |
382 | --- clients/memping.cc 2013-04-03 13:14:23 +0000 |
383 | +++ clients/memping.cc 2013-04-20 09:57:27 +0000 |
384 | @@ -160,7 +160,7 @@ |
385 | opt_expire= time_t(strtoll(optarg, (char **)NULL, 10)); |
386 | if (errno != 0) |
387 | { |
388 | - std::cerr << "Incorrect value passed to --expire: `" << optarg << "`" << std::cerr; |
389 | + std::cerr << "Incorrect value passed to --expire: `" << optarg << "`" << std::endl; |
390 | exit(EXIT_FAILURE); |
391 | } |
392 | break; |
393 | |
394 | === modified file 'clients/memrm.cc' |
395 | --- clients/memrm.cc 2013-04-03 13:14:23 +0000 |
396 | +++ clients/memrm.cc 2013-04-20 09:57:27 +0000 |
397 | @@ -214,7 +214,7 @@ |
398 | opt_expire= (time_t)strtoll(optarg, (char **)NULL, 10); |
399 | if (errno != 0) |
400 | { |
401 | - std::cerr << "Incorrect value passed to --expire: `" << optarg << "`" << std::cerr; |
402 | + std::cerr << "Incorrect value passed to --expire: `" << optarg << "`" << std::endl; |
403 | exit(EXIT_FAILURE); |
404 | } |
405 | break; |
406 | |
407 | === modified file 'libmemcached/connect.cc' |
408 | --- libmemcached/connect.cc 2013-03-31 23:24:29 +0000 |
409 | +++ libmemcached/connect.cc 2013-04-20 09:57:27 +0000 |
410 | @@ -186,9 +186,10 @@ |
411 | assert(server->type != MEMCACHED_CONNECTION_UNIX_SOCKET); |
412 | server->clear_addrinfo(); |
413 | |
414 | - char str_port[MEMCACHED_NI_MAXSERV]; |
415 | + char str_port[MEMCACHED_NI_MAXSERV]= { 0 }; |
416 | + errno= 0; |
417 | int length= snprintf(str_port, MEMCACHED_NI_MAXSERV, "%u", uint32_t(server->port())); |
418 | - if (length >= MEMCACHED_NI_MAXSERV or length <= 0) |
419 | + if (length >= MEMCACHED_NI_MAXSERV or length <= 0 or errno != 0) |
420 | { |
421 | return memcached_set_error(*server, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT, |
422 | memcached_literal_param("snprintf(NI_MAXSERV)")); |
423 | @@ -759,6 +760,7 @@ |
424 | case MEMCACHED_CONNECTION_TCP: |
425 | rc= network_connect(server); |
426 | |
427 | +#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT |
428 | if (LIBMEMCACHED_WITH_SASL_SUPPORT) |
429 | { |
430 | if (server->fd != INVALID_SOCKET and server->root->sasl.callbacks) |
431 | @@ -771,6 +773,7 @@ |
432 | } |
433 | } |
434 | } |
435 | +#endif |
436 | break; |
437 | |
438 | case MEMCACHED_CONNECTION_UNIX_SOCKET: |
439 | |
440 | === modified file 'libtest/cmdline.cc' |
441 | --- libtest/cmdline.cc 2013-01-25 02:26:50 +0000 |
442 | +++ libtest/cmdline.cc 2013-04-20 09:57:27 +0000 |
443 | @@ -2,7 +2,7 @@ |
444 | * |
445 | * Data Differential YATL (i.e. libtest) library |
446 | * |
447 | - * Copyright (C) 2012 Data Differential, http://datadifferential.com/ |
448 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
449 | * |
450 | * Redistribution and use in source and binary forms, with or without |
451 | * modification, are permitted provided that the following conditions are |
452 | @@ -412,7 +412,6 @@ |
453 | slurp(); |
454 | if (waited_pid == _pid and WIFEXITED(_status) == false) |
455 | { |
456 | - |
457 | /* |
458 | What we are looking for here is how the exit status happened. |
459 | - 127 means that posix_spawn() itself had an error. |
460 | @@ -437,15 +436,18 @@ |
461 | { |
462 | if (WTERMSIG(_status) != SIGTERM and WTERMSIG(_status) != SIGHUP) |
463 | { |
464 | + slurp(); |
465 | _app_exit_state= Application::INVALID_POSIX_SPAWN; |
466 | std::string error_string(print_argv(built_argv)); |
467 | error_string+= " was killed by signal "; |
468 | error_string+= strsignal(WTERMSIG(_status)); |
469 | + |
470 | if (stdout_result_length()) |
471 | { |
472 | error_string+= " stdout: "; |
473 | error_string+= stdout_c_str(); |
474 | } |
475 | + |
476 | if (stderr_result_length()) |
477 | { |
478 | error_string+= " stderr: "; |
479 | @@ -479,8 +481,20 @@ |
480 | } |
481 | else if (waited_pid == -1) |
482 | { |
483 | + std::string error_string; |
484 | + if (stdout_result_length()) |
485 | + { |
486 | + error_string+= " stdout: "; |
487 | + error_string+= stdout_c_str(); |
488 | + } |
489 | + |
490 | + if (stderr_result_length()) |
491 | + { |
492 | + error_string+= " stderr: "; |
493 | + error_string+= stderr_c_str(); |
494 | + } |
495 | + Error << "waitpid() returned errno:" << strerror(errno) << " " << error_string; |
496 | _app_exit_state= Application::UNKNOWN; |
497 | - Error << "waitpid() returned errno:" << strerror(errno); |
498 | } |
499 | else |
500 | { |
501 | @@ -573,6 +587,7 @@ |
502 | void Application::Pipe::nonblock() |
503 | { |
504 | int flags; |
505 | + do |
506 | { |
507 | flags= fcntl(_pipe_fd[READ], F_GETFL, 0); |
508 | } while (flags == -1 and (errno == EINTR or errno == EAGAIN)); |
509 | @@ -601,23 +616,21 @@ |
510 | close(READ); |
511 | close(WRITE); |
512 | |
513 | -#if defined(HAVE_PIPE2) && HAVE_PIPE2 |
514 | +#ifdef HAVE_PIPE2 |
515 | if (pipe2(_pipe_fd, O_NONBLOCK|O_CLOEXEC) == -1) |
516 | -#else |
517 | - if (pipe(_pipe_fd) == -1) |
518 | #endif |
519 | { |
520 | - FATAL(strerror(errno)); |
521 | + if (pipe(_pipe_fd) == -1) |
522 | + { |
523 | + FATAL(strerror(errno)); |
524 | + } |
525 | + |
526 | + // Since either pipe2() was not found/called we set the pipe directly |
527 | + nonblock(); |
528 | + cloexec(); |
529 | } |
530 | _open[0]= true; |
531 | _open[1]= true; |
532 | - |
533 | -#if defined(HAVE_PIPE2) && HAVE_PIPE2 |
534 | - { |
535 | - nonblock(); |
536 | - cloexec(); |
537 | - } |
538 | -#endif |
539 | } |
540 | |
541 | void Application::Pipe::cloexec() |
542 | @@ -817,14 +830,4 @@ |
543 | return int(app.join()); |
544 | } |
545 | |
546 | -const char *gearmand_binary() |
547 | -{ |
548 | - return GEARMAND_BINARY; |
549 | -} |
550 | - |
551 | -const char *drizzled_binary() |
552 | -{ |
553 | - return DRIZZLED_BINARY; |
554 | -} |
555 | - |
556 | } // namespace exec_cmdline |
557 | |
558 | === modified file 'libtest/cmdline.h' |
559 | --- libtest/cmdline.h 2013-01-25 02:26:50 +0000 |
560 | +++ libtest/cmdline.h 2013-04-20 09:57:27 +0000 |
561 | @@ -245,7 +245,4 @@ |
562 | |
563 | int exec_cmdline(const std::string& executable, const char *args[], bool use_libtool= false); |
564 | |
565 | -const char *gearmand_binary(); |
566 | -const char *drizzled_binary(); |
567 | - |
568 | } |
569 | |
570 | === modified file 'libtest/common.h' |
571 | --- libtest/common.h 2013-02-04 01:35:06 +0000 |
572 | +++ libtest/common.h 2013-04-20 09:57:27 +0000 |
573 | @@ -69,7 +69,7 @@ |
574 | # include <arpa/inet.h> |
575 | #endif |
576 | |
577 | -#if defined(_WIN32) |
578 | +#if defined(WIN32) |
579 | # include "win32/wrappers.h" |
580 | # define get_socket_errno() WSAGetLastError() |
581 | #else |
582 | |
583 | === modified file 'libtest/dream.cc' |
584 | --- libtest/dream.cc 2013-02-04 01:35:06 +0000 |
585 | +++ libtest/dream.cc 2013-04-20 09:57:27 +0000 |
586 | @@ -41,7 +41,7 @@ |
587 | |
588 | void dream(time_t tv_sec, long tv_nsec) |
589 | { |
590 | -#if defined(_WIN32) |
591 | +#if defined(WIN32) |
592 | if (tv_sec == 0 and tv_nsec) |
593 | { |
594 | tv_sec++; |
595 | |
596 | === modified file 'libtest/drizzled.cc' |
597 | --- libtest/drizzled.cc 2013-01-24 11:17:17 +0000 |
598 | +++ libtest/drizzled.cc 2013-04-20 09:57:27 +0000 |
599 | @@ -74,11 +74,11 @@ |
600 | #if defined(HAVE_LIBDRIZZLE) && HAVE_LIBDRIZZLE |
601 | if (HAVE_LIBDRIZZLE) |
602 | { |
603 | - drizzle_st *drizzle= drizzle_create_tcp(getenv("MYSQL_SERVER"), |
604 | - getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT, |
605 | - getenv("MYSQL_USER"), |
606 | - getenv("MYSQL_PASSWORD"), |
607 | - getenv("MYSQL_SCHEMA"), drizzle_options_t()); |
608 | + drizzle_st *drizzle= drizzle_create(getenv("MYSQL_SERVER"), |
609 | + getenv("MYSQL_PORT") ? atoi("MYSQL_PORT") : DRIZZLE_DEFAULT_TCP_PORT, |
610 | + getenv("MYSQL_USER"), |
611 | + getenv("MYSQL_PASSWORD"), |
612 | + getenv("MYSQL_SCHEMA"), 0); |
613 | |
614 | if (drizzle == NULL) |
615 | { |
616 | |
617 | === modified file 'libtest/framework.cc' |
618 | --- libtest/framework.cc 2013-01-24 11:17:17 +0000 |
619 | +++ libtest/framework.cc 2013-04-20 09:57:27 +0000 |
620 | @@ -68,7 +68,7 @@ |
621 | get_world(this); |
622 | } |
623 | |
624 | -void Framework::collections(collection_st* collections_) |
625 | +void Framework::collections(collection_st collections_[]) |
626 | { |
627 | for (collection_st *next= collections_; next and next->name; next++) |
628 | { |
629 | |
630 | === modified file 'libtest/framework.h' |
631 | --- libtest/framework.h 2013-01-24 11:17:17 +0000 |
632 | +++ libtest/framework.h 2013-04-20 09:57:27 +0000 |
633 | @@ -72,7 +72,7 @@ |
634 | _destroy= arg; |
635 | } |
636 | |
637 | - void collections(collection_st* arg); |
638 | + void collections(collection_st arg[]); |
639 | |
640 | void set_on_error(test_callback_error_fn *arg) |
641 | { |
642 | |
643 | === modified file 'libtest/has.cc' |
644 | --- libtest/has.cc 2012-12-09 11:40:11 +0000 |
645 | +++ libtest/has.cc 2013-04-20 09:57:27 +0000 |
646 | @@ -2,7 +2,7 @@ |
647 | * |
648 | * Data Differential YATL (i.e. libtest) library |
649 | * |
650 | - * Copyright (C) 2012 Data Differential, http://datadifferential.com/ |
651 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
652 | * |
653 | * Redistribution and use in source and binary forms, with or without |
654 | * modification, are permitted provided that the following conditions are |
655 | @@ -37,6 +37,7 @@ |
656 | #include "libtest/yatlcon.h" |
657 | #include <libtest/common.h> |
658 | |
659 | +#include <cstdio> |
660 | #include <cstdlib> |
661 | #include <unistd.h> |
662 | |
663 | @@ -138,14 +139,17 @@ |
664 | return false; |
665 | } |
666 | |
667 | -bool has_memcached() |
668 | +static char memcached_binary_path[FILENAME_MAX]; |
669 | + |
670 | +static void initialize_curl_startup() |
671 | { |
672 | + memcached_binary_path[0]= NULL; |
673 | + |
674 | #if defined(HAVE_MEMCACHED_BINARY) && HAVE_MEMCACHED_BINARY |
675 | if (HAVE_MEMCACHED_BINARY) |
676 | { |
677 | std::stringstream arg_buffer; |
678 | |
679 | - |
680 | char *getenv_ptr; |
681 | if (bool((getenv_ptr= getenv("PWD"))) and strcmp(MEMCACHED_BINARY, "memcached/memcached") == 0) |
682 | { |
683 | @@ -156,14 +160,46 @@ |
684 | |
685 | if (access(arg_buffer.str().c_str(), X_OK) == 0) |
686 | { |
687 | - return true; |
688 | + strncpy(memcached_binary_path, arg_buffer.str().c_str(), FILENAME_MAX); |
689 | } |
690 | } |
691 | #endif |
692 | +} |
693 | + |
694 | +static pthread_once_t memcached_binary_once= PTHREAD_ONCE_INIT; |
695 | +static void initialize_memcached_binary(void) |
696 | +{ |
697 | + int ret; |
698 | + if ((ret= pthread_once(&memcached_binary_once, initialize_curl_startup)) != 0) |
699 | + { |
700 | + FATAL(strerror(ret)); |
701 | + } |
702 | +} |
703 | + |
704 | +bool has_memcached() |
705 | +{ |
706 | + initialize_memcached_binary(); |
707 | + |
708 | + if (memcached_binary_path[0]) |
709 | + { |
710 | + return true; |
711 | + } |
712 | |
713 | return false; |
714 | } |
715 | |
716 | +const char* memcached_binary() |
717 | +{ |
718 | + initialize_memcached_binary(); |
719 | + |
720 | + if (memcached_binary_path[0]) |
721 | + { |
722 | + return memcached_binary_path; |
723 | + } |
724 | + |
725 | + return NULL; |
726 | +} |
727 | + |
728 | bool has_memcached_sasl() |
729 | { |
730 | #if defined(HAVE_MEMCACHED_SASL_BINARY) && HAVE_MEMCACHED_SASL_BINARY |
731 | @@ -179,4 +215,14 @@ |
732 | return false; |
733 | } |
734 | |
735 | +const char *gearmand_binary() |
736 | +{ |
737 | + return GEARMAND_BINARY; |
738 | +} |
739 | + |
740 | +const char *drizzled_binary() |
741 | +{ |
742 | + return DRIZZLED_BINARY; |
743 | +} |
744 | + |
745 | } // namespace libtest |
746 | |
747 | === modified file 'libtest/has.hpp' |
748 | --- libtest/has.hpp 2012-06-07 15:09:42 +0000 |
749 | +++ libtest/has.hpp 2013-04-20 09:57:27 +0000 |
750 | @@ -2,7 +2,7 @@ |
751 | * |
752 | * Data Differential YATL (i.e. libtest) library |
753 | * |
754 | - * Copyright (C) 2012 Data Differential, http://datadifferential.com/ |
755 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
756 | * |
757 | * Redistribution and use in source and binary forms, with or without |
758 | * modification, are permitted provided that the following conditions are |
759 | @@ -62,4 +62,12 @@ |
760 | LIBTEST_API |
761 | bool has_mysqld(); |
762 | |
763 | +LIBTEST_API |
764 | +const char* memcached_binary(); |
765 | + |
766 | +LIBTEST_API |
767 | +const char *gearmand_binary(); |
768 | + |
769 | +LIBTEST_API |
770 | +const char *drizzled_binary(); |
771 | } // namespace libtest |
772 | |
773 | === modified file 'libtest/include.am' |
774 | --- libtest/include.am 2013-01-25 22:16:25 +0000 |
775 | +++ libtest/include.am 2013-04-20 09:57:27 +0000 |
776 | @@ -5,10 +5,12 @@ |
777 | # |
778 | |
779 | LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute |
780 | -VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE |
781 | +VALGRIND_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=memcheck --error-exitcode=1 --leak-check=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE |
782 | +SGCHECK_EXEC_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-sgcheck --error-exitcode=1 |
783 | VALGRIND_COMMAND= TESTS_ENVIRONMENT="valgrind" $(VALGRIND_EXEC_COMMAND) |
784 | HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes |
785 | -DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd |
786 | +DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd --error-exitcode=1 |
787 | +SGCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-sgcheck --error-exitcode=1 |
788 | MASSIF_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=massif |
789 | GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb |
790 | PTRCHECK_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=exp-ptrcheck --error-exitcode=1 |
791 | @@ -19,11 +21,15 @@ |
792 | export VALGRIND_COMMAND |
793 | export HELGRIND_COMMAND |
794 | export DRD_COMMAND |
795 | +export SGCHECK_COMMAND |
796 | export GDB_COMMAND |
797 | |
798 | valgrind: |
799 | @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_EXEC_COMMAND)\"" |
800 | |
801 | +sgcheck: |
802 | + @echo make check TESTS_ENVIRONMENT="\"$(SGCHECK_EXEC_COMMAND)\"" |
803 | + |
804 | valgrind-supressions: |
805 | @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_SUPRESSION)\"" |
806 | |
807 | @@ -96,6 +102,7 @@ |
808 | noinst_HEADERS+= libtest/thread.hpp |
809 | noinst_HEADERS+= libtest/tmpfile.hpp |
810 | noinst_HEADERS+= libtest/lite.h |
811 | +noinst_HEADERS+= libtest/valgrind.h |
812 | noinst_HEADERS+= libtest/vchar.hpp |
813 | noinst_HEADERS+= libtest/version.h |
814 | noinst_HEADERS+= libtest/visibility.h |
815 | @@ -204,6 +211,10 @@ |
816 | drd-unittest: libtest/unittest |
817 | @$(DRD_COMMAND) libtest/unittest |
818 | |
819 | +sgcheck-unittest: libtest/unittest |
820 | + echo $(SGCHECK_COMMAND) |
821 | + @$(SGCHECK_COMMAND) libtest/unittest |
822 | + |
823 | libtest_skiptest_LDADD= libtest/libtest.la |
824 | libtest_skiptest_SOURCES= libtest/skiptest.cc |
825 | check_PROGRAMS+= libtest/skiptest |
826 | |
827 | === modified file 'libtest/lite.h' |
828 | --- libtest/lite.h 2013-02-23 21:43:42 +0000 |
829 | +++ libtest/lite.h 2013-04-20 09:57:27 +0000 |
830 | @@ -51,7 +51,7 @@ |
831 | # include <string.h> |
832 | #endif |
833 | |
834 | -#if defined(_WIN32) |
835 | +#if defined(WIN32) |
836 | # include <malloc.h> |
837 | #else |
838 | # include <alloca.h> |
839 | @@ -77,15 +77,7 @@ |
840 | # define SKIP(__message_format, ...) |
841 | #endif |
842 | |
843 | -static inline bool valgrind_is_caller(void) |
844 | -{ |
845 | - if (getenv("TESTS_ENVIRONMENT") && strstr(getenv("TESTS_ENVIRONMENT"), "valgrind")) |
846 | - { |
847 | - return true; |
848 | - } |
849 | - |
850 | - return false; |
851 | -} |
852 | +#include <libtest/valgrind.h> |
853 | |
854 | static inline size_t yatl_strlen(const char *s) |
855 | { |
856 | |
857 | === modified file 'libtest/main.cc' |
858 | --- libtest/main.cc 2013-02-23 10:17:33 +0000 |
859 | +++ libtest/main.cc 2013-04-20 09:57:27 +0000 |
860 | @@ -165,7 +165,6 @@ |
861 | Error << "unknown value passed to --repeat: `" << optarg << "`"; |
862 | exit(EXIT_FAILURE); |
863 | } |
864 | - |
865 | break; |
866 | |
867 | case OPT_LIBYATL_MATCH_COLLECTION: |
868 | @@ -383,9 +382,9 @@ |
869 | std::cerr << "std::exception:" << e.what() << std::endl; |
870 | exit_code= EXIT_FAILURE; |
871 | } |
872 | - catch (char const*) |
873 | + catch (char const* s) |
874 | { |
875 | - std::cerr << "Exception:" << std::endl; |
876 | + std::cerr << "Exception:" << s << std::endl; |
877 | exit_code= EXIT_FAILURE; |
878 | } |
879 | catch (...) |
880 | |
881 | === modified file 'libtest/memcached.cc' |
882 | --- libtest/memcached.cc 2013-01-28 22:51:05 +0000 |
883 | +++ libtest/memcached.cc 2013-04-20 09:57:27 +0000 |
884 | @@ -75,14 +75,14 @@ |
885 | const std::string& username_arg, |
886 | const std::string& password_arg) : |
887 | libtest::Server(host_arg, port_arg, |
888 | - MEMCACHED_BINARY, false, is_socket_arg), |
889 | + memcached_binary(), false, is_socket_arg), |
890 | _username(username_arg), |
891 | _password(password_arg) |
892 | { } |
893 | |
894 | Memcached(const std::string& host_arg, const in_port_t port_arg, const bool is_socket_arg) : |
895 | libtest::Server(host_arg, port_arg, |
896 | - MEMCACHED_BINARY, false, is_socket_arg) |
897 | + memcached_binary(), false, is_socket_arg) |
898 | { |
899 | set_pid_file(); |
900 | } |
901 | @@ -134,7 +134,7 @@ |
902 | |
903 | const char *executable() |
904 | { |
905 | - return MEMCACHED_BINARY; |
906 | + return memcached_binary(); |
907 | } |
908 | |
909 | bool is_libtool() |
910 | @@ -221,7 +221,7 @@ |
911 | |
912 | libtest::Server *build_memcached(const std::string& hostname, const in_port_t try_port) |
913 | { |
914 | - if (HAVE_MEMCACHED_BINARY) |
915 | + if (has_memcached()) |
916 | { |
917 | return new Memcached(hostname, try_port, false); |
918 | } |
919 | @@ -231,7 +231,7 @@ |
920 | |
921 | libtest::Server *build_memcached_socket(const std::string& socket_file, const in_port_t try_port) |
922 | { |
923 | - if (HAVE_MEMCACHED_BINARY) |
924 | + if (has_memcached()) |
925 | { |
926 | return new Memcached(socket_file, try_port, true); |
927 | } |
928 | |
929 | === modified file 'libtest/memcached.hpp' |
930 | --- libtest/memcached.hpp 2013-02-23 21:43:42 +0000 |
931 | +++ libtest/memcached.hpp 2013-04-20 09:57:27 +0000 |
932 | @@ -39,7 +39,7 @@ |
933 | #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED |
934 | inline bool operator== (const memcached_st& memc, const memcached_return_t rc) |
935 | { |
936 | - if (memcached_last_error(&memc) == rc) |
937 | + if (memcached_last_error(const_cast<memcached_st *>(&memc)) == rc) |
938 | { |
939 | return true; |
940 | } |
941 | |
942 | === modified file 'libtest/result.cc' |
943 | --- libtest/result.cc 2013-01-24 11:17:17 +0000 |
944 | +++ libtest/result.cc 2013-04-20 09:57:27 +0000 |
945 | @@ -69,6 +69,7 @@ |
946 | } |
947 | |
948 | __test_result::__test_result(const __test_result& other) : |
949 | + std::exception(), |
950 | _line(other._line), |
951 | _file(other._file), |
952 | _func(other._func), |
953 | |
954 | === modified file 'libtest/run-ci.gdb' |
955 | --- libtest/run-ci.gdb 2012-06-03 00:05:52 +0000 |
956 | +++ libtest/run-ci.gdb 2013-04-20 09:57:27 +0000 |
957 | @@ -1,6 +1,7 @@ |
958 | set logging on |
959 | set logging overwrite on |
960 | set environment LIBTEST_IN_GDB=1 |
961 | +set ASAN_OPTIONS=abort_on_error=1 |
962 | run |
963 | thread apply all bt |
964 | quit |
965 | |
966 | === modified file 'libtest/run.gdb' |
967 | --- libtest/run.gdb 2012-03-26 01:08:09 +0000 |
968 | +++ libtest/run.gdb 2013-04-20 09:57:27 +0000 |
969 | @@ -1,5 +1,6 @@ |
970 | set logging on |
971 | set logging overwrite on |
972 | set environment LIBTEST_IN_GDB=1 |
973 | +#set ASAN_OPTIONS=abort_on_error=1 |
974 | run |
975 | thread apply all bt |
976 | |
977 | === modified file 'libtest/server_container.cc' |
978 | --- libtest/server_container.cc 2013-01-24 11:17:17 +0000 |
979 | +++ libtest/server_container.cc 2013-04-20 09:57:27 +0000 |
980 | @@ -215,9 +215,9 @@ |
981 | } |
982 | else if (server_type.compare("drizzled") == 0) |
983 | { |
984 | - if (DRIZZLED_BINARY) |
985 | + if (has_drizzled()) |
986 | { |
987 | - if (HAVE_LIBDRIZZLE) |
988 | + if (has_libdrizzle()) |
989 | { |
990 | server= build_drizzled("localhost", try_port); |
991 | } |
992 | @@ -225,8 +225,9 @@ |
993 | } |
994 | else if (server_type.compare("blobslap_worker") == 0) |
995 | { |
996 | - if (GEARMAND_BINARY) |
997 | + if (has_gearmand()) |
998 | { |
999 | +#ifdef GEARMAND_BLOBSLAP_WORKER |
1000 | if (GEARMAND_BLOBSLAP_WORKER) |
1001 | { |
1002 | if (HAVE_LIBGEARMAN) |
1003 | @@ -234,11 +235,12 @@ |
1004 | server= build_blobslap_worker(try_port); |
1005 | } |
1006 | } |
1007 | +#endif // GEARMAND_BLOBSLAP_WORKER |
1008 | } |
1009 | } |
1010 | else if (server_type.compare("memcached") == 0) |
1011 | { |
1012 | - if (HAVE_MEMCACHED_BINARY) |
1013 | + if (has_memcached()) |
1014 | { |
1015 | server= build_memcached("localhost", try_port); |
1016 | } |
1017 | @@ -327,7 +329,7 @@ |
1018 | else |
1019 | { |
1020 | { |
1021 | -#if defined(DEBUG) |
1022 | +#ifdef DEBUG |
1023 | if (DEBUG) |
1024 | { |
1025 | Outn(); |
1026 | |
1027 | === modified file 'libtest/signal.cc' |
1028 | --- libtest/signal.cc 2013-01-24 11:17:17 +0000 |
1029 | +++ libtest/signal.cc 2013-04-20 09:57:27 +0000 |
1030 | @@ -153,17 +153,13 @@ |
1031 | switch (sig) |
1032 | { |
1033 | case SIGALRM: |
1034 | - Error << "SIGALRM"; |
1035 | + case SIGVTALRM: |
1036 | + Error << strsignal(sig); |
1037 | if (gdb_is_caller()) |
1038 | { |
1039 | abort(); |
1040 | } |
1041 | - exit(EXIT_SKIP); |
1042 | - |
1043 | - case SIGVTALRM: |
1044 | - Error << "SIGVTALRM was called"; |
1045 | - context->unblock(); |
1046 | - raise(SIGVTALRM); |
1047 | + exit(EXIT_FAILURE); |
1048 | |
1049 | case SIGABRT: |
1050 | case SIGUSR2: |
1051 | |
1052 | === modified file 'libtest/unittest.cc' |
1053 | --- libtest/unittest.cc 2013-02-26 12:25:42 +0000 |
1054 | +++ libtest/unittest.cc 2013-04-20 09:57:27 +0000 |
1055 | @@ -181,6 +181,11 @@ |
1056 | } |
1057 | #pragma GCC diagnostic ignored "-Wstack-protector" |
1058 | |
1059 | +#ifdef __clang__ |
1060 | +# pragma GCC diagnostic push |
1061 | +# pragma GCC diagnostic ignored "-Wformat-security" |
1062 | +#endif |
1063 | + |
1064 | static test_return_t ASSERT_FALSE__TEST(void *) |
1065 | { |
1066 | try { |
1067 | @@ -199,6 +204,10 @@ |
1068 | return TEST_FAILURE; |
1069 | } |
1070 | |
1071 | +#ifdef __clang__ |
1072 | +# pragma GCC diagnostic pop |
1073 | +#endif |
1074 | + |
1075 | static test_return_t ASSERT_NEQ_FAIL_TEST(void *) |
1076 | { |
1077 | try { |
1078 | |
1079 | === added file 'libtest/valgrind.h' |
1080 | --- libtest/valgrind.h 1970-01-01 00:00:00 +0000 |
1081 | +++ libtest/valgrind.h 2013-04-20 09:57:27 +0000 |
1082 | @@ -0,0 +1,55 @@ |
1083 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1084 | + * |
1085 | + * Data Differential YATL (i.e. libtest) library |
1086 | + * |
1087 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
1088 | + * |
1089 | + * Redistribution and use in source and binary forms, with or without |
1090 | + * modification, are permitted provided that the following conditions are |
1091 | + * met: |
1092 | + * |
1093 | + * * Redistributions of source code must retain the above copyright |
1094 | + * notice, this list of conditions and the following disclaimer. |
1095 | + * |
1096 | + * * Redistributions in binary form must reproduce the above |
1097 | + * copyright notice, this list of conditions and the following disclaimer |
1098 | + * in the documentation and/or other materials provided with the |
1099 | + * distribution. |
1100 | + * |
1101 | + * * The names of its contributors may not be used to endorse or |
1102 | + * promote products derived from this software without specific prior |
1103 | + * written permission. |
1104 | + * |
1105 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
1106 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
1107 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
1108 | + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
1109 | + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
1110 | + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
1111 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
1112 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
1113 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
1114 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
1115 | + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1116 | + * |
1117 | + */ |
1118 | + |
1119 | +#pragma once |
1120 | + |
1121 | +static inline bool valgrind_is_caller(void) |
1122 | +{ |
1123 | + if (getenv("TESTS_ENVIRONMENT") && strstr(getenv("TESTS_ENVIRONMENT"), "valgrind")) |
1124 | + { |
1125 | + if (strstr(getenv("TESTS_ENVIRONMENT"), "--tool") == NULL) |
1126 | + { |
1127 | + return true; |
1128 | + } |
1129 | + |
1130 | + if (strstr(getenv("TESTS_ENVIRONMENT"), "--tool=memcheck")) |
1131 | + { |
1132 | + return true; |
1133 | + } |
1134 | + } |
1135 | + |
1136 | + return false; |
1137 | +} |
1138 | |
1139 | === modified file 'libtest/vchar.cc' |
1140 | --- libtest/vchar.cc 2013-01-24 11:17:17 +0000 |
1141 | +++ libtest/vchar.cc 2013-04-20 09:57:27 +0000 |
1142 | @@ -50,6 +50,11 @@ |
1143 | |
1144 | namespace libtest { |
1145 | |
1146 | +int random_alpha_num(void) |
1147 | +{ |
1148 | + return ALPHANUMERICS[get_alpha_num()]; |
1149 | +} |
1150 | + |
1151 | static std::string printer(const char *str, size_t length) |
1152 | { |
1153 | std::ostringstream buf; |
1154 | |
1155 | === modified file 'libtest/vchar.hpp' |
1156 | --- libtest/vchar.hpp 2013-01-08 01:03:28 +0000 |
1157 | +++ libtest/vchar.hpp 2013-04-20 09:57:27 +0000 |
1158 | @@ -44,6 +44,8 @@ |
1159 | |
1160 | namespace libtest { |
1161 | |
1162 | +int random_alpha_num(void); |
1163 | + |
1164 | typedef std::vector<char*> vchar_ptr_t; |
1165 | typedef std::vector<char> vchar_t; |
1166 | |
1167 | @@ -61,6 +63,7 @@ |
1168 | } // namespace vchar |
1169 | |
1170 | #define vchar_param(__arg) (&__arg[0]), (__arg.size()) |
1171 | +#define vchar_printf(__arg) int(__arg.size()), (&__arg[0]) |
1172 | |
1173 | std::ostream& operator<<(std::ostream& output, const libtest::vchar_t& arg); |
1174 | |
1175 | |
1176 | === modified file 'm4/ax_harden_compiler_flags.m4' |
1177 | --- m4/ax_harden_compiler_flags.m4 2013-02-12 05:44:21 +0000 |
1178 | +++ m4/ax_harden_compiler_flags.m4 2013-04-20 09:57:27 +0000 |
1179 | @@ -53,7 +53,7 @@ |
1180 | # ? _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for |
1181 | # compatibility issues memcached_stat_st |
1182 | |
1183 | -#serial 8 |
1184 | +#serial 9 |
1185 | |
1186 | AC_DEFUN([_WARNINGS_AS_ERRORS], |
1187 | [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors], |
1188 | @@ -92,9 +92,12 @@ |
1189 | _APPEND_COMPILE_FLAGS_ERROR([-H]) |
1190 | _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) |
1191 | _APPEND_COMPILE_FLAGS_ERROR([-g]) |
1192 | - _APPEND_COMPILE_FLAGS_ERROR([-O0])], |
1193 | - [_APPEND_COMPILE_FLAGS_ERROR([-g]) |
1194 | - _APPEND_COMPILE_FLAGS_ERROR([-O2])]) |
1195 | + _APPEND_COMPILE_FLAGS_ERROR([-O0]), |
1196 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
1197 | + ],[ |
1198 | + _APPEND_COMPILE_FLAGS_ERROR([-g]) |
1199 | + _APPEND_COMPILE_FLAGS_ERROR([-O2]) |
1200 | + ]) |
1201 | |
1202 | AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
1203 | [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) |
1204 | @@ -155,26 +158,31 @@ |
1205 | _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) |
1206 | _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) |
1207 | _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) |
1208 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) |
1209 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) |
1210 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) |
1211 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) |
1212 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) |
1213 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) |
1214 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) |
1215 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) |
1216 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) |
1217 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) |
1218 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) |
1219 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) |
1220 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) |
1221 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) |
1222 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) |
1223 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) |
1224 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) |
1225 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) |
1226 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) |
1227 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) |
1228 | + AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ |
1229 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
1230 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) |
1231 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) |
1232 | + AS_IF([test "x$enable_shared" = "xyes"],[ |
1233 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) |
1234 | + ]) |
1235 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) |
1236 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) |
1237 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) |
1238 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) |
1239 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) |
1240 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) |
1241 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) |
1242 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) |
1243 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) |
1244 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) |
1245 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) |
1246 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) |
1247 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) |
1248 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) |
1249 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) |
1250 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) |
1251 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) |
1252 | + ]) |
1253 | _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) |
1254 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) |
1255 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) |
1256 | @@ -186,6 +194,7 @@ |
1257 | _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) |
1258 | _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) |
1259 | _APPEND_COMPILE_FLAGS_ERROR([-pipe]) |
1260 | + _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) |
1261 | |
1262 | AS_IF([test "x$ax_enable_debug" = xno], |
1263 | [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
1264 | @@ -213,9 +222,12 @@ |
1265 | _APPEND_COMPILE_FLAGS_ERROR([-H]) |
1266 | _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) |
1267 | _APPEND_COMPILE_FLAGS_ERROR([-g]) |
1268 | - _APPEND_COMPILE_FLAGS_ERROR([-O0])], |
1269 | - [_APPEND_COMPILE_FLAGS_ERROR([-g]) |
1270 | - _APPEND_COMPILE_FLAGS_ERROR([-O2])]) |
1271 | + _APPEND_COMPILE_FLAGS_ERROR([-O0]), |
1272 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
1273 | + ],[ |
1274 | + _APPEND_COMPILE_FLAGS_ERROR([-g]) |
1275 | + _APPEND_COMPILE_FLAGS_ERROR([-O2]) |
1276 | + ]) |
1277 | |
1278 | AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
1279 | [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) |
1280 | @@ -268,27 +280,32 @@ |
1281 | _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) |
1282 | _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat]) |
1283 | # _APPEND_COMPILE_FLAGS_ERROR([-Weffc++]) |
1284 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) |
1285 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) |
1286 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) |
1287 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) |
1288 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) |
1289 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) |
1290 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) |
1291 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) |
1292 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) |
1293 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) |
1294 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) |
1295 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) |
1296 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) |
1297 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) |
1298 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) |
1299 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) |
1300 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) |
1301 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) |
1302 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) |
1303 | - _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) |
1304 | -# _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) |
1305 | + AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ |
1306 | + _APPEND_COMPILE_FLAGS_ERROR([-fno-omit-frame-pointer]) |
1307 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) |
1308 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) |
1309 | + AS_IF([test "x$enable_shared" = "xyes"],[ |
1310 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) |
1311 | + ]) |
1312 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) |
1313 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) |
1314 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) |
1315 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) |
1316 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) |
1317 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) |
1318 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) |
1319 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) |
1320 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) |
1321 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) |
1322 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) |
1323 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) |
1324 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) |
1325 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) |
1326 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) |
1327 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) |
1328 | + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) |
1329 | + ]) |
1330 | +# _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) |
1331 | _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) |
1332 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) |
1333 | _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) |
1334 | @@ -301,6 +318,7 @@ |
1335 | _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) |
1336 | _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt]) |
1337 | _APPEND_COMPILE_FLAGS_ERROR([-pipe]) |
1338 | + _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) |
1339 | |
1340 | AS_IF([test "x$ax_enable_debug" = xno], |
1341 | [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
1342 | |
1343 | === modified file 'tests/keys.hpp' |
1344 | --- tests/keys.hpp 2012-09-17 11:41:20 +0000 |
1345 | +++ tests/keys.hpp 2013-04-20 09:57:27 +0000 |
1346 | @@ -2,7 +2,7 @@ |
1347 | * |
1348 | * Libmemcached library |
1349 | * |
1350 | - * Copyright (C) 2012 Data Differential, http://datadifferential.com/ |
1351 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
1352 | * |
1353 | * Redistribution and use in source and binary forms, with or without |
1354 | * modification, are permitted provided that the following conditions are |
1355 | @@ -62,18 +62,18 @@ |
1356 | key_buffer.resize(padding +1); |
1357 | memset(&key_buffer[0], 'x', padding); |
1358 | |
1359 | +#if defined(HAVE_UUID_UUID_H) && HAVE_UUID_UUID_H |
1360 | if (HAVE_UUID_UUID_H) |
1361 | { |
1362 | -#if defined(HAVE_UUID_UUID_H) && HAVE_UUID_UUID_H |
1363 | uuid_t out; |
1364 | uuid_generate(out); |
1365 | |
1366 | uuid_unparse(out, &key_buffer[0]); |
1367 | _keys[x]= strdup(&key_buffer[0]); |
1368 | (_keys[x])[UUID_STRING_MAXLENGTH]= 'x'; |
1369 | -#endif |
1370 | } |
1371 | else // We just use a number and pad the string if UUID is not available |
1372 | +#endif |
1373 | { |
1374 | char int_buffer[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1]; |
1375 | int key_length= snprintf(int_buffer, sizeof(int_buffer), "%u", uint32_t(x)); |
1376 | |
1377 | === modified file 'tests/libmemcached-1.0/mem_functions.cc' |
1378 | --- tests/libmemcached-1.0/mem_functions.cc 2013-04-03 13:14:23 +0000 |
1379 | +++ tests/libmemcached-1.0/mem_functions.cc 2013-04-20 09:57:27 +0000 |
1380 | @@ -2839,7 +2839,7 @@ |
1381 | |
1382 | test_compare(memcached_behavior_set(&memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5), MEMCACHED_SUCCESS); |
1383 | |
1384 | - test_compare(memcached_behavior_get(&memc, MEMCACHED_BEHAVIOR_KETAMA_HASH), MEMCACHED_HASH_MD5); |
1385 | + test_compare(memcached_hash_t(memcached_behavior_get(&memc, MEMCACHED_BEHAVIOR_KETAMA_HASH)), MEMCACHED_HASH_MD5); |
1386 | |
1387 | test_compare(memcached_behavior_set_distribution(&memc, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY), MEMCACHED_SUCCESS); |
1388 | |
1389 | |
1390 | === modified file 'tests/libmemcached-1.0/sasl.cc' |
1391 | --- tests/libmemcached-1.0/sasl.cc 2013-01-08 05:00:21 +0000 |
1392 | +++ tests/libmemcached-1.0/sasl.cc 2013-04-20 09:57:27 +0000 |
1393 | @@ -64,6 +64,7 @@ |
1394 | */ |
1395 | static test_return_t sasl_auth_test(memcached_st *memc) |
1396 | { |
1397 | +#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT |
1398 | if (LIBMEMCACHED_WITH_SASL_SUPPORT) |
1399 | { |
1400 | test_compare(MEMCACHED_SUCCESS, memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0)); |
1401 | @@ -80,6 +81,9 @@ |
1402 | memcached_quit(memc); |
1403 | return TEST_SUCCESS; |
1404 | } |
1405 | +#else |
1406 | + (void)memc; |
1407 | +#endif |
1408 | |
1409 | return TEST_SKIPPED; |
1410 | } |