Merge lp:~brianaker/libmemcached/update-1.2 into lp:libmemcached
- update-1.2
- Merge into 1.2
Proposed by
Brian Aker
Status: | Merged |
---|---|
Merged at revision: | 1105 |
Proposed branch: | lp:~brianaker/libmemcached/update-1.2 |
Merge into: | lp:libmemcached |
Diff against target: |
4777 lines (+1598/-736) 71 files modified
bootstrap.sh (+357/-304) clients/include.am (+2/-1) clients/memcat.cc (+4/-1) clients/memcp.cc (+1/-1) clients/memdump.cc (+1/-1) clients/memexist.cc (+1/-1) clients/memflush.cc (+1/-1) clients/memping.cc (+3/-0) clients/memrm.cc (+1/-1) clients/memstat.cc (+1/-1) clients/memtouch.cc (+1/-1) clients/utilities.cc (+7/-3) configure.ac (+1/-0) docs/include.am (+13/-13) libhashkit/digest.cc (+3/-0) libmemcached-1.2/feature.h (+53/-0) libmemcached-1.2/include.am (+1/-0) libmemcached-1.2/memcached.h (+2/-0) libmemcached-1.2/sasl.h (+2/-2) libmemcached/connect.cc (+4/-4) libmemcached/csl/parser.yy (+5/-0) libmemcached/csl/scanner.l (+4/-0) libmemcached/feature.cc (+51/-0) libmemcached/feature.h (+37/-0) libmemcached/flag.cc (+3/-1) libmemcached/hosts.cc (+6/-0) libmemcached/include.am (+2/-0) libmemcached/memcached.cc (+2/-2) libmemcached/response.cc (+0/-1) libmemcached/sasl.cc (+189/-177) libmemcachedutil/pid.cc (+1/-1) libmemcachedutil/ping.cc (+1/-1) libtest/abort.cc (+3/-0) libtest/alarm.cc (+31/-23) libtest/client.cc (+192/-26) libtest/client.hpp (+31/-0) libtest/cmdline.cc (+75/-14) libtest/cmdline.h (+1/-0) libtest/collection.cc (+6/-0) libtest/cpu.cc (+12/-11) libtest/cpu.hpp (+3/-1) libtest/drizzled.cc (+5/-0) libtest/error.h (+74/-0) libtest/framework.cc (+122/-47) libtest/gearmand.cc (+12/-1) libtest/has.cc (+6/-5) libtest/http.cc (+12/-0) libtest/include.am (+3/-0) libtest/is_local.cc (+11/-0) libtest/is_local.hpp (+6/-0) libtest/lite.h (+23/-11) libtest/main.cc (+47/-4) libtest/memcached.cc (+5/-3) libtest/result.hpp (+1/-1) libtest/server.cc (+18/-7) libtest/server.h (+20/-1) libtest/signal.cc (+2/-1) libtest/string.hpp (+1/-0) libtest/unittest.cc (+61/-13) m4/ax_harden_compiler_flags.m4 (+1/-1) m4/ax_prog_sphinx_build.m4 (+23/-20) rpm/include.am (+1/-1) support/libmemcached.spec.in (+1/-0) tests/keys.hpp (+3/-0) tests/libmemcached-1.0/all_tests.cc (+1/-1) tests/libmemcached-1.0/generate.cc (+3/-0) tests/libmemcached-1.0/pool.cc (+4/-1) tests/libmemcached-1.0/sasl.cc (+15/-22) tests/libmemcached_world.h (+1/-1) tests/memcp.cc (+1/-1) version.m4 (+1/-1) |
To merge this branch: | bzr merge lp:~brianaker/libmemcached/update-1.2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tangent Trunk | Pending | ||
Review via email: mp+168655@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 1106. By Brian Aker
-
Fix compile issues and version number (which has to be a number).
- 1107. By Brian Aker
-
Fix issue with sasl symbol
- 1108. By Brian Aker
-
Missing sasl symbol.
- 1109. By Brian Aker
-
Update bootstrap
- 1110. By Brian Aker
-
Update to just "dist" and not "check" since we do that elsewhere.
- 1111. By Brian Aker
-
Add feature.h to spec file.
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-05-03 07:52:47 +0000 |
3 | +++ bootstrap.sh 2013-06-14 07:11:24 +0000 |
4 | @@ -43,6 +43,19 @@ |
5 | # WARNINGS |
6 | # |
7 | |
8 | +use_banner () |
9 | +{ |
10 | + echo "#####################################################################################" |
11 | + echo "#" |
12 | + echo "#" |
13 | + echo "#" |
14 | + echo "# TARGET:$1" |
15 | + echo "#" |
16 | + echo "#" |
17 | + echo "#" |
18 | + echo "#####################################################################################" |
19 | +} |
20 | + |
21 | command_not_found_handle () |
22 | { |
23 | warn "$@: command not found" |
24 | @@ -60,27 +73,27 @@ |
25 | return 127 |
26 | } |
27 | |
28 | -function error () |
29 | +error () |
30 | { |
31 | echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2 |
32 | } |
33 | |
34 | -function die () |
35 | +die () |
36 | { |
37 | echo "$BASH_SOURCE:$BASH_LINENO: $@" >&2 |
38 | exit 1; |
39 | } |
40 | |
41 | -function warn () |
42 | +warn () |
43 | { |
44 | echo "$BASH_SOURCE:$BASH_LINENO: $@" |
45 | #echo "$BASH_SOURCE:$BASH_LINENO: $@" >&1 |
46 | } |
47 | |
48 | -function nassert () |
49 | +nassert () |
50 | { |
51 | local param_name=\$"$1" |
52 | - local param_value=`eval "expr \"$param_name\" "` |
53 | + local param_value="$(eval "expr \"$param_name\" ")" |
54 | |
55 | if [ -n "$param_value" ]; then |
56 | echo "$bash_source:$bash_lineno: assert($param_name) had value of "$param_value"" >&2 |
57 | @@ -88,10 +101,10 @@ |
58 | fi |
59 | } |
60 | |
61 | -function assert () |
62 | +assert () |
63 | { |
64 | local param_name=\$"$1" |
65 | - local param_value=`eval "expr \"$param_name\" "` |
66 | + local param_value="$(eval "expr \"$param_name\" ")" |
67 | |
68 | if [ -z "$param_value" ]; then |
69 | echo "$bash_source:$bash_lineno: assert($param_name)" >&2 |
70 | @@ -99,7 +112,7 @@ |
71 | fi |
72 | } |
73 | |
74 | -function assert_file () |
75 | +assert_file () |
76 | { |
77 | if [ ! -f "$1" ]; then |
78 | echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2 |
79 | @@ -107,7 +120,7 @@ |
80 | fi |
81 | } |
82 | |
83 | -function assert_no_file () |
84 | +assert_no_file () |
85 | { |
86 | if [ -f "$1" ]; then |
87 | echo "$BASH_SOURCE:$BASH_LINENO: assert($1) file exists: $2" >&2 |
88 | @@ -115,7 +128,7 @@ |
89 | fi |
90 | } |
91 | |
92 | -function assert_no_directory () |
93 | +assert_no_directory () |
94 | { |
95 | if [ -d "$1" ]; then |
96 | echo "$BASH_SOURCE:$BASH_LINENO: assert($1) directory exists: $2" >&2 |
97 | @@ -123,7 +136,7 @@ |
98 | fi |
99 | } |
100 | |
101 | -function assert_exec_file () |
102 | +assert_exec_file () |
103 | { |
104 | if [ ! -f "$1" ]; then |
105 | echo "$BASH_SOURCE:$BASH_LINENO: assert($1) does not exist: $2" >&2 |
106 | @@ -136,16 +149,16 @@ |
107 | fi |
108 | } |
109 | |
110 | -function command_exists () |
111 | +command_exists () |
112 | { |
113 | type "$1" &> /dev/null ; |
114 | } |
115 | |
116 | -function rebuild_host_os () |
117 | +rebuild_host_os () |
118 | { |
119 | HOST_OS="${UNAME_MACHINE_ARCH}-${VENDOR}-${VENDOR_DISTRIBUTION}-${VENDOR_RELEASE}-${UNAME_KERNEL}-${UNAME_KERNEL_RELEASE}" |
120 | if [ -z "$1" ]; then |
121 | - if $VERBOSE; then |
122 | + if $verbose; then |
123 | echo "HOST_OS=$HOST_OS" |
124 | fi |
125 | fi |
126 | @@ -153,9 +166,9 @@ |
127 | |
128 | # Validate the distribution name, or toss an erro |
129 | # values: darwin,fedora,rhel,ubuntu,debian,opensuse |
130 | -function set_VENDOR_DISTRIBUTION () |
131 | +set_VENDOR_DISTRIBUTION () |
132 | { |
133 | - local dist=`echo "$1" | tr '[A-Z]' '[a-z]'` |
134 | + local dist="$(echo "$1" | tr '[:upper:]' '[:lower:]')" |
135 | case "$dist" in |
136 | darwin) |
137 | VENDOR_DISTRIBUTION='darwin' |
138 | @@ -185,11 +198,11 @@ |
139 | } |
140 | |
141 | # Validate a Vendor's release name/number |
142 | -function set_VENDOR_RELEASE () |
143 | +set_VENDOR_RELEASE () |
144 | { |
145 | - local release=`echo "$1" | tr '[A-Z]' '[a-z]'` |
146 | + local release="$(echo "$1" | tr '[:upper:]' '[:lower:]')" |
147 | |
148 | - if $DEBUG; then |
149 | + if $verbose; then |
150 | echo "VENDOR_DISTRIBUTION:$VENDOR_DISTRIBUTION" |
151 | echo "VENDOR_RELEASE:$release" |
152 | fi |
153 | @@ -252,9 +265,9 @@ |
154 | |
155 | |
156 | # Valid values are: apple, redhat, centos, canonical, oracle, suse |
157 | -function set_VENDOR () |
158 | +set_VENDOR () |
159 | { |
160 | - local vendor=`echo "$1" | tr '[A-Z]' '[a-z]'` |
161 | + local vendor="$(echo "$1" | tr '[:upper:]' '[:lower:]')" |
162 | |
163 | case $vendor in |
164 | apple) |
165 | @@ -295,8 +308,8 @@ |
166 | ;; |
167 | esac |
168 | |
169 | - set_VENDOR_DISTRIBUTION $2 |
170 | - set_VENDOR_RELEASE $3 |
171 | + set_VENDOR_DISTRIBUTION "$2" |
172 | + set_VENDOR_RELEASE "$3" |
173 | |
174 | # Set which vendor/versions we trust for autoreconf |
175 | case $VENDOR_DISTRIBUTION in |
176 | @@ -320,37 +333,37 @@ |
177 | |
178 | } |
179 | |
180 | -function determine_target_platform () |
181 | +determine_target_platform () |
182 | { |
183 | - UNAME_MACHINE_ARCH=`(uname -m) 2>/dev/null` || UNAME_MACHINE_ARCH=unknown |
184 | - UNAME_KERNEL=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown |
185 | - UNAME_KERNEL_RELEASE=`(uname -r) 2>/dev/null` || UNAME_KERNEL_RELEASE=unknown |
186 | + UNAME_MACHINE_ARCH="$(uname -m 2>/dev/null)" || UNAME_MACHINE_ARCH=unknown |
187 | + UNAME_KERNEL="$(uname -s 2>/dev/null)" || UNAME_SYSTEM=unknown |
188 | + UNAME_KERNEL_RELEASE="$(uname -r 2>/dev/null)" || UNAME_KERNEL_RELEASE=unknown |
189 | |
190 | if [[ -x '/usr/bin/sw_vers' ]]; then |
191 | - local _VERSION=`/usr/bin/sw_vers -productVersion` |
192 | + local _VERSION="$(/usr/bin/sw_vers -productVersion)" |
193 | set_VENDOR 'apple' 'darwin' $_VERSION |
194 | elif [[ $(uname) == 'Darwin' ]]; then |
195 | set_VENDOR 'apple' 'darwin' 'mountain' |
196 | elif [[ -f '/etc/fedora-release' ]]; then |
197 | - local fedora_version=`cat /etc/fedora-release | awk ' { print $3 } '` |
198 | + local fedora_version="$(awk ' { print $3 } ' < /etc/fedora-release)" |
199 | set_VENDOR 'redhat' 'fedora' $fedora_version |
200 | elif [[ -f '/etc/centos-release' ]]; then |
201 | - local centos_version=`cat /etc/centos-release | awk ' { print $7 } '` |
202 | + local centos_version="$(awk ' { print $7 } ' < /etc/centos-release)" |
203 | set_VENDOR 'centos' 'rhel' $centos_version |
204 | elif [[ -f '/etc/SuSE-release' ]]; then |
205 | - local suse_distribution=`head -1 /etc/SuSE-release | awk ' { print $1 } '` |
206 | - local suse_version=`head -1 /etc/SuSE-release | awk ' { print $2 } '` |
207 | + local suse_distribution="$(head -1 /etc/SuSE-release | awk ' { print $1 } ')" |
208 | + local suse_version="$(head -1 /etc/SuSE-release | awk ' { print $2 } ')" |
209 | set_VENDOR 'suse' $suse_distribution $suse_version |
210 | elif [[ -f '/etc/redhat-release' ]]; then |
211 | - local rhel_version=`cat /etc/redhat-release | awk ' { print $7 } '` |
212 | - local _vendor=`rpm -qf /etc/redhat-release` |
213 | + local rhel_version="$(awk ' { print $7 } ' < /etc/redhat-release)" |
214 | + local _vendor="$(rpm -qf /etc/redhat-release)" |
215 | set_VENDOR $_vendor 'rhel' $rhel_version |
216 | elif [[ -f '/etc/os-release' ]]; then |
217 | source '/etc/os-release' |
218 | set_VENDOR $ID $ID $VERSION_ID |
219 | elif [[ -x '/usr/bin/lsb_release' ]]; then |
220 | - local _ID=`/usr/bin/lsb_release -s -i` |
221 | - local _VERSION=`/usr/bin/lsb_release -s -r` |
222 | + local _ID="$(/usr/bin/lsb_release -s -i)" |
223 | + local _VERSION="$(/usr/bin/lsb_release -s -r)" |
224 | set_VENDOR $_ID $_ID $_VERSION_ID |
225 | elif [[ -f '/etc/lsb-release' ]]; then |
226 | source '/etc/lsb-release' |
227 | @@ -360,13 +373,13 @@ |
228 | rebuild_host_os |
229 | } |
230 | |
231 | -function run_configure () |
232 | +run_configure () |
233 | { |
234 | # We will run autoreconf if we are required |
235 | run_autoreconf_if_required |
236 | |
237 | # We always begin at the root of our build |
238 | - if [ ! popd ]; then |
239 | + if [ ! $? ]; then |
240 | die "Programmer error, we entered run_configure with a stacked directory" |
241 | fi |
242 | |
243 | @@ -378,47 +391,46 @@ |
244 | if [[ -n "$BUILD_DIR" ]]; then |
245 | rm -r -f $BUILD_DIR |
246 | mkdir -p $BUILD_DIR |
247 | - safe_pushd $BUILD_DIR |
248 | fi |
249 | |
250 | # Arguments for configure |
251 | - local BUILD_CONFIGURE_ARG= |
252 | + local BUILD_CONFIGURE_ARG='' |
253 | |
254 | - # If ENV DEBUG is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert |
255 | + # If debug is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert |
256 | # Set ENV ASSERT in order to enable assert. |
257 | # If we are doing a valgrind run, we always compile with assert disabled |
258 | if $valgrind_run; then |
259 | - BUILD_CONFIGURE_ARG+= '--enable-assert=no' |
260 | + BUILD_CONFIGURE_ARG="--enable-assert=no $BUILD_CONFIGURE_ARG" |
261 | else |
262 | - if $DEBUG; then |
263 | - BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert' |
264 | + if $debug; then |
265 | + BUILD_CONFIGURE_ARG="--enable-debug --enable-assert $BUILD_CONFIGURE_ARG" |
266 | elif [[ -n "$VCS_CHECKOUT" ]]; then |
267 | - BUILD_CONFIGURE_ARG+=' --enable-assert' |
268 | + BUILD_CONFIGURE_ARG="--enable-assert $BUILD_CONFIGURE_ARG" |
269 | fi |
270 | fi |
271 | |
272 | if [[ -n "$CONFIGURE_ARG" ]]; then |
273 | - BUILD_CONFIGURE_ARG+=" $CONFIGURE_ARG" |
274 | + BUILD_CONFIGURE_ARG="$CONFIGURE_ARG $BUILD_CONFIGURE_ARG" |
275 | fi |
276 | |
277 | if [[ -n "$PREFIX_ARG" ]]; then |
278 | - BUILD_CONFIGURE_ARG+=" $PREFIX_ARG" |
279 | + BUILD_CONFIGURE_ARG="$PREFIX_ARG $BUILD_CONFIGURE_ARG" |
280 | fi |
281 | |
282 | ret=1; |
283 | # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV |
284 | case $HOST_OS in |
285 | *-darwin-*) |
286 | - CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG" |
287 | + run CC=clang CXX=clang++ $top_srcdir/configure "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG" |
288 | ret=$? |
289 | ;; |
290 | rhel-5*) |
291 | command_exists 'gcc44' || die "Could not locate gcc44" |
292 | - CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG" |
293 | + run CC=gcc44 CXX=gcc44 $top_srcdir/configure "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG" |
294 | ret=$? |
295 | ;; |
296 | *) |
297 | - $CONFIGURE $BUILD_CONFIGURE_ARG |
298 | + run $CONFIGURE "$BUILD_CONFIGURE_ARG" |
299 | ret=$? |
300 | ;; |
301 | esac |
302 | @@ -432,25 +444,27 @@ |
303 | fi |
304 | } |
305 | |
306 | -function setup_gdb_command () { |
307 | +setup_gdb_command () |
308 | +{ |
309 | GDB_TMPFILE=$(mktemp /tmp/gdb.XXXXXXXXXX) |
310 | - echo 'set logging overwrite on' > $GDB_TMPFILE |
311 | - echo 'set logging on' >> $GDB_TMPFILE |
312 | - echo 'set environment LIBTEST_IN_GDB=1' >> $GDB_TMPFILE |
313 | - echo 'run' >> $GDB_TMPFILE |
314 | - echo 'thread apply all bt' >> $GDB_TMPFILE |
315 | - echo 'quit' >> $GDB_TMPFILE |
316 | + echo 'set logging overwrite on' > "$GDB_TMPFILE" |
317 | + echo 'set logging on' >> "$GDB_TMPFILE" |
318 | + echo 'set environment LIBTEST_IN_GDB=1' >> "$GDB_TMPFILE" |
319 | + echo 'run' >> "$GDB_TMPFILE" |
320 | + echo 'thread apply all bt' >> "$GDB_TMPFILE" |
321 | + echo 'quit' >> "$GDB_TMPFILE" |
322 | GDB_COMMAND="gdb -f -batch -x $GDB_TMPFILE" |
323 | } |
324 | |
325 | -function setup_valgrind_command () { |
326 | - VALGRIND_PROGRAM=`type -p valgrind` |
327 | +setup_valgrind_command () |
328 | +{ |
329 | + VALGRIND_PROGRAM="$(type -p valgrind)" |
330 | if [[ -n "$VALGRIND_PROGRAM" ]]; then |
331 | VALGRIND_COMMAND="$VALGRIND_PROGRAM --error-exitcode=1 --leak-check=yes --malloc-fill=A5 --free-fill=DE --xml=yes --xml-file=\"valgrind-%p.xml\"" |
332 | fi |
333 | } |
334 | |
335 | -function save_BUILD () |
336 | +save_BUILD () |
337 | { |
338 | if [[ -n "$OLD_CONFIGURE" ]]; then |
339 | die "OLD_CONFIGURE($OLD_CONFIGURE) was set on push, programmer error!" |
340 | @@ -489,7 +503,7 @@ |
341 | fi |
342 | } |
343 | |
344 | -function restore_BUILD () |
345 | +restore_BUILD () |
346 | { |
347 | if [[ -n "$OLD_CONFIGURE" ]]; then |
348 | CONFIGURE=$OLD_CONFIGURE |
349 | @@ -520,31 +534,7 @@ |
350 | export -n CC CXX |
351 | } |
352 | |
353 | -function safe_pushd () |
354 | -{ |
355 | - pushd $1 &> /dev/null ; |
356 | - |
357 | - if [ -n "$BUILD_DIR" ]; then |
358 | - if $VERBOSE; then |
359 | - echo "BUILD_DIR=$BUILD_DIR" |
360 | - fi |
361 | - fi |
362 | -} |
363 | - |
364 | -function safe_popd () |
365 | -{ |
366 | - local directory_to_delete=`pwd` |
367 | - popd &> /dev/null ; |
368 | - if [ $? -eq 0 ]; then |
369 | - if [[ "$top_srcdir" == "$directory_to_delete" ]]; then |
370 | - die "We almost deleted top_srcdir($top_srcdir), programmer error" |
371 | - fi |
372 | - |
373 | - rm -r -f "$directory_to_delete" |
374 | - fi |
375 | -} |
376 | - |
377 | -function make_valgrind () |
378 | +make_valgrind () |
379 | { |
380 | # If the env VALGRIND_COMMAND is set then we assume it is valid |
381 | local valgrind_was_set=false |
382 | @@ -582,11 +572,6 @@ |
383 | make_target 'check' |
384 | ret=$? |
385 | |
386 | - # If we aren't going to error, we will clean up our environment |
387 | - if [ "$ret" -eq 0 ]; then |
388 | - make 'distclean' |
389 | - fi |
390 | - |
391 | valgrind_run=false |
392 | |
393 | restore_BUILD |
394 | @@ -596,9 +581,9 @@ |
395 | fi |
396 | } |
397 | |
398 | -function make_install_system () |
399 | +make_install_system () |
400 | { |
401 | - local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX) |
402 | + local INSTALL_LOCATION="$(mktemp -d /tmp/XXXXXXXXXX)" |
403 | |
404 | save_BUILD |
405 | PREFIX_ARG="--prefix=$INSTALL_LOCATION" |
406 | @@ -623,10 +608,9 @@ |
407 | fi |
408 | |
409 | restore_BUILD |
410 | - safe_popd |
411 | } |
412 | |
413 | -function make_darwin_malloc () |
414 | +make_darwin_malloc () |
415 | { |
416 | run_configure_if_required |
417 | |
418 | @@ -645,7 +629,7 @@ |
419 | } |
420 | |
421 | # This will reset our environment, and make sure built files are available. |
422 | -function make_for_snapshot () |
423 | +make_for_snapshot () |
424 | { |
425 | # Lets make sure we have a clean environment |
426 | assert_no_file 'Makefile' |
427 | @@ -661,7 +645,7 @@ |
428 | assert_exec_file 'configure' |
429 | } |
430 | |
431 | -function check_mingw () |
432 | +check_mingw () |
433 | { |
434 | command_exists 'mingw64-configure' |
435 | ret=$? |
436 | @@ -678,7 +662,7 @@ |
437 | return 0 |
438 | } |
439 | |
440 | -function check_clang () |
441 | +check_clang () |
442 | { |
443 | command_exists 'clang' |
444 | ret=$? |
445 | @@ -689,7 +673,7 @@ |
446 | return 0 |
447 | } |
448 | |
449 | -function check_clang_analyzer () |
450 | +check_clang_analyzer () |
451 | { |
452 | command_exists 'scan-build' |
453 | ret=$? |
454 | @@ -700,7 +684,7 @@ |
455 | return 0 |
456 | } |
457 | |
458 | -function make_skeleton () |
459 | +make_skeleton () |
460 | { |
461 | run_configure |
462 | ret=$? |
463 | @@ -733,7 +717,7 @@ |
464 | return $ret |
465 | } |
466 | |
467 | -function make_for_mingw () |
468 | +make_for_mingw () |
469 | { |
470 | if ! check_mingw; then |
471 | return 1 |
472 | @@ -760,7 +744,7 @@ |
473 | return $ret |
474 | } |
475 | |
476 | -function make_for_clang () |
477 | +make_for_clang () |
478 | { |
479 | if ! check_clang; then |
480 | return 1 |
481 | @@ -788,7 +772,7 @@ |
482 | return $ret |
483 | } |
484 | |
485 | -function make_for_clang_analyzer () |
486 | +make_for_clang_analyzer () |
487 | { |
488 | if ! check_clang; then |
489 | return 1 |
490 | @@ -824,7 +808,7 @@ |
491 | } |
492 | |
493 | # If we are locally testing, we should make sure the environment is setup correctly |
494 | -function check_for_jenkins () |
495 | +check_for_jenkins () |
496 | { |
497 | if ! $jenkins_build_environment; then |
498 | echo "Not inside of jenkins, simulating environment" |
499 | @@ -839,31 +823,50 @@ |
500 | fi |
501 | } |
502 | |
503 | -function make_universe () |
504 | +make_universe () |
505 | { |
506 | + use_banner 'make maintainer-clean' |
507 | + make_maintainer_clean |
508 | + |
509 | + use_banner 'snapshot' |
510 | make_for_snapshot |
511 | + |
512 | + use_banner 'valgrind' |
513 | make_valgrind |
514 | + |
515 | + use_banner 'gdb' |
516 | make_gdb |
517 | + |
518 | + use_banner 'rpm' |
519 | make_rpm |
520 | + |
521 | + use_banner 'clang' |
522 | make_for_clang |
523 | + |
524 | + use_banner 'clang analyzer' |
525 | make_for_clang_analyzer |
526 | |
527 | - if [ check_mingw -eq 0 ]; then |
528 | + use_banner 'mingw' |
529 | + check_mingw |
530 | + if [ $? -eq 0 ]; then |
531 | make_for_mingw |
532 | fi |
533 | |
534 | + use_banner 'make distcheck' |
535 | make_distcheck |
536 | + |
537 | + use_banner 'make install' |
538 | make_install_system |
539 | } |
540 | |
541 | -function check_snapshot () |
542 | +check_snapshot () |
543 | { |
544 | if [ -n "$BOOTSTRAP_SNAPSHOT_CHECK" ]; then |
545 | assert_file "$BOOTSTRAP_SNAPSHOT_CHECK" 'snapshot check failed' |
546 | fi |
547 | } |
548 | |
549 | -function make_for_continuus_integration () |
550 | +make_for_continuus_integration () |
551 | { |
552 | # Setup the environment if we are local |
553 | check_for_jenkins |
554 | @@ -895,23 +898,21 @@ |
555 | esac |
556 | |
557 | make_maintainer_clean |
558 | - |
559 | - safe_popd |
560 | } |
561 | |
562 | # The point to this test is to test bootstrap.sh itself |
563 | -function self_test () |
564 | +self_test () |
565 | { |
566 | # We start off with a clean env |
567 | make_maintainer_clean |
568 | |
569 | - eval "./bootstrap.sh jenkins" || die "failed 'jenkins'" |
570 | - eval "./bootstrap.sh all" || die "failed 'all'" |
571 | - eval "./bootstrap.sh gdb" || die "failed 'gdb'" |
572 | - eval "./bootstrap.sh maintainer-clean" || die "failed 'maintainer-clean'" |
573 | +# eval "./bootstrap.sh jenkins" || die "failed 'jenkins'" |
574 | +# eval "./bootstrap.sh all" || die "failed 'all'" |
575 | +# eval "./bootstrap.sh gdb" || die "failed 'gdb'" |
576 | +# eval "./bootstrap.sh maintainer-clean" || die "failed 'maintainer-clean'" |
577 | } |
578 | |
579 | -function make_install_html () |
580 | +make_install_html () |
581 | { |
582 | run_configure_if_required |
583 | assert_file 'configure' |
584 | @@ -919,7 +920,7 @@ |
585 | make_target 'install-html' |
586 | } |
587 | |
588 | -function make_gdb () |
589 | +make_gdb () |
590 | { |
591 | save_BUILD |
592 | |
593 | @@ -962,7 +963,7 @@ |
594 | |
595 | # $1 target to compile |
596 | # $2 to die, or not to die, based on contents |
597 | -function make_target () |
598 | +make_target () |
599 | { |
600 | if [ -z "$1" ]; then |
601 | die "Programmer error, no target provided for make" |
602 | @@ -974,7 +975,7 @@ |
603 | fi |
604 | |
605 | if [ -n "$TESTS_ENVIRONMENT" ]; then |
606 | - if $VERBOSE; then |
607 | + if $verbose; then |
608 | echo "TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT" |
609 | fi |
610 | fi |
611 | @@ -984,12 +985,14 @@ |
612 | fi |
613 | |
614 | # $2 represents error or warn |
615 | - run $MAKE $1 |
616 | + run "$MAKE" "$1" |
617 | ret=$? |
618 | |
619 | if [ $ret -ne 0 ]; then |
620 | if [ -n "$2" ]; then |
621 | warn "Failed to execute $MAKE $1: $ret" |
622 | + elif [ $ret -eq 2 ]; then |
623 | + die "Failed to execute $MAKE $1" |
624 | else |
625 | die "Failed to execute $MAKE $1: $ret" |
626 | fi |
627 | @@ -998,12 +1001,12 @@ |
628 | return $ret |
629 | } |
630 | |
631 | -function make_distcheck () |
632 | +make_distcheck () |
633 | { |
634 | make_target 'distcheck' |
635 | } |
636 | |
637 | -function make_rpm () |
638 | +make_rpm () |
639 | { |
640 | if command_exists 'rpmbuild'; then |
641 | if [ -f 'rpm.am' -o -d 'rpm' ]; then |
642 | @@ -1018,7 +1021,7 @@ |
643 | fi |
644 | } |
645 | |
646 | -function make_maintainer_clean () |
647 | +make_maintainer_clean () |
648 | { |
649 | run_configure_if_required |
650 | make_target 'maintainer-clean' 'no_error' |
651 | @@ -1029,24 +1032,34 @@ |
652 | assert_no_directory 'autom4te.cache' |
653 | } |
654 | |
655 | -function make_check () |
656 | +make_distclean () |
657 | +{ |
658 | + run_configure_if_required |
659 | + make_target 'distclean' 'no_error' |
660 | + |
661 | + # Lets make sure we really cleaned up the environment |
662 | + assert_no_file 'Makefile' |
663 | + assert_file 'configure' |
664 | +} |
665 | + |
666 | +make_check () |
667 | { |
668 | make_target 'check' |
669 | } |
670 | |
671 | -function make_jenkins_default () |
672 | +make_jenkins_default () |
673 | { |
674 | run_configure |
675 | make_target 'all' |
676 | } |
677 | |
678 | -function make_default () |
679 | +make_default () |
680 | { |
681 | run_configure_if_required |
682 | make_target 'all' |
683 | } |
684 | |
685 | -function run_configure_if_required () |
686 | +run_configure_if_required () |
687 | { |
688 | run_autoreconf_if_required |
689 | |
690 | @@ -1057,14 +1070,14 @@ |
691 | assert_file 'Makefile' 'configure did not produce a Makefile' |
692 | } |
693 | |
694 | -function run_make_maintainer_clean_if_possible () |
695 | +run_make_maintainer_clean_if_possible () |
696 | { |
697 | if [ -f 'Makefile' ]; then |
698 | make_maintainer_clean |
699 | fi |
700 | } |
701 | |
702 | -function run_autoreconf_if_required () |
703 | +run_autoreconf_if_required () |
704 | { |
705 | if [ ! -x 'configure' ]; then |
706 | run_autoreconf |
707 | @@ -1074,25 +1087,25 @@ |
708 | bash -n configure |
709 | } |
710 | |
711 | -function run_autoreconf () |
712 | +run_autoreconf () |
713 | { |
714 | if [[ -z "$AUTORECONF" ]]; then |
715 | die "Programmer error, tried to call run_autoreconf () but AUTORECONF was not set" |
716 | fi |
717 | |
718 | - if test $use_libtool = 1; then |
719 | + if $use_libtool; then |
720 | assert $BOOTSTRAP_LIBTOOLIZE |
721 | - run $BOOTSTRAP_LIBTOOLIZE '--copy' '--install' '--force' || die "Cannot execute $BOOTSTRAP_LIBTOOLIZE" |
722 | + run "$BOOTSTRAP_LIBTOOLIZE" '--copy' '--install' '--force' || die "Cannot execute $BOOTSTRAP_LIBTOOLIZE" |
723 | fi |
724 | |
725 | - run $AUTORECONF $AUTORECONF_ARGS || die "Cannot execute $AUTORECONF" |
726 | + run "$AUTORECONF" "$AUTORECONF_ARGS" || die "Cannot execute $AUTORECONF" |
727 | |
728 | eval 'bash -n configure' || die "autoreconf generated a malformed configure" |
729 | } |
730 | |
731 | -function run () |
732 | +run () |
733 | { |
734 | - if $VERBOSE; then |
735 | + if $verbose; then |
736 | echo "\`$@' $ARGS" |
737 | fi |
738 | |
739 | @@ -1100,39 +1113,41 @@ |
740 | return 127; |
741 | fi |
742 | |
743 | - eval $@ $ARGS |
744 | + eval "$@" "$ARGS" |
745 | } |
746 | |
747 | -function parse_command_line_options () |
748 | +parse_command_line_options () |
749 | { |
750 | local SHORTOPTS=':apcmt:dvh' |
751 | |
752 | - nassert MAKE_TARGET |
753 | + nassert OPT_TARGET |
754 | |
755 | while getopts "$SHORTOPTS" opt; do |
756 | case $opt in |
757 | a) #--autoreconf |
758 | AUTORECONF_OPTION=true |
759 | - MAKE_TARGET='autoreconf' |
760 | + OPT_TARGET+='autoreconf' |
761 | ;; |
762 | p) #--print-env |
763 | - PRINT_SETUP_OPTION=true |
764 | + print_setup_opt=true |
765 | ;; |
766 | c) # --configure |
767 | CONFIGURE_OPTION=true |
768 | - MAKE_TARGET='configure' |
769 | + OPT_TARGET+='configure' |
770 | ;; |
771 | m) # maintainer-clean |
772 | CLEAN_OPTION=true |
773 | - MAKE_TARGET='clean_op' |
774 | + ;; |
775 | + o) # target |
776 | + CONFIGURE_ARG="$OPTARG" |
777 | ;; |
778 | t) # target |
779 | TARGET_OPTION=true |
780 | TARGET_OPTION_ARG="$OPTARG" |
781 | - MAKE_TARGET="$OPTARG" |
782 | + OPT_TARGET+="$OPTARG" |
783 | ;; |
784 | d) # debug |
785 | - DEBUG_OPTION=true |
786 | + opt_debug=true |
787 | enable_debug |
788 | ;; |
789 | h) # help |
790 | @@ -1141,6 +1156,7 @@ |
791 | echo " -p # Print ENV"; |
792 | echo " -c # Just run configure"; |
793 | echo " -m # Just run maintainer-clean"; |
794 | + echo " -o # Specify configure arguments"; |
795 | echo " -t # Make target"; |
796 | echo " -d # Enable debug"; |
797 | echo " -h # Show help"; |
798 | @@ -1148,8 +1164,8 @@ |
799 | exit |
800 | ;; |
801 | v) # verbose |
802 | - VERBOSE_OPTION=true |
803 | - VERBOSE=true |
804 | + opt_verbose=true |
805 | + verbose=true |
806 | ;; |
807 | :) |
808 | echo "Option -$OPTARG requires an argument." >&2 |
809 | @@ -1165,11 +1181,11 @@ |
810 | shift $((OPTIND-1)) |
811 | |
812 | if [ -n "$1" ]; then |
813 | - MAKE_TARGET="$@" |
814 | + OPT_TARGET="$@" |
815 | fi |
816 | } |
817 | |
818 | -function determine_vcs () |
819 | +determine_vcs () |
820 | { |
821 | if [[ -d '.git' ]]; then |
822 | VCS_CHECKOUT=git |
823 | @@ -1184,38 +1200,37 @@ |
824 | fi |
825 | |
826 | if [[ -n "$VCS_CHECKOUT" ]]; then |
827 | - VERBOSE=true |
828 | + verbose=true |
829 | fi |
830 | } |
831 | |
832 | -function require_libtoolise () |
833 | +require_libtoolise () |
834 | { |
835 | - use_libtool=0 |
836 | grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \ |
837 | - && use_libtool=1 |
838 | + && use_libtool=true |
839 | grep '^[ ]*LT_INIT' configure.ac >/dev/null \ |
840 | - && use_libtool=1 |
841 | + && use_libtool=true |
842 | } |
843 | |
844 | -function autoreconf_setup () |
845 | +autoreconf_setup () |
846 | { |
847 | # Set ENV MAKE in order to override "make" |
848 | if [[ -z "$MAKE" ]]; then |
849 | if command_exists 'gmake'; then |
850 | - MAKE=`type -p gmake` |
851 | + MAKE="$(type -p gmake)" |
852 | else |
853 | if command_exists 'make'; then |
854 | - MAKE=`type -p make` |
855 | + MAKE="$(type -p make)" |
856 | fi |
857 | fi |
858 | |
859 | if [ "$VCS_CHECKOUT" ]; then |
860 | - if $DEBUG; then |
861 | + if $debug; then |
862 | MAKE="$MAKE --warn-undefined-variables" |
863 | fi |
864 | fi |
865 | |
866 | - if $DEBUG; then |
867 | + if $debug; then |
868 | MAKE="$MAKE -d" |
869 | fi |
870 | fi |
871 | @@ -1224,7 +1239,7 @@ |
872 | GNU_BUILD_FLAGS="--install --force" |
873 | fi |
874 | |
875 | - if $VERBOSE; then |
876 | + if $verbose; then |
877 | GNU_BUILD_FLAGS="$GNU_BUILD_FLAGS --verbose" |
878 | fi |
879 | |
880 | @@ -1240,9 +1255,9 @@ |
881 | fi |
882 | fi |
883 | |
884 | - if test $use_libtool = 1; then |
885 | + if $use_libtool; then |
886 | if [[ -n "$LIBTOOLIZE" ]]; then |
887 | - BOOTSTRAP_LIBTOOLIZE=`type -p $LIBTOOLIZE` |
888 | + BOOTSTRAP_LIBTOOLIZE="$(type -p $LIBTOOLIZE)" |
889 | |
890 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
891 | echo "Couldn't find user supplied libtoolize, it is required" |
892 | @@ -1251,14 +1266,14 @@ |
893 | else |
894 | # If we are using OSX, we first check to see glibtoolize is available |
895 | if [[ "$VENDOR_DISTRIBUTION" == "darwin" ]]; then |
896 | - BOOTSTRAP_LIBTOOLIZE=`type -p glibtoolize` |
897 | + BOOTSTRAP_LIBTOOLIZE="$(type -p glibtoolize)" |
898 | |
899 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
900 | echo "Couldn't find glibtoolize, it is required on OSX" |
901 | return 1 |
902 | fi |
903 | else |
904 | - BOOTSTRAP_LIBTOOLIZE=`type -p libtoolize` |
905 | + BOOTSTRAP_LIBTOOLIZE="$(type -p libtoolize)" |
906 | |
907 | if [[ -z "$BOOTSTRAP_LIBTOOLIZE" ]]; then |
908 | echo "Couldn't find libtoolize, it is required" |
909 | @@ -1267,11 +1282,11 @@ |
910 | fi |
911 | fi |
912 | |
913 | - if $VERBOSE; then |
914 | + if $verbose; then |
915 | LIBTOOLIZE_OPTIONS="--verbose $BOOTSTRAP_LIBTOOLIZE_OPTIONS" |
916 | fi |
917 | |
918 | - if $DEBUG; then |
919 | + if $debug; then |
920 | LIBTOOLIZE_OPTIONS="--debug $BOOTSTRAP_LIBTOOLIZE_OPTIONS" |
921 | fi |
922 | |
923 | @@ -1281,32 +1296,32 @@ |
924 | |
925 | # Test the ENV AUTOMAKE if it exists |
926 | if [[ -n "$AUTOMAKE" ]]; then |
927 | - run $AUTOMAKE '--help' &> /dev/null || die "Failed to run AUTOMAKE:$AUTOMAKE" |
928 | + run "$AUTOMAKE" '--help' &> /dev/null || die "Failed to run AUTOMAKE:$AUTOMAKE" |
929 | fi |
930 | |
931 | # Test the ENV AUTOCONF if it exists |
932 | if [[ -n "$AUTOCONF" ]]; then |
933 | - run $AUTOCONF '--help' &> /dev/null || die "Failed to run AUTOCONF:$AUTOCONF" |
934 | + run "$AUTOCONF" '--help' &> /dev/null || die "Failed to run AUTOCONF:$AUTOCONF" |
935 | fi |
936 | |
937 | # Test the ENV AUTOHEADER if it exists |
938 | if [[ -n "$AUTOHEADER" ]]; then |
939 | - run $AUTOHEADER '--help' &> /dev/null || die "Failed to run AUTOHEADER:$AUTOHEADER" |
940 | + run "$AUTOHEADER" '--help' &> /dev/null || die "Failed to run AUTOHEADER:$AUTOHEADER" |
941 | fi |
942 | |
943 | # Test the ENV AUTOM4TE if it exists |
944 | if [[ -n "$AUTOM4TE" ]]; then |
945 | - run $AUTOM4TE '--help' &> /dev/null || die "Failed to run AUTOM4TE:$AUTOM4TE" |
946 | + run "$AUTOM4TE" '--help' &> /dev/null || die "Failed to run AUTOM4TE:$AUTOM4TE" |
947 | fi |
948 | |
949 | # Test the ENV AUTOHEADER if it exists, if not we add one and add --install |
950 | if [[ -z "$ACLOCAL" ]]; then |
951 | ACLOCAL="aclocal --install" |
952 | fi |
953 | - run $ACLOCAL '--help' &> /dev/null || die "Failed to run ACLOCAL:$ACLOCAL" |
954 | + run "$ACLOCAL" '--help' &> /dev/null || die "Failed to run ACLOCAL:$ACLOCAL" |
955 | |
956 | if [[ -z "$AUTORECONF" ]]; then |
957 | - AUTORECONF=`type -p autoreconf` |
958 | + AUTORECONF="$(type -p autoreconf)" |
959 | |
960 | if [[ -z "$AUTORECONF" ]]; then |
961 | die "Couldn't find autoreconf" |
962 | @@ -1317,13 +1332,13 @@ |
963 | fi |
964 | fi |
965 | |
966 | - run $AUTORECONF '--help' &> /dev/null || die "Failed to run AUTORECONF:$AUTORECONF" |
967 | + run "$AUTORECONF" '--help' &> /dev/null || die "Failed to run AUTORECONF:$AUTORECONF" |
968 | } |
969 | |
970 | -function print_setup () |
971 | +print_setup () |
972 | { |
973 | - saved_debug_status=$DEBUG |
974 | - if $DEBUG; then |
975 | + local saved_debug_status=$debug |
976 | + if $debug; then |
977 | disable_debug |
978 | fi |
979 | |
980 | @@ -1348,11 +1363,11 @@ |
981 | echo "--configure" |
982 | fi |
983 | |
984 | - if $DEBUG_OPTION; then |
985 | + if $opt_debug; then |
986 | echo "--debug" |
987 | fi |
988 | |
989 | - if $PRINT_SETUP_OPTION; then |
990 | + if $print_setup_opt; then |
991 | echo "--print-env" |
992 | fi |
993 | |
994 | @@ -1360,7 +1375,7 @@ |
995 | echo "--target=$TARGET_OPTION_ARG" |
996 | fi |
997 | |
998 | - if $VERBOSE_OPTION; then |
999 | + if $opt_verbose; then |
1000 | echo "--verbose" |
1001 | fi |
1002 | |
1003 | @@ -1384,17 +1399,18 @@ |
1004 | echo "VCS_CHECKOUT=$VCS_CHECKOUT" |
1005 | fi |
1006 | |
1007 | - if $VERBOSE; then |
1008 | - echo "VERBOSE=true" |
1009 | - fi |
1010 | - |
1011 | - if $DEBUG; then |
1012 | - echo "DEBUG=true" |
1013 | + if $debug; then |
1014 | + echo "debug=true" |
1015 | fi |
1016 | |
1017 | if [[ -n "$WARNINGS" ]]; then |
1018 | echo "WARNINGS=$WARNINGS" |
1019 | fi |
1020 | + |
1021 | + if $saved_debug_status; then |
1022 | + echo "DEBUG=true" |
1023 | + fi |
1024 | + |
1025 | echo '----------------------------------------------' |
1026 | |
1027 | if $saved_debug_status; then |
1028 | @@ -1402,7 +1418,7 @@ |
1029 | fi |
1030 | } |
1031 | |
1032 | -function make_clean_option () |
1033 | +make_clean_option () |
1034 | { |
1035 | run_configure_if_required |
1036 | |
1037 | @@ -1415,7 +1431,7 @@ |
1038 | fi |
1039 | } |
1040 | |
1041 | -function make_for_autoreconf () |
1042 | +make_for_autoreconf () |
1043 | { |
1044 | if [ -f 'Makefile' ]; then |
1045 | make_maintainer_clean |
1046 | @@ -1426,8 +1442,9 @@ |
1047 | assert_no_file 'Makefile' |
1048 | } |
1049 | |
1050 | -function check_make_target() |
1051 | +check_make_target() |
1052 | { |
1053 | + local ret=0 |
1054 | case $1 in |
1055 | 'self') |
1056 | ;; |
1057 | @@ -1481,20 +1498,21 @@ |
1058 | ;; |
1059 | *) |
1060 | echo "Matched default" |
1061 | - return 1 |
1062 | + ret=1 |
1063 | ;; |
1064 | esac |
1065 | |
1066 | - return 0 |
1067 | + return $ret |
1068 | } |
1069 | |
1070 | -function bootstrap () |
1071 | +execute_job () |
1072 | { |
1073 | determine_target_platform |
1074 | |
1075 | determine_vcs |
1076 | |
1077 | # Set up whatever we need to do to use autoreconf later |
1078 | + use_libtool=false |
1079 | require_libtoolise |
1080 | if ! autoreconf_setup; then |
1081 | return 1 |
1082 | @@ -1504,13 +1522,13 @@ |
1083 | MAKE_TARGET="make_default" |
1084 | fi |
1085 | |
1086 | - if $PRINT_SETUP_OPTION -o $DEBUG; then |
1087 | + if $print_setup_opt -o $debug; then |
1088 | echo |
1089 | print_setup |
1090 | echo |
1091 | |
1092 | # Exit if all we were looking for were the currently used options |
1093 | - if $PRINT_SETUP_OPTION; then |
1094 | + if $print_setup_opt; then |
1095 | exit |
1096 | fi |
1097 | fi |
1098 | @@ -1526,7 +1544,12 @@ |
1099 | # We should always have a target by this point |
1100 | assert MAKE_TARGET |
1101 | |
1102 | - local MAKE_TARGET_ARRAY=($MAKE_TARGET) |
1103 | + if $CLEAN_OPTION; then |
1104 | + make_maintainer_clean |
1105 | + fi |
1106 | + |
1107 | + local MAKE_TARGET_ARRAY |
1108 | + MAKE_TARGET_ARRAY=( $MAKE_TARGET ) |
1109 | |
1110 | for target in "${MAKE_TARGET_ARRAY[@]}" |
1111 | do |
1112 | @@ -1539,6 +1562,10 @@ |
1113 | fi |
1114 | fi |
1115 | |
1116 | + if $jenkins_build_environment; then |
1117 | + use_banner $target |
1118 | + fi |
1119 | + |
1120 | local snapshot_run=false |
1121 | local valgrind_run=false |
1122 | |
1123 | @@ -1568,6 +1595,7 @@ |
1124 | make_default |
1125 | ;; |
1126 | 'clang') |
1127 | + make_distclean |
1128 | if ! check_clang; then |
1129 | die "clang was not found" |
1130 | fi |
1131 | @@ -1577,6 +1605,7 @@ |
1132 | fi |
1133 | ;; |
1134 | 'clang-analyzer') |
1135 | + make_distclean |
1136 | if ! check_clang_analyzer; then |
1137 | die "clang-analyzer was not found" |
1138 | fi |
1139 | @@ -1589,10 +1618,7 @@ |
1140 | fi |
1141 | ;; |
1142 | 'mingw') |
1143 | - if ! check_mingw; then |
1144 | - die "mingw was not found" |
1145 | - fi |
1146 | - |
1147 | + make_distclean |
1148 | if ! make_for_mingw; then |
1149 | die "Failed to build mingw: $?" |
1150 | fi |
1151 | @@ -1609,7 +1635,6 @@ |
1152 | make_darwin_malloc |
1153 | ;; |
1154 | 'valgrind') |
1155 | - make_maintainer_clean |
1156 | make_valgrind |
1157 | ;; |
1158 | 'universe') |
1159 | @@ -1623,34 +1648,42 @@ |
1160 | make_target "$target" |
1161 | ;; |
1162 | esac |
1163 | - |
1164 | - if $jenkins_build_environment; then |
1165 | - if ! $snapshot_run; then |
1166 | - run_make_maintainer_clean_if_possible |
1167 | - fi |
1168 | - fi |
1169 | - |
1170 | done |
1171 | } |
1172 | |
1173 | -function main () |
1174 | +main () |
1175 | { |
1176 | + # Are we running inside of Jenkins? |
1177 | + if [[ -n "$JENKINS_HOME" ]]; then |
1178 | + declare -r jenkins_build_environment=true |
1179 | + else |
1180 | + declare -r jenkins_build_environment=false |
1181 | + fi |
1182 | + |
1183 | # Variables we export |
1184 | declare -x VCS_CHECKOUT= |
1185 | |
1186 | # Variables we control globally |
1187 | - local MAKE_TARGET= |
1188 | + local -a MAKE_TARGET= |
1189 | local CONFIGURE= |
1190 | + local use_libtool=false |
1191 | + local verbose=false |
1192 | + |
1193 | + #getop variables |
1194 | + local opt_debug=false |
1195 | + local opt_verbose=false |
1196 | + |
1197 | + if [[ -n "$VERBOSE" ]]; then |
1198 | + verbose=true |
1199 | + fi |
1200 | |
1201 | # Options for getopt |
1202 | local AUTORECONF_OPTION=false |
1203 | local CLEAN_OPTION=false |
1204 | local CONFIGURE_OPTION=false |
1205 | - local DEBUG_OPTION=false |
1206 | - local PRINT_SETUP_OPTION=false |
1207 | + local print_setup_opt=false |
1208 | local TARGET_OPTION=false |
1209 | local TARGET_OPTION_ARG= |
1210 | - local VERBOSE_OPTION=false |
1211 | |
1212 | local OLD_CONFIGURE= |
1213 | local OLD_CONFIGURE_ARG= |
1214 | @@ -1662,7 +1695,7 @@ |
1215 | local AUTORECONF_REBUILD_HOST=false |
1216 | local AUTORECONF_REBUILD=false |
1217 | |
1218 | - local -r top_srcdir=`pwd` |
1219 | + local -r top_srcdir="$(pwd)" |
1220 | |
1221 | # Default configure |
1222 | if [ -z "$CONFIGURE" ]; then |
1223 | @@ -1691,41 +1724,54 @@ |
1224 | |
1225 | rebuild_host_os no_output |
1226 | |
1227 | - parse_command_line_options $@ |
1228 | + local OPT_TARGET= |
1229 | + parse_command_line_options "$@" |
1230 | + |
1231 | + nassert MAKE_TARGET |
1232 | + |
1233 | + if [ -n "$OPT_TARGET" ]; then |
1234 | + MAKE_TARGET="$OPT_TARGET" |
1235 | + fi |
1236 | |
1237 | # If we are running under Jenkins we predetermine what tests we will run against |
1238 | # This MAKE_TARGET can be overridden by parse_command_line_options based MAKE_TARGET changes. |
1239 | # We don't want Jenkins overriding other variables, so we NULL them. |
1240 | if [ -z "$MAKE_TARGET" ]; then |
1241 | if $jenkins_build_environment; then |
1242 | - if [[ -n "$label" ]]; then |
1243 | - check_make_target $label |
1244 | - if [ $? -eq 0 ]; then |
1245 | - MAKE_TARGET="$label" |
1246 | - fi |
1247 | - fi |
1248 | - if [[ -n "$LABEL" ]]; then |
1249 | - check_make_target $LABEL |
1250 | - if [ $? -eq 0 ]; then |
1251 | - MAKE_TARGET="$LABEL" |
1252 | - fi |
1253 | - fi |
1254 | - |
1255 | - if [ -z "$MAKE_TARGET" ]; then |
1256 | - MAKE_TARGET='jenkins' |
1257 | + if [[ -n "$JENKINS_TARGET" ]]; then |
1258 | + MAKE_TARGET="$JENKINS_TARGET" |
1259 | + else |
1260 | + if [[ -n "$label" ]]; then |
1261 | + check_make_target $label |
1262 | + if [ $? -eq 0 ]; then |
1263 | + MAKE_TARGET="$label" |
1264 | + fi |
1265 | + fi |
1266 | + |
1267 | + if [[ -n "$LABEL" ]]; then |
1268 | + check_make_target $LABEL |
1269 | + if [ $? -eq 0 ]; then |
1270 | + MAKE_TARGET="$LABEL" |
1271 | + fi |
1272 | + fi |
1273 | + |
1274 | + if [ -z "$MAKE_TARGET" ]; then |
1275 | + MAKE_TARGET='jenkins' |
1276 | + fi |
1277 | fi |
1278 | fi |
1279 | fi |
1280 | |
1281 | - bootstrap |
1282 | + execute_job |
1283 | + local ret=$? |
1284 | |
1285 | jobs -l |
1286 | wait |
1287 | |
1288 | - exit 0 |
1289 | + exit $ret |
1290 | } |
1291 | |
1292 | -function set_branch () |
1293 | +set_branch () |
1294 | { |
1295 | if [ -z "$BRANCH" ]; then |
1296 | if [ -z "$CI_PROJECT_TEAM" ]; then |
1297 | @@ -1747,7 +1793,7 @@ |
1298 | fi |
1299 | } |
1300 | |
1301 | -function merge () |
1302 | +merge () |
1303 | { |
1304 | if [ -z "$VCS_CHECKOUT" ]; then |
1305 | die "Merges require VCS_CHECKOUT." |
1306 | @@ -1767,21 +1813,21 @@ |
1307 | fi |
1308 | } |
1309 | |
1310 | -function enable_debug () |
1311 | +enable_debug () |
1312 | { |
1313 | - if ! $DEBUG; then |
1314 | - local caller_loc=`caller` |
1315 | - if [ -n $1 ]; then |
1316 | + if ! $debug; then |
1317 | + local caller_loc="$(caller)" |
1318 | + if [[ -n "$1" ]]; then |
1319 | echo "$caller_loc Enabling debug: $1" |
1320 | else |
1321 | echo "$caller_loc Enabling debug" |
1322 | fi |
1323 | set -x |
1324 | - DEBUG=true |
1325 | + debug=true |
1326 | fi |
1327 | } |
1328 | |
1329 | -function usage () |
1330 | +usage () |
1331 | { |
1332 | cat << EOF |
1333 | Usage: $program_name [OPTION].. |
1334 | @@ -1793,76 +1839,83 @@ |
1335 | EOF |
1336 | } |
1337 | |
1338 | -function disable_debug () |
1339 | +disable_debug () |
1340 | { |
1341 | set +x |
1342 | - DEBUG=true |
1343 | -} |
1344 | - |
1345 | -# Script begins here |
1346 | - |
1347 | -program_name=$0 |
1348 | - |
1349 | -env_debug_enabled=false |
1350 | -if [[ -n "$JENKINS_HOME" ]]; then |
1351 | - declare -r jenkins_build_environment=true |
1352 | -else |
1353 | - declare -r jenkins_build_environment=false |
1354 | -fi |
1355 | - |
1356 | -export ACLOCAL |
1357 | -export AUTOCONF |
1358 | -export AUTOHEADER |
1359 | -export AUTOM4TE |
1360 | -export AUTOMAKE |
1361 | -export AUTORECONF |
1362 | -export CONFIGURE_ARG |
1363 | -export DEBUG |
1364 | -export GNU_BUILD_FLAGS |
1365 | -export LIBTOOLIZE |
1366 | -export LIBTOOLIZE_OPTIONS |
1367 | -export MAKE |
1368 | -export PREFIX_ARG |
1369 | -export TESTS_ENVIRONMENT |
1370 | -export VERBOSE |
1371 | -export WARNINGS |
1372 | - |
1373 | -case $OSTYPE in |
1374 | - darwin*) |
1375 | - export MallocGuardEdges |
1376 | - export MallocErrorAbort |
1377 | - export MallocScribble |
1378 | - ;; |
1379 | -esac |
1380 | - |
1381 | -# We check for DEBUG twice, once before we source the config file, and once afterward |
1382 | -env_debug_enabled=false |
1383 | -if [[ -n "$DEBUG" ]]; then |
1384 | - env_debug_enabled=true |
1385 | - enable_debug |
1386 | - print_setup |
1387 | -fi |
1388 | - |
1389 | -# Variables which only can be set by .bootstrap |
1390 | -BOOTSTRAP_SNAPSHOT=false |
1391 | -BOOTSTRAP_SNAPSHOT_CHECK= |
1392 | - |
1393 | -if [ -f '.bootstrap' ]; then |
1394 | - source '.bootstrap' |
1395 | -fi |
1396 | - |
1397 | -if $env_debug_enabled; then |
1398 | - enable_debug |
1399 | -else |
1400 | + debug=false |
1401 | +} |
1402 | + |
1403 | +check_shell () |
1404 | +{ |
1405 | + if [ -x '/usr/local/bin/shellcheck' ]; then |
1406 | + /usr/local/bin/shellcheck "$1" |
1407 | + local ret=$? |
1408 | + |
1409 | + if [ "$ret" -ne 0 ]; then |
1410 | + die "$1 failed shellcheck" |
1411 | + fi |
1412 | + fi |
1413 | +} |
1414 | + |
1415 | +bootstrap () |
1416 | +{ |
1417 | + check_shell 'bootstrap.sh' |
1418 | + local env_debug_enabled=false |
1419 | + local debug=false |
1420 | + |
1421 | + export ACLOCAL |
1422 | + export AUTOCONF |
1423 | + export AUTOHEADER |
1424 | + export AUTOM4TE |
1425 | + export AUTOMAKE |
1426 | + export AUTORECONF |
1427 | + export CONFIGURE_ARG |
1428 | + export DEBUG |
1429 | + export GNU_BUILD_FLAGS |
1430 | + export LIBTOOLIZE |
1431 | + export LIBTOOLIZE_OPTIONS |
1432 | + export MAKE |
1433 | + export PREFIX_ARG |
1434 | + export TESTS_ENVIRONMENT |
1435 | + export VERBOSE |
1436 | + export WARNINGS |
1437 | + |
1438 | + case $OSTYPE in |
1439 | + darwin*) |
1440 | + export MallocGuardEdges |
1441 | + export MallocErrorAbort |
1442 | + export MallocScribble |
1443 | + ;; |
1444 | + esac |
1445 | + |
1446 | + # We check for DEBUG twice, once before we source the config file, and once afterward |
1447 | if [[ -n "$DEBUG" ]]; then |
1448 | + env_debug_enabled=true |
1449 | + fi |
1450 | + |
1451 | + # Variables which only can be set by .bootstrap |
1452 | + BOOTSTRAP_SNAPSHOT=false |
1453 | + BOOTSTRAP_SNAPSHOT_CHECK= |
1454 | + |
1455 | + if [ -f '.bootstrap' ]; then |
1456 | + source '.bootstrap' |
1457 | + fi |
1458 | + |
1459 | + # We do this in order to protect the case where DEBUG that came from the ENV (i.e. it overrides what is found in .bootstrap |
1460 | + if $env_debug_enabled; then |
1461 | + enable_debug |
1462 | + elif [[ -n "$DEBUG" ]]; then |
1463 | enable_debug "Enabling DEBUG from '.bootstrap'" |
1464 | + fi |
1465 | + |
1466 | + if $env_debug_enabled; then |
1467 | print_setup |
1468 | fi |
1469 | -fi |
1470 | - |
1471 | -# We do this in order to protect the case where DEBUG |
1472 | -if ! $env_debug_enabled; then |
1473 | - DEBUG=false |
1474 | -fi |
1475 | - |
1476 | -main $@ |
1477 | + |
1478 | + |
1479 | + main "$@" |
1480 | +} |
1481 | + |
1482 | +# Script begins here |
1483 | +declare -r program_name="$0" |
1484 | +bootstrap "$@" |
1485 | |
1486 | === modified file 'clients/include.am' |
1487 | --- clients/include.am 2012-11-25 14:12:14 +0000 |
1488 | +++ clients/include.am 2013-06-14 07:11:24 +0000 |
1489 | @@ -42,7 +42,8 @@ |
1490 | noinst_HEADERS+= clients/utilities.h |
1491 | |
1492 | noinst_LTLIBRARIES+= clients/libutilities.la |
1493 | -clients_libutilities_la_SOURCES= clients/utilities.cc |
1494 | +clients_libutilities_la_SOURCES= |
1495 | +clients_libutilities_la_SOURCES+= clients/utilities.cc |
1496 | |
1497 | clients_memcat_SOURCES= clients/memcat.cc |
1498 | clients_memcat_LDADD= $(CLIENTS_LDADDS) |
1499 | |
1500 | === modified file 'clients/memcat.cc' |
1501 | --- clients/memcat.cc 2013-04-03 13:14:23 +0000 |
1502 | +++ clients/memcat.cc 2013-06-14 07:11:24 +0000 |
1503 | @@ -80,7 +80,7 @@ |
1504 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, |
1505 | (uint64_t)opt_binary); |
1506 | |
1507 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1508 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1509 | { |
1510 | memcached_free(memc); |
1511 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1512 | @@ -186,6 +186,8 @@ |
1513 | } |
1514 | |
1515 | |
1516 | +#pragma GCC diagnostic push |
1517 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
1518 | void options_parse(int argc, char *argv[]) |
1519 | { |
1520 | int option_index= 0; |
1521 | @@ -263,3 +265,4 @@ |
1522 | } |
1523 | } |
1524 | } |
1525 | +#pragma GCC diagnostic pop |
1526 | |
1527 | === modified file 'clients/memcp.cc' |
1528 | --- clients/memcp.cc 2013-05-04 09:20:42 +0000 |
1529 | +++ clients/memcp.cc 2013-06-14 07:11:24 +0000 |
1530 | @@ -160,7 +160,7 @@ |
1531 | memcached_server_push(memc, servers); |
1532 | memcached_server_list_free(servers); |
1533 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, opt_binary); |
1534 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1535 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1536 | { |
1537 | memcached_free(memc); |
1538 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1539 | |
1540 | === modified file 'clients/memdump.cc' |
1541 | --- clients/memdump.cc 2013-05-04 09:20:42 +0000 |
1542 | +++ clients/memdump.cc 2013-06-14 07:11:24 +0000 |
1543 | @@ -102,7 +102,7 @@ |
1544 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, |
1545 | (uint64_t)opt_binary); |
1546 | |
1547 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1548 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1549 | { |
1550 | memcached_free(memc); |
1551 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1552 | |
1553 | === modified file 'clients/memexist.cc' |
1554 | --- clients/memexist.cc 2013-04-03 13:14:23 +0000 |
1555 | +++ clients/memexist.cc 2013-06-14 07:11:24 +0000 |
1556 | @@ -70,7 +70,7 @@ |
1557 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, |
1558 | (uint64_t) opt_binary); |
1559 | |
1560 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1561 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1562 | { |
1563 | memcached_free(memc); |
1564 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1565 | |
1566 | === modified file 'clients/memflush.cc' |
1567 | --- clients/memflush.cc 2013-04-20 09:51:38 +0000 |
1568 | +++ clients/memflush.cc 2013-06-14 07:11:24 +0000 |
1569 | @@ -69,7 +69,7 @@ |
1570 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, |
1571 | (uint64_t) opt_binary); |
1572 | |
1573 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1574 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1575 | { |
1576 | memcached_free(memc); |
1577 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1578 | |
1579 | === modified file 'clients/memping.cc' |
1580 | --- clients/memping.cc 2013-04-20 09:51:38 +0000 |
1581 | +++ clients/memping.cc 2013-06-14 07:11:24 +0000 |
1582 | @@ -95,6 +95,8 @@ |
1583 | } |
1584 | |
1585 | |
1586 | +#pragma GCC diagnostic push |
1587 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
1588 | void options_parse(int argc, char *argv[]) |
1589 | { |
1590 | memcached_programs_help_st help_options[]= |
1591 | @@ -198,3 +200,4 @@ |
1592 | exit(EXIT_SUCCESS); |
1593 | } |
1594 | } |
1595 | +#pragma GCC diagnostic pop |
1596 | |
1597 | === modified file 'clients/memrm.cc' |
1598 | --- clients/memrm.cc 2013-04-20 09:51:38 +0000 |
1599 | +++ clients/memrm.cc 2013-06-14 07:11:24 +0000 |
1600 | @@ -73,7 +73,7 @@ |
1601 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, |
1602 | (uint64_t) opt_binary); |
1603 | |
1604 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1605 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1606 | { |
1607 | memcached_free(memc); |
1608 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1609 | |
1610 | === modified file 'clients/memstat.cc' |
1611 | --- clients/memstat.cc 2013-04-03 13:14:23 +0000 |
1612 | +++ clients/memstat.cc 2013-06-14 07:11:24 +0000 |
1613 | @@ -138,7 +138,7 @@ |
1614 | memcached_return_t rc= memcached_server_push(memc, servers); |
1615 | memcached_server_list_free(servers); |
1616 | |
1617 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1618 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1619 | { |
1620 | memcached_free(memc); |
1621 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1622 | |
1623 | === modified file 'clients/memtouch.cc' |
1624 | --- clients/memtouch.cc 2013-04-03 13:14:23 +0000 |
1625 | +++ clients/memtouch.cc 2013-06-14 07:11:24 +0000 |
1626 | @@ -77,7 +77,7 @@ |
1627 | memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, |
1628 | (uint64_t)opt_binary); |
1629 | |
1630 | - if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
1631 | + if (opt_username and libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
1632 | { |
1633 | memcached_free(memc); |
1634 | std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; |
1635 | |
1636 | === modified file 'clients/utilities.cc' |
1637 | --- clients/utilities.cc 2013-03-13 03:23:07 +0000 |
1638 | +++ clients/utilities.cc 2013-06-14 07:11:24 +0000 |
1639 | @@ -73,6 +73,8 @@ |
1640 | } |
1641 | |
1642 | |
1643 | +#pragma GCC diagnostic push |
1644 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
1645 | static const char *lookup_help(memcached_options option) |
1646 | { |
1647 | switch (option) |
1648 | @@ -106,12 +108,12 @@ |
1649 | case OPT_STAT_ARGS: return "Argument for statistics"; |
1650 | case OPT_SERVER_VERSION: return "Memcached daemon software version"; |
1651 | default: |
1652 | - break; |
1653 | + break; |
1654 | }; |
1655 | |
1656 | - assert(0); |
1657 | - return "forgot to document this function :)"; |
1658 | + return "Programmer error, function for options not implemented"; |
1659 | } |
1660 | +#pragma GCC diagnostic pop |
1661 | |
1662 | void help_command(const char *command_name, const char *description, |
1663 | const struct option *long_options, |
1664 | @@ -131,7 +133,9 @@ |
1665 | printf("\t --%s%c\n", long_options[x].name, |
1666 | long_options[x].has_arg ? '=' : ' '); |
1667 | if ((help_message= lookup_help(memcached_options(long_options[x].val)))) |
1668 | + { |
1669 | printf("\t\t%s\n", help_message); |
1670 | + } |
1671 | } |
1672 | |
1673 | printf("\n"); |
1674 | |
1675 | === modified file 'configure.ac' |
1676 | --- configure.ac 2013-05-04 09:20:42 +0000 |
1677 | +++ configure.ac 2013-06-14 07:11:24 +0000 |
1678 | @@ -88,6 +88,7 @@ |
1679 | AM_CONDITIONAL([HAVE_LIBMEMCACHED],[false]) |
1680 | AM_CONDITIONAL([HAVE_LIBDRIZZLE],[false]) |
1681 | AC_DEFINE([HAVE_LIBMEMCACHED],[1],[Enables libmemcached Support]) |
1682 | +AC_SUBST([LIBMEMCACHED_CFLAGS]) |
1683 | |
1684 | AM_CONDITIONAL([BUILDING_GEARMAN],[false]) |
1685 | |
1686 | |
1687 | === modified file 'docs/include.am' |
1688 | --- docs/include.am 2013-04-28 11:30:05 +0000 |
1689 | +++ docs/include.am 2013-06-14 07:11:24 +0000 |
1690 | @@ -43,59 +43,59 @@ |
1691 | @cp -r ${top_builddir}/html $(htmldir)/ |
1692 | |
1693 | html-local: docs/conf.py |
1694 | - @PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) ${top_builddir}/html |
1695 | + @PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b html $(ALLSPHINXOPTS) ${top_builddir}/html |
1696 | |
1697 | singlehtml: html-local |
1698 | - @PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/singlehtml |
1699 | + @PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b singlehtml $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/singlehtml |
1700 | |
1701 | pickle: docs/conf.py |
1702 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/pickle |
1703 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b pickle $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/pickle |
1704 | @echo |
1705 | @echo "Build finished; now you can process the pickle files." |
1706 | |
1707 | json: docs/conf.py |
1708 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/json |
1709 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b json $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/json |
1710 | @echo |
1711 | @echo "Build finished; now you can process the JSON files." |
1712 | |
1713 | htmlhelp: docs/conf.py |
1714 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/htmlhelp |
1715 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b htmlhelp $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/htmlhelp |
1716 | @echo |
1717 | @echo "Build finished; now you can run HTML Help Workshop with the" \ |
1718 | ".hhp project file in $(SPHINX_BUILDDIR)/htmlhelp." |
1719 | |
1720 | epub: docs/conf.py |
1721 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/epub |
1722 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b epub $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/epub |
1723 | @echo |
1724 | @echo "Build finished. The epub file is in $(SPHINX_BUILDDIR)/epub." |
1725 | |
1726 | latex: docs/conf.py |
1727 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex |
1728 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex |
1729 | @echo |
1730 | @echo "Build finished; the LaTeX files are in $(SPHINX_BUILDDIR)/latex." |
1731 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ |
1732 | "(use \`make latexpdf' here to do that automatically)." |
1733 | |
1734 | latexpdf: latex |
1735 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex |
1736 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b latex $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/latex |
1737 | @echo "Running LaTeX files through pdflatex..." |
1738 | make -C $(SPHINX_BUILDDIR)/latex all-pdf |
1739 | @echo "pdflatex finished; the PDF files are in $(SPHINX_BUILDDIR)/latex." |
1740 | |
1741 | text: docs/conf.py |
1742 | - @PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/text |
1743 | + @PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b text $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/text |
1744 | |
1745 | man: |
1746 | - @PYTHONPATH=$(SPHINX_BUILDDIR)/docs $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) ${top_builddir}/man |
1747 | + @PYTHONPATH=$(SPHINX_BUILDDIR)/docs @SPHINXBUILD@ -b man $(ALLSPHINXOPTS) ${top_builddir}/man |
1748 | |
1749 | |
1750 | changes: docs/conf.py |
1751 | - @PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/changes |
1752 | + @PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b changes $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/changes |
1753 | |
1754 | linkcheck: docs/conf.py |
1755 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/linkcheck |
1756 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b linkcheck $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/linkcheck |
1757 | |
1758 | doctest: docs/conf.py |
1759 | - PYTHONPATH=${top_srcdir}/docs $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/doctest |
1760 | + PYTHONPATH=${top_srcdir}/docs @SPHINXBUILD@ -b doctest $(ALLSPHINXOPTS) $(SPHINX_BUILDDIR)/doctest |
1761 | @echo "Testing of doctests in the sources finished, look at the " \ |
1762 | "results in $(SPHINX_BUILDDIR)/doctest/output.txt." |
1763 | |
1764 | === modified file 'libhashkit/digest.cc' |
1765 | --- libhashkit/digest.cc 2012-11-21 12:05:17 +0000 |
1766 | +++ libhashkit/digest.cc 2013-06-14 07:11:24 +0000 |
1767 | @@ -42,6 +42,8 @@ |
1768 | return self->base_hash.function(key, key_length, self->base_hash.context); |
1769 | } |
1770 | |
1771 | +#pragma GCC diagnostic push |
1772 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
1773 | uint32_t libhashkit_digest(const char *key, size_t key_length, hashkit_hash_algorithm_t hash_algorithm) |
1774 | { |
1775 | switch (hash_algorithm) |
1776 | @@ -91,3 +93,4 @@ |
1777 | |
1778 | return 1; |
1779 | } |
1780 | +#pragma GCC diagnostic push |
1781 | |
1782 | === added file 'libmemcached-1.2/feature.h' |
1783 | --- libmemcached-1.2/feature.h 1970-01-01 00:00:00 +0000 |
1784 | +++ libmemcached-1.2/feature.h 2013-06-14 07:11:24 +0000 |
1785 | @@ -0,0 +1,53 @@ |
1786 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1787 | + * |
1788 | + * Libmemcached library |
1789 | + * |
1790 | + * Copyright (C) 2013 Data Differential, http://datadifferential.com/ |
1791 | + * |
1792 | + * Redistribution and use in source and binary forms, with or without |
1793 | + * modification, are permitted provided that the following conditions are |
1794 | + * met: |
1795 | + * |
1796 | + * * Redistributions of source code must retain the above copyright |
1797 | + * notice, this list of conditions and the following disclaimer. |
1798 | + * |
1799 | + * * Redistributions in binary form must reproduce the above |
1800 | + * copyright notice, this list of conditions and the following disclaimer |
1801 | + * in the documentation and/or other materials provided with the |
1802 | + * distribution. |
1803 | + * |
1804 | + * * The names of its contributors may not be used to endorse or |
1805 | + * promote products derived from this software without specific prior |
1806 | + * written permission. |
1807 | + * |
1808 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
1809 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
1810 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
1811 | + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
1812 | + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
1813 | + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
1814 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
1815 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
1816 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
1817 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
1818 | + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1819 | + * |
1820 | + */ |
1821 | + |
1822 | +#pragma once |
1823 | + |
1824 | +enum libmemcached_feature_t { |
1825 | + LIBMEMCACHED_FEATURE_HAS_SASL, |
1826 | + LIBMEMCACHED_FEATURE_MAX |
1827 | +}; |
1828 | + |
1829 | +#ifdef __cplusplus |
1830 | +extern "C" { |
1831 | +#endif |
1832 | + |
1833 | +LIBMEMCACHED_API |
1834 | +bool libmemcached_has_feature(enum libmemcached_feature_t arg); |
1835 | + |
1836 | +#ifdef __cplusplus |
1837 | +} // extern "C" |
1838 | +#endif |
1839 | |
1840 | === modified file 'libmemcached-1.2/include.am' |
1841 | --- libmemcached-1.2/include.am 2012-10-13 23:12:16 +0000 |
1842 | +++ libmemcached-1.2/include.am 2013-06-14 07:11:24 +0000 |
1843 | @@ -27,6 +27,7 @@ |
1844 | nobase_include_HEADERS+= libmemcached-1.2/error.h |
1845 | nobase_include_HEADERS+= libmemcached-1.2/exception.hpp |
1846 | nobase_include_HEADERS+= libmemcached-1.2/exist.h |
1847 | +nobase_include_HEADERS+= libmemcached-1.2/feature.h |
1848 | nobase_include_HEADERS+= libmemcached-1.2/fetch.h |
1849 | nobase_include_HEADERS+= libmemcached-1.2/flush.h |
1850 | nobase_include_HEADERS+= libmemcached-1.2/flush_buffers.h |
1851 | |
1852 | === modified file 'libmemcached-1.2/memcached.h' |
1853 | --- libmemcached-1.2/memcached.h 2013-04-03 13:14:23 +0000 |
1854 | +++ libmemcached-1.2/memcached.h 2013-06-14 07:11:24 +0000 |
1855 | @@ -59,6 +59,8 @@ |
1856 | #include <libmemcached-1.2/configure.h> |
1857 | #include <libmemcached-1.2/platform.h> |
1858 | |
1859 | +#include <libmemcached-1.2/feature.h> |
1860 | + |
1861 | #include <libmemcached-1.2/limits.h> |
1862 | #include <libmemcached-1.2/defaults.h> |
1863 | |
1864 | |
1865 | === modified file 'libmemcached-1.2/sasl.h' |
1866 | --- libmemcached-1.2/sasl.h 2012-10-13 23:12:16 +0000 |
1867 | +++ libmemcached-1.2/sasl.h 2013-06-14 07:11:24 +0000 |
1868 | @@ -38,9 +38,9 @@ |
1869 | #pragma once |
1870 | |
1871 | #if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT |
1872 | -#include <sasl/sasl.h> |
1873 | +# include <sasl/sasl.h> |
1874 | #else |
1875 | -#define sasl_callback_t void |
1876 | +# define sasl_callback_t void |
1877 | #endif |
1878 | |
1879 | #ifdef __cplusplus |
1880 | |
1881 | === modified file 'libmemcached/connect.cc' |
1882 | --- libmemcached/connect.cc 2013-04-21 08:19:20 +0000 |
1883 | +++ libmemcached/connect.cc 2013-06-14 07:11:24 +0000 |
1884 | @@ -407,6 +407,7 @@ |
1885 | assert(error == 0); |
1886 | } |
1887 | |
1888 | +#if defined(TCP_KEEPIDLE) && TCP_KEEPIDLE |
1889 | if (TCP_KEEPIDLE) |
1890 | { |
1891 | if (server->root->tcp_keepidle > 0) |
1892 | @@ -417,6 +418,7 @@ |
1893 | assert(error == 0); |
1894 | } |
1895 | } |
1896 | +#endif |
1897 | |
1898 | if (server->root->send_size > 0) |
1899 | { |
1900 | @@ -743,7 +745,7 @@ |
1901 | return rc; |
1902 | } |
1903 | |
1904 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT and server->root->sasl.callbacks and memcached_is_udp(server->root)) |
1905 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) and server->root->sasl.callbacks and memcached_is_udp(server->root)) |
1906 | { |
1907 | return memcached_set_error(*server, MEMCACHED_INVALID_HOST_PROTOCOL, MEMCACHED_AT, memcached_literal_param("SASL is not supported for UDP connections")); |
1908 | } |
1909 | @@ -760,8 +762,7 @@ |
1910 | case MEMCACHED_CONNECTION_TCP: |
1911 | rc= network_connect(server); |
1912 | |
1913 | -#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) |
1914 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT) |
1915 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL)) |
1916 | { |
1917 | if (server->fd != INVALID_SOCKET and server->root->sasl.callbacks) |
1918 | { |
1919 | @@ -773,7 +774,6 @@ |
1920 | } |
1921 | } |
1922 | } |
1923 | -#endif |
1924 | break; |
1925 | |
1926 | case MEMCACHED_CONNECTION_UNIX_SOCKET: |
1927 | |
1928 | === modified file 'libmemcached/csl/parser.yy' |
1929 | --- libmemcached/csl/parser.yy 2013-02-12 05:44:21 +0000 |
1930 | +++ libmemcached/csl/parser.yy 2013-06-14 07:11:24 +0000 |
1931 | @@ -65,8 +65,13 @@ |
1932 | #include <libmemcached/csl/symbol.h> |
1933 | #include <libmemcached/csl/scanner.h> |
1934 | |
1935 | +#ifdef __clang__ |
1936 | +# pragma GCC diagnostic ignored "-Wunreachable-code" |
1937 | +#endif |
1938 | + |
1939 | #ifndef __INTEL_COMPILER |
1940 | # pragma GCC diagnostic ignored "-Wold-style-cast" |
1941 | +# pragma GCC diagnostic ignored "-Wunreachable-code" |
1942 | #endif |
1943 | |
1944 | #ifndef __INTEL_COMPILER |
1945 | |
1946 | === modified file 'libmemcached/csl/scanner.l' |
1947 | --- libmemcached/csl/scanner.l 2013-01-30 02:46:06 +0000 |
1948 | +++ libmemcached/csl/scanner.l 2013-06-14 07:11:24 +0000 |
1949 | @@ -42,6 +42,10 @@ |
1950 | #include <libmemcached/csl/parser.h> |
1951 | #include <libmemcached/csl/symbol.h> |
1952 | |
1953 | +#ifdef __clang__ |
1954 | +# pragma GCC diagnostic ignored "-Wunreachable-code" |
1955 | +#endif |
1956 | + |
1957 | #ifndef __INTEL_COMPILER |
1958 | #pragma GCC diagnostic ignored "-Wold-style-cast" |
1959 | #pragma GCC diagnostic ignored "-Wsign-compare" |
1960 | |
1961 | === added file 'libmemcached/feature.cc' |
1962 | --- libmemcached/feature.cc 1970-01-01 00:00:00 +0000 |
1963 | +++ libmemcached/feature.cc 2013-06-14 07:11:24 +0000 |
1964 | @@ -0,0 +1,51 @@ |
1965 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
1966 | + * |
1967 | + * Libmemcached library |
1968 | + * |
1969 | + * Copyright (C) 2013 Data Differential, http://datadifferential.com/ |
1970 | + * |
1971 | + * Redistribution and use in source and binary forms, with or without |
1972 | + * modification, are permitted provided that the following conditions are |
1973 | + * met: |
1974 | + * |
1975 | + * * Redistributions of source code must retain the above copyright |
1976 | + * notice, this list of conditions and the following disclaimer. |
1977 | + * |
1978 | + * * Redistributions in binary form must reproduce the above |
1979 | + * copyright notice, this list of conditions and the following disclaimer |
1980 | + * in the documentation and/or other materials provided with the |
1981 | + * distribution. |
1982 | + * |
1983 | + * * The names of its contributors may not be used to endorse or |
1984 | + * promote products derived from this software without specific prior |
1985 | + * written permission. |
1986 | + * |
1987 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
1988 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
1989 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
1990 | + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
1991 | + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
1992 | + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
1993 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
1994 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
1995 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
1996 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
1997 | + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
1998 | + * |
1999 | + */ |
2000 | + |
2001 | +#include <libmemcached/common.h> |
2002 | + |
2003 | +bool libmemcached_has_feature(enum libmemcached_feature_t arg) |
2004 | +{ |
2005 | + switch (arg) |
2006 | + { |
2007 | + case LIBMEMCACHED_FEATURE_HAS_SASL: |
2008 | + return LIBMEMCACHED_WITH_SASL_SUPPORT; |
2009 | + |
2010 | + case LIBMEMCACHED_FEATURE_MAX: |
2011 | + break; |
2012 | + } |
2013 | + |
2014 | + return false; |
2015 | +} |
2016 | |
2017 | === added file 'libmemcached/feature.h' |
2018 | --- libmemcached/feature.h 1970-01-01 00:00:00 +0000 |
2019 | +++ libmemcached/feature.h 2013-06-14 07:11:24 +0000 |
2020 | @@ -0,0 +1,37 @@ |
2021 | +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
2022 | + * |
2023 | + * Libmemcached library |
2024 | + * |
2025 | + * Copyright (C) 2013 Data Differential, http://datadifferential.com/ |
2026 | + * |
2027 | + * Redistribution and use in source and binary forms, with or without |
2028 | + * modification, are permitted provided that the following conditions are |
2029 | + * met: |
2030 | + * |
2031 | + * * Redistributions of source code must retain the above copyright |
2032 | + * notice, this list of conditions and the following disclaimer. |
2033 | + * |
2034 | + * * Redistributions in binary form must reproduce the above |
2035 | + * copyright notice, this list of conditions and the following disclaimer |
2036 | + * in the documentation and/or other materials provided with the |
2037 | + * distribution. |
2038 | + * |
2039 | + * * The names of its contributors may not be used to endorse or |
2040 | + * promote products derived from this software without specific prior |
2041 | + * written permission. |
2042 | + * |
2043 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
2044 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
2045 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
2046 | + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
2047 | + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
2048 | + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
2049 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
2050 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
2051 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
2052 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
2053 | + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
2054 | + * |
2055 | + */ |
2056 | + |
2057 | +#pragma once |
2058 | |
2059 | === modified file 'libmemcached/flag.cc' |
2060 | --- libmemcached/flag.cc 2012-07-09 09:20:53 +0000 |
2061 | +++ libmemcached/flag.cc 2013-06-14 07:11:24 +0000 |
2062 | @@ -86,7 +86,9 @@ |
2063 | return memcached_is_fetching_version(&memc); |
2064 | } |
2065 | |
2066 | - abort(); |
2067 | + assert_msg(false, "Programmer error, unknown flag provided"); |
2068 | + |
2069 | + return false; |
2070 | } |
2071 | |
2072 | void memcached_flag(memcached_st& memc, const memcached_flag_t flag, const bool arg) |
2073 | |
2074 | === modified file 'libmemcached/hosts.cc' |
2075 | --- libmemcached/hosts.cc 2013-04-21 08:19:20 +0000 |
2076 | +++ libmemcached/hosts.cc 2013-06-14 07:11:24 +0000 |
2077 | @@ -221,6 +221,7 @@ |
2078 | float pct= (float)list[host_index].weight / (float)total_weight; |
2079 | pointer_per_server= (uint32_t) ((::floor((float) (pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001))) * 4); |
2080 | pointer_per_hash= 4; |
2081 | +#if defined(DEBUG) && DEBUG |
2082 | if (DEBUG) |
2083 | { |
2084 | printf("ketama_weighted:%s|%d|%llu|%u\n", |
2085 | @@ -229,6 +230,7 @@ |
2086 | (unsigned long long)list[host_index].weight, |
2087 | pointer_per_server); |
2088 | } |
2089 | +#endif |
2090 | } |
2091 | |
2092 | |
2093 | @@ -255,10 +257,12 @@ |
2094 | memcached_literal_param("snprintf(sizeof(sort_host))")); |
2095 | } |
2096 | |
2097 | +#if defined(DEBUG) && DEBUG |
2098 | if (DEBUG) |
2099 | { |
2100 | fprintf(stdout, "update_continuum: key is %s\n", sort_host); |
2101 | } |
2102 | +#endif |
2103 | |
2104 | if (memcached_is_weighted_ketama(ptr)) |
2105 | { |
2106 | @@ -335,6 +339,7 @@ |
2107 | ptr->ketama.continuum_points_counter= pointer_counter; |
2108 | qsort(ptr->ketama.continuum, ptr->ketama.continuum_points_counter, sizeof(memcached_continuum_item_st), continuum_item_cmp); |
2109 | |
2110 | +#if defined(DEBUG) && DEBUG |
2111 | if (DEBUG) |
2112 | { |
2113 | for (uint32_t pointer_index= 0; memcached_server_count(ptr) && pointer_index < ((live_servers * MEMCACHED_POINTS_PER_SERVER) - 1); pointer_index++) |
2114 | @@ -342,6 +347,7 @@ |
2115 | WATCHPOINT_ASSERT(ptr->ketama.continuum[pointer_index].value <= ptr->ketama.continuum[pointer_index + 1].value); |
2116 | } |
2117 | } |
2118 | +#endif |
2119 | |
2120 | return MEMCACHED_SUCCESS; |
2121 | } |
2122 | |
2123 | === modified file 'libmemcached/include.am' |
2124 | --- libmemcached/include.am 2013-05-05 07:37:08 +0000 |
2125 | +++ libmemcached/include.am 2013-06-14 07:11:24 +0000 |
2126 | @@ -20,6 +20,7 @@ |
2127 | noinst_HEADERS+= libmemcached/do.hpp |
2128 | noinst_HEADERS+= libmemcached/encoding_key.h |
2129 | noinst_HEADERS+= libmemcached/error.hpp |
2130 | +noinst_HEADERS+= libmemcached/feature.h |
2131 | noinst_HEADERS+= libmemcached/flag.hpp |
2132 | noinst_HEADERS+= libmemcached/initialize_query.h |
2133 | noinst_HEADERS+= libmemcached/instance.hpp |
2134 | @@ -79,6 +80,7 @@ |
2135 | libmemcached_libmemcached_la_SOURCES+= libmemcached/dump.cc |
2136 | libmemcached_libmemcached_la_SOURCES+= libmemcached/error.cc |
2137 | libmemcached_libmemcached_la_SOURCES+= libmemcached/exist.cc |
2138 | +libmemcached_libmemcached_la_SOURCES+= libmemcached/feature.cc |
2139 | libmemcached_libmemcached_la_SOURCES+= libmemcached/fetch.cc |
2140 | libmemcached_libmemcached_la_SOURCES+= libmemcached/flag.cc |
2141 | libmemcached_libmemcached_la_SOURCES+= libmemcached/flush.cc |
2142 | |
2143 | === modified file 'libmemcached/memcached.cc' |
2144 | --- libmemcached/memcached.cc 2013-04-03 13:14:23 +0000 |
2145 | +++ libmemcached/memcached.cc 2013-06-14 07:11:24 +0000 |
2146 | @@ -151,7 +151,7 @@ |
2147 | |
2148 | memcached_error_free(*ptr); |
2149 | |
2150 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT and ptr->sasl.callbacks) |
2151 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) and ptr->sasl.callbacks) |
2152 | { |
2153 | memcached_destroy_sasl_auth_data(ptr); |
2154 | } |
2155 | @@ -381,7 +381,7 @@ |
2156 | new_clone->configure.filename= memcached_array_clone(new_clone, source->_namespace); |
2157 | new_clone->configure.version= source->configure.version; |
2158 | |
2159 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT and source->sasl.callbacks) |
2160 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) and source->sasl.callbacks) |
2161 | { |
2162 | if (memcached_failed(memcached_clone_sasl(new_clone, source))) |
2163 | { |
2164 | |
2165 | === modified file 'libmemcached/response.cc' |
2166 | --- libmemcached/response.cc 2013-04-03 13:14:23 +0000 |
2167 | +++ libmemcached/response.cc 2013-06-14 07:11:24 +0000 |
2168 | @@ -827,7 +827,6 @@ |
2169 | case PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND: |
2170 | default: |
2171 | return memcached_set_error(*instance, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT); |
2172 | - break; |
2173 | } |
2174 | } |
2175 | |
2176 | |
2177 | === modified file 'libmemcached/sasl.cc' |
2178 | --- libmemcached/sasl.cc 2013-03-31 23:24:29 +0000 |
2179 | +++ libmemcached/sasl.cc 2013-06-14 07:11:24 +0000 |
2180 | @@ -135,10 +135,12 @@ |
2181 | |
2182 | memcached_return_t memcached_sasl_authenticate_connection(memcached_instance_st* server) |
2183 | { |
2184 | +#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT == 0 |
2185 | if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
2186 | { |
2187 | return MEMCACHED_NOT_SUPPORTED; |
2188 | } |
2189 | +#endif |
2190 | |
2191 | if (server == NULL) |
2192 | { |
2193 | @@ -324,197 +326,197 @@ |
2194 | const char *username, |
2195 | const char *password) |
2196 | { |
2197 | - Memcached* ptr= memcached2Memcached(shell); |
2198 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
2199 | - { |
2200 | - return MEMCACHED_NOT_SUPPORTED; |
2201 | - } |
2202 | - |
2203 | - if (ptr == NULL or username == NULL or password == NULL) |
2204 | - { |
2205 | - return MEMCACHED_INVALID_ARGUMENTS; |
2206 | - } |
2207 | - |
2208 | - memcached_return_t ret; |
2209 | - if (memcached_failed(ret= memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1))) |
2210 | - { |
2211 | - return memcached_set_error(*ptr, ret, MEMCACHED_AT, memcached_literal_param("Unable change to binary protocol which is required for SASL.")); |
2212 | - } |
2213 | - |
2214 | - memcached_destroy_sasl_auth_data(ptr); |
2215 | - |
2216 | - sasl_callback_t *callbacks= libmemcached_xcalloc(ptr, 4, sasl_callback_t); |
2217 | - size_t password_length= strlen(password); |
2218 | - size_t username_length= strlen(username); |
2219 | - char *name= (char *)libmemcached_malloc(ptr, username_length +1); |
2220 | - sasl_secret_t *secret= (sasl_secret_t*)libmemcached_malloc(ptr, password_length +1 + sizeof(sasl_secret_t)); |
2221 | - |
2222 | - if (callbacks == NULL or name == NULL or secret == NULL) |
2223 | - { |
2224 | - libmemcached_free(ptr, callbacks); |
2225 | - libmemcached_free(ptr, name); |
2226 | - libmemcached_free(ptr, secret); |
2227 | - return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT); |
2228 | - } |
2229 | - |
2230 | - secret->len= password_length; |
2231 | - memcpy(secret->data, password, password_length); |
2232 | - secret->data[password_length]= 0; |
2233 | - |
2234 | - callbacks[0].id= SASL_CB_USER; |
2235 | - callbacks[0].proc= (int (*)())get_username; |
2236 | - callbacks[0].context= strncpy(name, username, username_length +1); |
2237 | - callbacks[1].id= SASL_CB_AUTHNAME; |
2238 | - callbacks[1].proc= (int (*)())get_username; |
2239 | - callbacks[1].context= name; |
2240 | - callbacks[2].id= SASL_CB_PASS; |
2241 | - callbacks[2].proc= (int (*)())get_password; |
2242 | - callbacks[2].context= secret; |
2243 | - callbacks[3].id= SASL_CB_LIST_END; |
2244 | - |
2245 | - ptr->sasl.callbacks= callbacks; |
2246 | - ptr->sasl.is_allocated= true; |
2247 | - |
2248 | - return MEMCACHED_SUCCESS; |
2249 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL)) |
2250 | + { |
2251 | + Memcached* ptr= memcached2Memcached(shell); |
2252 | + |
2253 | + if (ptr == NULL or username == NULL or password == NULL) |
2254 | + { |
2255 | + return MEMCACHED_INVALID_ARGUMENTS; |
2256 | + } |
2257 | + |
2258 | + memcached_return_t ret; |
2259 | + if (memcached_failed(ret= memcached_behavior_set(ptr, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1))) |
2260 | + { |
2261 | + return memcached_set_error(*ptr, ret, MEMCACHED_AT, memcached_literal_param("Unable change to binary protocol which is required for SASL.")); |
2262 | + } |
2263 | + |
2264 | + memcached_destroy_sasl_auth_data(ptr); |
2265 | + |
2266 | + sasl_callback_t *callbacks= libmemcached_xcalloc(ptr, 4, sasl_callback_t); |
2267 | + size_t password_length= strlen(password); |
2268 | + size_t username_length= strlen(username); |
2269 | + char *name= (char *)libmemcached_malloc(ptr, username_length +1); |
2270 | + sasl_secret_t *secret= (sasl_secret_t*)libmemcached_malloc(ptr, password_length +1 + sizeof(sasl_secret_t)); |
2271 | + |
2272 | + if (callbacks == NULL or name == NULL or secret == NULL) |
2273 | + { |
2274 | + libmemcached_free(ptr, callbacks); |
2275 | + libmemcached_free(ptr, name); |
2276 | + libmemcached_free(ptr, secret); |
2277 | + return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT); |
2278 | + } |
2279 | + |
2280 | + secret->len= password_length; |
2281 | + memcpy(secret->data, password, password_length); |
2282 | + secret->data[password_length]= 0; |
2283 | + |
2284 | + callbacks[0].id= SASL_CB_USER; |
2285 | + callbacks[0].proc= (int (*)())get_username; |
2286 | + callbacks[0].context= strncpy(name, username, username_length +1); |
2287 | + callbacks[1].id= SASL_CB_AUTHNAME; |
2288 | + callbacks[1].proc= (int (*)())get_username; |
2289 | + callbacks[1].context= name; |
2290 | + callbacks[2].id= SASL_CB_PASS; |
2291 | + callbacks[2].proc= (int (*)())get_password; |
2292 | + callbacks[2].context= secret; |
2293 | + callbacks[3].id= SASL_CB_LIST_END; |
2294 | + |
2295 | + ptr->sasl.callbacks= callbacks; |
2296 | + ptr->sasl.is_allocated= true; |
2297 | + |
2298 | + return MEMCACHED_SUCCESS; |
2299 | + } |
2300 | + return MEMCACHED_NOT_SUPPORTED; |
2301 | } |
2302 | |
2303 | memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *shell) |
2304 | { |
2305 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
2306 | - { |
2307 | - return MEMCACHED_NOT_SUPPORTED; |
2308 | - } |
2309 | - |
2310 | - Memcached* ptr= memcached2Memcached(shell); |
2311 | - if (ptr == NULL) |
2312 | - { |
2313 | - return MEMCACHED_INVALID_ARGUMENTS; |
2314 | - } |
2315 | - |
2316 | - if (ptr->sasl.callbacks == NULL) |
2317 | - { |
2318 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL)) |
2319 | + { |
2320 | + Memcached* ptr= memcached2Memcached(shell); |
2321 | + if (ptr == NULL) |
2322 | + { |
2323 | + return MEMCACHED_INVALID_ARGUMENTS; |
2324 | + } |
2325 | + |
2326 | + if (ptr->sasl.callbacks == NULL) |
2327 | + { |
2328 | + return MEMCACHED_SUCCESS; |
2329 | + } |
2330 | + |
2331 | + if (ptr->sasl.is_allocated) |
2332 | + { |
2333 | + libmemcached_free(ptr, ptr->sasl.callbacks[0].context); |
2334 | + libmemcached_free(ptr, ptr->sasl.callbacks[2].context); |
2335 | + libmemcached_free(ptr, (void*)ptr->sasl.callbacks); |
2336 | + ptr->sasl.is_allocated= false; |
2337 | + } |
2338 | + |
2339 | + ptr->sasl.callbacks= NULL; |
2340 | + |
2341 | return MEMCACHED_SUCCESS; |
2342 | } |
2343 | |
2344 | - if (ptr->sasl.is_allocated) |
2345 | - { |
2346 | - libmemcached_free(ptr, ptr->sasl.callbacks[0].context); |
2347 | - libmemcached_free(ptr, ptr->sasl.callbacks[2].context); |
2348 | - libmemcached_free(ptr, (void*)ptr->sasl.callbacks); |
2349 | - ptr->sasl.is_allocated= false; |
2350 | - } |
2351 | - |
2352 | - ptr->sasl.callbacks= NULL; |
2353 | - |
2354 | - return MEMCACHED_SUCCESS; |
2355 | + return MEMCACHED_NOT_SUPPORTED; |
2356 | } |
2357 | |
2358 | memcached_return_t memcached_clone_sasl(memcached_st *clone, const memcached_st *source) |
2359 | { |
2360 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
2361 | - { |
2362 | - return MEMCACHED_NOT_SUPPORTED; |
2363 | - } |
2364 | - |
2365 | - if (clone == NULL or source == NULL) |
2366 | - { |
2367 | - return MEMCACHED_INVALID_ARGUMENTS; |
2368 | - } |
2369 | - |
2370 | - if (source->sasl.callbacks == NULL) |
2371 | - { |
2372 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL)) |
2373 | + { |
2374 | + if (clone == NULL or source == NULL) |
2375 | + { |
2376 | + return MEMCACHED_INVALID_ARGUMENTS; |
2377 | + } |
2378 | + |
2379 | + if (source->sasl.callbacks == NULL) |
2380 | + { |
2381 | + return MEMCACHED_SUCCESS; |
2382 | + } |
2383 | + |
2384 | + /* Hopefully we are using our own callback mechanisms.. */ |
2385 | + if (source->sasl.callbacks[0].id == SASL_CB_USER && |
2386 | + source->sasl.callbacks[0].proc == (int (*)())get_username && |
2387 | + source->sasl.callbacks[1].id == SASL_CB_AUTHNAME && |
2388 | + source->sasl.callbacks[1].proc == (int (*)())get_username && |
2389 | + source->sasl.callbacks[2].id == SASL_CB_PASS && |
2390 | + source->sasl.callbacks[2].proc == (int (*)())get_password && |
2391 | + source->sasl.callbacks[3].id == SASL_CB_LIST_END) |
2392 | + { |
2393 | + sasl_secret_t *secret= (sasl_secret_t *)source->sasl.callbacks[2].context; |
2394 | + return memcached_set_sasl_auth_data(clone, |
2395 | + (const char*)source->sasl.callbacks[0].context, |
2396 | + (const char*)secret->data); |
2397 | + } |
2398 | + |
2399 | + /* |
2400 | + * But we're not. It may work if we know what the user tries to pass |
2401 | + * into the list, but if we don't know the ID we don't know how to handle |
2402 | + * the context... |
2403 | + */ |
2404 | + ptrdiff_t total= 0; |
2405 | + |
2406 | + while (source->sasl.callbacks[total].id != SASL_CB_LIST_END) |
2407 | + { |
2408 | + switch (source->sasl.callbacks[total].id) |
2409 | + { |
2410 | + case SASL_CB_USER: |
2411 | + case SASL_CB_AUTHNAME: |
2412 | + case SASL_CB_PASS: |
2413 | + break; |
2414 | + default: |
2415 | + /* I don't know how to deal with this... */ |
2416 | + return MEMCACHED_NOT_SUPPORTED; |
2417 | + } |
2418 | + |
2419 | + ++total; |
2420 | + } |
2421 | + |
2422 | + sasl_callback_t *callbacks= libmemcached_xcalloc(clone, total +1, sasl_callback_t); |
2423 | + if (callbacks == NULL) |
2424 | + { |
2425 | + return MEMCACHED_MEMORY_ALLOCATION_FAILURE; |
2426 | + } |
2427 | + memcpy(callbacks, source->sasl.callbacks, (total + 1) * sizeof(sasl_callback_t)); |
2428 | + |
2429 | + /* Now update the context... */ |
2430 | + for (ptrdiff_t x= 0; x < total; ++x) |
2431 | + { |
2432 | + if (callbacks[x].id == SASL_CB_USER || callbacks[x].id == SASL_CB_AUTHNAME) |
2433 | + { |
2434 | + callbacks[x].context= (sasl_callback_t*)libmemcached_malloc(clone, strlen((const char*)source->sasl.callbacks[x].context)); |
2435 | + |
2436 | + if (callbacks[x].context == NULL) |
2437 | + { |
2438 | + /* Failed to allocate memory, clean up previously allocated memory */ |
2439 | + for (ptrdiff_t y= 0; y < x; ++y) |
2440 | + { |
2441 | + libmemcached_free(clone, clone->sasl.callbacks[y].context); |
2442 | + } |
2443 | + |
2444 | + libmemcached_free(clone, callbacks); |
2445 | + return MEMCACHED_MEMORY_ALLOCATION_FAILURE; |
2446 | + } |
2447 | + strncpy((char*)callbacks[x].context, (const char*)source->sasl.callbacks[x].context, sizeof(callbacks[x].context)); |
2448 | + } |
2449 | + else |
2450 | + { |
2451 | + sasl_secret_t *src= (sasl_secret_t *)source->sasl.callbacks[x].context; |
2452 | + sasl_secret_t *n= (sasl_secret_t*)libmemcached_malloc(clone, src->len + 1 + sizeof(*n)); |
2453 | + if (n == NULL) |
2454 | + { |
2455 | + /* Failed to allocate memory, clean up previously allocated memory */ |
2456 | + for (ptrdiff_t y= 0; y < x; ++y) |
2457 | + { |
2458 | + libmemcached_free(clone, clone->sasl.callbacks[y].context); |
2459 | + } |
2460 | + |
2461 | + libmemcached_free(clone, callbacks); |
2462 | + return MEMCACHED_MEMORY_ALLOCATION_FAILURE; |
2463 | + } |
2464 | + memcpy(n, src, src->len + 1 + sizeof(*n)); |
2465 | + callbacks[x].context= n; |
2466 | + } |
2467 | + } |
2468 | + |
2469 | + clone->sasl.callbacks= callbacks; |
2470 | + clone->sasl.is_allocated= true; |
2471 | + |
2472 | return MEMCACHED_SUCCESS; |
2473 | } |
2474 | |
2475 | - /* Hopefully we are using our own callback mechanisms.. */ |
2476 | - if (source->sasl.callbacks[0].id == SASL_CB_USER && |
2477 | - source->sasl.callbacks[0].proc == (int (*)())get_username && |
2478 | - source->sasl.callbacks[1].id == SASL_CB_AUTHNAME && |
2479 | - source->sasl.callbacks[1].proc == (int (*)())get_username && |
2480 | - source->sasl.callbacks[2].id == SASL_CB_PASS && |
2481 | - source->sasl.callbacks[2].proc == (int (*)())get_password && |
2482 | - source->sasl.callbacks[3].id == SASL_CB_LIST_END) |
2483 | - { |
2484 | - sasl_secret_t *secret= (sasl_secret_t *)source->sasl.callbacks[2].context; |
2485 | - return memcached_set_sasl_auth_data(clone, |
2486 | - (const char*)source->sasl.callbacks[0].context, |
2487 | - (const char*)secret->data); |
2488 | - } |
2489 | - |
2490 | - /* |
2491 | - * But we're not. It may work if we know what the user tries to pass |
2492 | - * into the list, but if we don't know the ID we don't know how to handle |
2493 | - * the context... |
2494 | - */ |
2495 | - ptrdiff_t total= 0; |
2496 | - |
2497 | - while (source->sasl.callbacks[total].id != SASL_CB_LIST_END) |
2498 | - { |
2499 | - switch (source->sasl.callbacks[total].id) |
2500 | - { |
2501 | - case SASL_CB_USER: |
2502 | - case SASL_CB_AUTHNAME: |
2503 | - case SASL_CB_PASS: |
2504 | - break; |
2505 | - default: |
2506 | - /* I don't know how to deal with this... */ |
2507 | - return MEMCACHED_NOT_SUPPORTED; |
2508 | - } |
2509 | - |
2510 | - ++total; |
2511 | - } |
2512 | - |
2513 | - sasl_callback_t *callbacks= libmemcached_xcalloc(clone, total +1, sasl_callback_t); |
2514 | - if (callbacks == NULL) |
2515 | - { |
2516 | - return MEMCACHED_MEMORY_ALLOCATION_FAILURE; |
2517 | - } |
2518 | - memcpy(callbacks, source->sasl.callbacks, (total + 1) * sizeof(sasl_callback_t)); |
2519 | - |
2520 | - /* Now update the context... */ |
2521 | - for (ptrdiff_t x= 0; x < total; ++x) |
2522 | - { |
2523 | - if (callbacks[x].id == SASL_CB_USER || callbacks[x].id == SASL_CB_AUTHNAME) |
2524 | - { |
2525 | - callbacks[x].context= (sasl_callback_t*)libmemcached_malloc(clone, strlen((const char*)source->sasl.callbacks[x].context)); |
2526 | - |
2527 | - if (callbacks[x].context == NULL) |
2528 | - { |
2529 | - /* Failed to allocate memory, clean up previously allocated memory */ |
2530 | - for (ptrdiff_t y= 0; y < x; ++y) |
2531 | - { |
2532 | - libmemcached_free(clone, clone->sasl.callbacks[y].context); |
2533 | - } |
2534 | - |
2535 | - libmemcached_free(clone, callbacks); |
2536 | - return MEMCACHED_MEMORY_ALLOCATION_FAILURE; |
2537 | - } |
2538 | - strncpy((char*)callbacks[x].context, (const char*)source->sasl.callbacks[x].context, sizeof(callbacks[x].context)); |
2539 | - } |
2540 | - else |
2541 | - { |
2542 | - sasl_secret_t *src= (sasl_secret_t *)source->sasl.callbacks[x].context; |
2543 | - sasl_secret_t *n= (sasl_secret_t*)libmemcached_malloc(clone, src->len + 1 + sizeof(*n)); |
2544 | - if (n == NULL) |
2545 | - { |
2546 | - /* Failed to allocate memory, clean up previously allocated memory */ |
2547 | - for (ptrdiff_t y= 0; y < x; ++y) |
2548 | - { |
2549 | - libmemcached_free(clone, clone->sasl.callbacks[y].context); |
2550 | - } |
2551 | - |
2552 | - libmemcached_free(clone, callbacks); |
2553 | - return MEMCACHED_MEMORY_ALLOCATION_FAILURE; |
2554 | - } |
2555 | - memcpy(n, src, src->len + 1 + sizeof(*n)); |
2556 | - callbacks[x].context= n; |
2557 | - } |
2558 | - } |
2559 | - |
2560 | - clone->sasl.callbacks= callbacks; |
2561 | - clone->sasl.is_allocated= true; |
2562 | - |
2563 | - return MEMCACHED_SUCCESS; |
2564 | + return MEMCACHED_NOT_SUPPORTED; |
2565 | } |
2566 | |
2567 | #else |
2568 | @@ -538,4 +540,14 @@ |
2569 | return MEMCACHED_NOT_SUPPORTED; |
2570 | } |
2571 | |
2572 | +memcached_return_t memcached_destroy_sasl_auth_data(memcached_st*) |
2573 | +{ |
2574 | + return MEMCACHED_NOT_SUPPORTED; |
2575 | +} |
2576 | + |
2577 | +memcached_return_t memcached_sasl_authenticate_connection(memcached_instance_st*) |
2578 | +{ |
2579 | + return MEMCACHED_NOT_SUPPORTED; |
2580 | +} |
2581 | + |
2582 | #endif |
2583 | |
2584 | === modified file 'libmemcachedutil/pid.cc' |
2585 | --- libmemcachedutil/pid.cc 2013-03-31 23:24:29 +0000 |
2586 | +++ libmemcachedutil/pid.cc 2013-06-14 07:11:24 +0000 |
2587 | @@ -105,7 +105,7 @@ |
2588 | if (not ret) |
2589 | ret= &unused; |
2590 | |
2591 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
2592 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
2593 | { |
2594 | *ret= MEMCACHED_NOT_SUPPORTED; |
2595 | return pid; |
2596 | |
2597 | === modified file 'libmemcachedutil/ping.cc' |
2598 | --- libmemcachedutil/ping.cc 2013-03-31 23:24:29 +0000 |
2599 | +++ libmemcachedutil/ping.cc 2013-06-14 07:11:24 +0000 |
2600 | @@ -92,7 +92,7 @@ |
2601 | if (not ret) |
2602 | ret= &unused; |
2603 | |
2604 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT == 0) |
2605 | + if (libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL) == false) |
2606 | { |
2607 | *ret= MEMCACHED_NOT_SUPPORTED; |
2608 | return false; |
2609 | |
2610 | === modified file 'libtest/abort.cc' |
2611 | --- libtest/abort.cc 2012-04-28 05:12:41 +0000 |
2612 | +++ libtest/abort.cc 2013-06-14 07:11:24 +0000 |
2613 | @@ -36,6 +36,8 @@ |
2614 | |
2615 | #include <cstdlib> |
2616 | |
2617 | +#pragma GCC diagnostic push |
2618 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
2619 | int main(void) |
2620 | { |
2621 | if (1) |
2622 | @@ -45,3 +47,4 @@ |
2623 | |
2624 | return 0; |
2625 | } |
2626 | +#pragma GCC diagnostic pop |
2627 | |
2628 | === modified file 'libtest/alarm.cc' |
2629 | --- libtest/alarm.cc 2013-02-11 12:22:44 +0000 |
2630 | +++ libtest/alarm.cc 2013-06-14 07:11:24 +0000 |
2631 | @@ -52,49 +52,57 @@ |
2632 | |
2633 | void set_alarm() |
2634 | { |
2635 | - if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1) |
2636 | + if (gdb_is_caller() == false) |
2637 | { |
2638 | - Error << "setitimer() failed"; |
2639 | + if (setitimer(ITIMER_VIRTUAL, &defualt_timer, NULL) == -1) |
2640 | + { |
2641 | + Error << "setitimer() failed"; |
2642 | + } |
2643 | } |
2644 | } |
2645 | |
2646 | void set_alarm(long tv_sec, long tv_usec) |
2647 | { |
2648 | // For the moment use any value to YATL_ALARM to cancel alarming. |
2649 | - if (getenv("YATL_ALARM")) |
2650 | + if (gdb_is_caller() == false) |
2651 | { |
2652 | - errno= 0; |
2653 | - tv_sec= strtol(getenv("YATL_ALARM"), (char **) NULL, 10); |
2654 | - |
2655 | - if (errno != 0) |
2656 | - { |
2657 | - FATAL("Bad value for YATL_ALARM"); |
2658 | - } |
2659 | - else if (tv_sec == 0) |
2660 | - { |
2661 | - cancel_alarm(); |
2662 | - } |
2663 | - } |
2664 | + if (getenv("YATL_ALARM")) |
2665 | + { |
2666 | + errno= 0; |
2667 | + tv_sec= strtol(getenv("YATL_ALARM"), (char **) NULL, 10); |
2668 | + if (errno != 0) |
2669 | + { |
2670 | + FATAL("Bad value for YATL_ALARM"); |
2671 | + } |
2672 | + else if (tv_sec == 0) |
2673 | + { |
2674 | + cancel_alarm(); |
2675 | + } |
2676 | + } |
2677 | |
2678 | #ifdef __APPLE__ |
2679 | - struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) }; |
2680 | + struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) }; |
2681 | #else |
2682 | - struct timeval it_value= { tv_sec, tv_usec }; |
2683 | + struct timeval it_value= { tv_sec, tv_usec }; |
2684 | #endif |
2685 | |
2686 | - struct itimerval timer= { default_it_interval, it_value }; |
2687 | + struct itimerval timer= { default_it_interval, it_value }; |
2688 | |
2689 | - if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1) |
2690 | - { |
2691 | - Error << "setitimer() failed"; |
2692 | + if (setitimer(ITIMER_VIRTUAL, &timer, NULL) == -1) |
2693 | + { |
2694 | + Error << "setitimer() failed"; |
2695 | + } |
2696 | } |
2697 | } |
2698 | |
2699 | void cancel_alarm() |
2700 | { |
2701 | - if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1) |
2702 | + if (gdb_is_caller() == false) |
2703 | { |
2704 | - Error << "setitimer() failed"; |
2705 | + if (setitimer(ITIMER_VIRTUAL, &cancel_timer, NULL) == -1) |
2706 | + { |
2707 | + Error << "setitimer() failed"; |
2708 | + } |
2709 | } |
2710 | } |
2711 | |
2712 | |
2713 | === modified file 'libtest/client.cc' |
2714 | --- libtest/client.cc 2013-01-24 11:17:17 +0000 |
2715 | +++ libtest/client.cc 2013-06-14 07:11:24 +0000 |
2716 | @@ -50,16 +50,71 @@ |
2717 | # define MSG_NOSIGNAL 0 |
2718 | #endif |
2719 | |
2720 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
2721 | +# include <cyassl/ssl.h> |
2722 | +#endif |
2723 | + |
2724 | +#define CA_CERT_PEM "/home/brian/cyassl/certs/ca-cert.pem" |
2725 | +#define CERT_PEM "/home/brian/cyassl/certs/server-cert.pem" |
2726 | +#define CERT_KEY_PEM "/home/brian/cyassl/certs/server-key.pem" |
2727 | + |
2728 | namespace libtest { |
2729 | |
2730 | SimpleClient::SimpleClient(const std::string& hostname_, in_port_t port_) : |
2731 | _is_connected(false), |
2732 | + _is_ssl(false), |
2733 | _hostname(hostname_), |
2734 | _port(port_), |
2735 | sock_fd(INVALID_SOCKET), |
2736 | - requested_message(1) |
2737 | + _error_file(NULL), |
2738 | + _error_line(0), |
2739 | + requested_message(1), |
2740 | + _ctx_ssl(NULL), |
2741 | + _ssl(NULL) |
2742 | +{ |
2743 | + init_ssl(); |
2744 | +} |
2745 | + |
2746 | +void SimpleClient::init_ssl() |
2747 | +{ |
2748 | + if (_is_ssl) |
2749 | { |
2750 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
2751 | + CyaSSL_Init(); |
2752 | + |
2753 | + if ((_ctx_ssl= CyaSSL_CTX_new(CyaTLSv1_client_method())) == NULL) |
2754 | + { |
2755 | + FATAL("CyaSSL_CTX_new error" == NULL); |
2756 | + } |
2757 | + |
2758 | + if (CyaSSL_CTX_load_verify_locations(_ctx_ssl, CA_CERT_PEM, 0) != SSL_SUCCESS) |
2759 | + { |
2760 | + FATAL("CyaSSL_CTX_load_verify_locations(%s) cannot obtain certificate", CA_CERT_PEM); |
2761 | + } |
2762 | + |
2763 | + if (CyaSSL_CTX_use_certificate_file(_ctx_ssl, CERT_PEM, SSL_FILETYPE_PEM) != SSL_SUCCESS) |
2764 | + { |
2765 | + FATAL("CyaSSL_CTX_use_certificate_file(%s) cannot obtain certificate", CERT_PEM); |
2766 | + } |
2767 | + |
2768 | + if (CyaSSL_CTX_use_PrivateKey_file(_ctx_ssl, CERT_KEY_PEM, SSL_FILETYPE_PEM) != SSL_SUCCESS) |
2769 | + { |
2770 | + FATAL("CyaSSL_CTX_use_PrivateKey_file(%s) cannot obtain certificate", CERT_KEY_PEM); |
2771 | + } |
2772 | +#endif // defined(HAVE_CYASSL) && HAVE_CYASSL |
2773 | } |
2774 | +} |
2775 | + |
2776 | +void SimpleClient::error(const char* file_, int line_, const std::string& error_) |
2777 | +{ |
2778 | + _error.clear(); |
2779 | + _error_file= file_; |
2780 | + _error_line= line_; |
2781 | + vchar_t buffer; |
2782 | + buffer.resize(1024); |
2783 | + snprintf(&buffer[0], buffer.size() -1, "%s:%d: %s", file_, line_, error_.c_str()); |
2784 | + _error.append(&buffer[0]); |
2785 | +} |
2786 | |
2787 | bool SimpleClient::ready(int event_) |
2788 | { |
2789 | @@ -78,7 +133,7 @@ |
2790 | |
2791 | if (ready_fds == -1) |
2792 | { |
2793 | - _error= strerror(errno); |
2794 | + error(__FILE__, __LINE__, strerror(errno)); |
2795 | return false; |
2796 | } |
2797 | else if (ready_fds == 1) |
2798 | @@ -94,12 +149,12 @@ |
2799 | // We check the value to see what happened wth the socket. |
2800 | if (err == 0) |
2801 | { |
2802 | - _error= "getsockopt() returned no error but poll() indicated one existed"; |
2803 | + error(__FILE__, __LINE__, "getsockopt() returned no error but poll() indicated one existed"); |
2804 | return false; |
2805 | } |
2806 | errno= err; |
2807 | } |
2808 | - _error= strerror(errno); |
2809 | + error(__FILE__, __LINE__, strerror(errno)); |
2810 | |
2811 | return false; |
2812 | } |
2813 | @@ -112,14 +167,13 @@ |
2814 | } |
2815 | |
2816 | fatal_assert(ready_fds == 0); |
2817 | - _error= "TIMEOUT"; |
2818 | + error(__FILE__, __LINE__, "TIMEOUT"); |
2819 | |
2820 | return false; |
2821 | } |
2822 | |
2823 | struct addrinfo* SimpleClient::lookup() |
2824 | { |
2825 | - struct addrinfo *ai= NULL; |
2826 | struct addrinfo hints; |
2827 | memset(&hints, 0, sizeof(struct addrinfo)); |
2828 | hints.ai_socktype= SOCK_STREAM; |
2829 | @@ -130,32 +184,42 @@ |
2830 | (void)snprintf(&service[0], service.size(), "%d", _port); |
2831 | |
2832 | int getaddrinfo_error; |
2833 | - if ((getaddrinfo_error= getaddrinfo(_hostname.c_str(), &service[0], &hints, &ai)) != 0) |
2834 | + if ((getaddrinfo_error= getaddrinfo(_hostname.c_str(), &service[0], &hints, &_ai)) != 0) |
2835 | { |
2836 | if (getaddrinfo_error != EAI_SYSTEM) |
2837 | { |
2838 | - _error= gai_strerror(getaddrinfo_error); |
2839 | + error(__FILE__, __LINE__, gai_strerror(getaddrinfo_error)); |
2840 | return NULL; |
2841 | } |
2842 | else |
2843 | { |
2844 | - _error= strerror(getaddrinfo_error); |
2845 | + error(__FILE__, __LINE__, strerror(getaddrinfo_error)); |
2846 | return NULL; |
2847 | } |
2848 | } |
2849 | |
2850 | - return ai; |
2851 | + return _ai; |
2852 | } |
2853 | |
2854 | SimpleClient::~SimpleClient() |
2855 | { |
2856 | + free_addrinfo(); |
2857 | close_socket(); |
2858 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
2859 | + CyaSSL_CTX_free(_ctx_ssl); |
2860 | + _ctx_ssl= NULL; |
2861 | +#endif |
2862 | } |
2863 | |
2864 | void SimpleClient::close_socket() |
2865 | { |
2866 | if (sock_fd != INVALID_SOCKET) |
2867 | { |
2868 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
2869 | + CyaSSL_shutdown(_ssl); |
2870 | + CyaSSL_free(_ssl); |
2871 | + _ssl= NULL; |
2872 | +#endif |
2873 | close(sock_fd); |
2874 | sock_fd= INVALID_SOCKET; |
2875 | } |
2876 | @@ -164,11 +228,10 @@ |
2877 | bool SimpleClient::instance_connect() |
2878 | { |
2879 | _is_connected= false; |
2880 | - struct addrinfo *ai; |
2881 | - if ((ai= lookup())) |
2882 | + if (lookup()) |
2883 | { |
2884 | { |
2885 | - struct addrinfo* address_info_next= ai; |
2886 | + struct addrinfo* address_info_next= _ai; |
2887 | |
2888 | while (address_info_next and sock_fd == INVALID_SOCKET) |
2889 | { |
2890 | @@ -193,7 +256,11 @@ |
2891 | } |
2892 | |
2893 | close_socket(); |
2894 | - _error= strerror(errno); |
2895 | + error(__FILE__, __LINE__, strerror(errno)); |
2896 | + } |
2897 | + else |
2898 | + { |
2899 | + return true; |
2900 | } |
2901 | } |
2902 | else |
2903 | @@ -203,12 +270,12 @@ |
2904 | address_info_next= address_info_next->ai_next; |
2905 | } |
2906 | |
2907 | - freeaddrinfo(ai); |
2908 | + free_addrinfo(); |
2909 | } |
2910 | |
2911 | if (sock_fd == INVALID_SOCKET) |
2912 | { |
2913 | - fatal_assert(_error.size()); |
2914 | + fatal_assert(is_error()); |
2915 | } |
2916 | |
2917 | return bool(sock_fd != INVALID_SOCKET); |
2918 | @@ -222,7 +289,31 @@ |
2919 | _error.clear(); |
2920 | if (sock_fd == INVALID_SOCKET) |
2921 | { |
2922 | - return instance_connect(); |
2923 | + if (instance_connect()) |
2924 | + { |
2925 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
2926 | + if (_ctx_ssl) |
2927 | + { |
2928 | + _ssl= CyaSSL_new(_ctx_ssl); |
2929 | + if (_ssl == NULL) |
2930 | + { |
2931 | + error(__FILE__, __LINE__, "CyaSSL_new failed"); |
2932 | + return false; |
2933 | + } |
2934 | + |
2935 | + int ssl_error; |
2936 | + if ((ssl_error= CyaSSL_set_fd(_ssl, sock_fd)) != SSL_SUCCESS) |
2937 | + { |
2938 | + error(__FILE__, __LINE__, "CyaSSL_set_fd() should not be returning an error."); |
2939 | + return false; |
2940 | + } |
2941 | + } |
2942 | +#endif |
2943 | + |
2944 | + return true; |
2945 | + } |
2946 | + |
2947 | + return false; |
2948 | } |
2949 | |
2950 | return true; |
2951 | @@ -237,12 +328,40 @@ |
2952 | off_t offset= 0; |
2953 | do |
2954 | { |
2955 | - ssize_t nw= send(sock_fd, ptr + offset, len - offset, MSG_NOSIGNAL); |
2956 | + ssize_t nw; |
2957 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
2958 | + if (_ssl) |
2959 | + { |
2960 | + nw= CyaSSL_write(_ssl, (const void*)(ptr +offset), int(len -offset)); |
2961 | + if (nw < 0) |
2962 | + { |
2963 | + int sendErr= CyaSSL_get_error(_ssl, 0); |
2964 | + if (sendErr != SSL_ERROR_WANT_WRITE) |
2965 | + { |
2966 | + char errorString[80]; |
2967 | + int err = CyaSSL_get_error(_ssl, 0); |
2968 | + CyaSSL_ERR_error_string(err, errorString); |
2969 | + error(__FILE__, __LINE__, errorString); |
2970 | + } |
2971 | + else |
2972 | + { |
2973 | + error(__FILE__, __LINE__, "SSL_ERROR_WANT_WRITE"); |
2974 | + } |
2975 | + |
2976 | + return false; |
2977 | + } |
2978 | + } |
2979 | + else |
2980 | +#endif |
2981 | + { |
2982 | + nw= send(sock_fd, ptr + offset, len - offset, MSG_NOSIGNAL); |
2983 | + } |
2984 | + |
2985 | if (nw == -1) |
2986 | { |
2987 | if (errno != EINTR) |
2988 | { |
2989 | - _error= strerror(errno); |
2990 | + error(__FILE__, __LINE__, strerror(errno)); |
2991 | return false; |
2992 | } |
2993 | } |
2994 | @@ -256,7 +375,7 @@ |
2995 | } |
2996 | } |
2997 | |
2998 | - fatal_assert(_error.size()); |
2999 | + fatal_assert(is_error()); |
3000 | |
3001 | return false; |
3002 | } |
3003 | @@ -306,12 +425,37 @@ |
3004 | buffer[1]= 0; |
3005 | do |
3006 | { |
3007 | - ssize_t nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL); |
3008 | + ssize_t nr; |
3009 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
3010 | + if (_ssl) |
3011 | + { |
3012 | + nr= CyaSSL_read(_ssl, buffer, 1); |
3013 | + if (_ssl and nr < 0) |
3014 | + { |
3015 | + int readErr = CyaSSL_get_error(_ssl, 0); |
3016 | + if (readErr != SSL_ERROR_WANT_READ) |
3017 | + { |
3018 | + error(__FILE__, __LINE__, "CyaSSL_read failed"); |
3019 | + } |
3020 | + else |
3021 | + { |
3022 | + error(__FILE__, __LINE__, "CyaSSL_read (unknown) failed"); |
3023 | + } |
3024 | + |
3025 | + return false; |
3026 | + } |
3027 | + } |
3028 | + else |
3029 | +#endif |
3030 | + { |
3031 | + nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL); |
3032 | + } |
3033 | + |
3034 | if (nr == -1) |
3035 | { |
3036 | if (errno != EINTR) |
3037 | { |
3038 | - _error= strerror(errno); |
3039 | + error(__FILE__, __LINE__, strerror(errno)); |
3040 | return false; |
3041 | } |
3042 | } |
3043 | @@ -336,7 +480,7 @@ |
3044 | } |
3045 | } |
3046 | |
3047 | - fatal_assert(_error.size()); |
3048 | + fatal_assert(is_error()); |
3049 | return false; |
3050 | } |
3051 | |
3052 | @@ -353,12 +497,34 @@ |
3053 | buffer[1]= 0; |
3054 | do |
3055 | { |
3056 | - ssize_t nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL); |
3057 | + ssize_t nr; |
3058 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
3059 | + if (_ssl) |
3060 | + { |
3061 | + nr= CyaSSL_read(_ssl, buffer, 1); |
3062 | + if (_ssl and nr < 0) |
3063 | + { |
3064 | + int readErr = CyaSSL_get_error(_ssl, 0); |
3065 | + if (readErr != SSL_ERROR_WANT_READ) |
3066 | + { |
3067 | + error(__FILE__, __LINE__, "CyaSSL_read failed"); |
3068 | + } |
3069 | + else |
3070 | + { |
3071 | + error(__FILE__, __LINE__, "CyaSSL_read (unknown) failed"); |
3072 | + } |
3073 | + |
3074 | + return false; |
3075 | + } |
3076 | + } |
3077 | + else |
3078 | +#endif |
3079 | + nr= recv(sock_fd, buffer, 1, MSG_NOSIGNAL); |
3080 | if (nr == -1) |
3081 | { |
3082 | if (errno != EINTR) |
3083 | { |
3084 | - _error= strerror(errno); |
3085 | + error(__FILE__, __LINE__, strerror(errno)); |
3086 | return false; |
3087 | } |
3088 | } |
3089 | @@ -382,7 +548,7 @@ |
3090 | } |
3091 | } |
3092 | |
3093 | - fatal_assert(_error.size()); |
3094 | + fatal_assert(is_error()); |
3095 | return false; |
3096 | } |
3097 | |
3098 | |
3099 | === modified file 'libtest/client.hpp' |
3100 | --- libtest/client.hpp 2013-01-08 01:03:28 +0000 |
3101 | +++ libtest/client.hpp 2013-06-14 07:11:24 +0000 |
3102 | @@ -36,6 +36,10 @@ |
3103 | |
3104 | #pragma once |
3105 | |
3106 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
3107 | +# include <cyassl/ssl.h> |
3108 | +#endif |
3109 | + |
3110 | namespace libtest { |
3111 | |
3112 | class SimpleClient { |
3113 | @@ -49,7 +53,9 @@ |
3114 | bool response(std::string&); |
3115 | bool response(libtest::vchar_t&); |
3116 | |
3117 | +private: |
3118 | bool is_valid(); |
3119 | +public: |
3120 | |
3121 | const std::string& error() const |
3122 | { |
3123 | @@ -61,20 +67,45 @@ |
3124 | return _error.size() ? true : false; |
3125 | } |
3126 | |
3127 | + const char* error_file() const |
3128 | + { |
3129 | + return _error_file; |
3130 | + } |
3131 | + |
3132 | + int error_line() const |
3133 | + { |
3134 | + return _error_line; |
3135 | + } |
3136 | + |
3137 | +private: |
3138 | + void free_addrinfo() |
3139 | + { |
3140 | + freeaddrinfo(_ai); |
3141 | + _ai= NULL; |
3142 | + } |
3143 | + |
3144 | private: // Methods |
3145 | + void error(const char* file, int line, const std::string& error_); |
3146 | void close_socket(); |
3147 | bool instance_connect(); |
3148 | struct addrinfo* lookup(); |
3149 | bool message(const char* ptr, const size_t len); |
3150 | bool ready(int event_); |
3151 | + void init_ssl(); |
3152 | |
3153 | private: |
3154 | bool _is_connected; |
3155 | + bool _is_ssl; |
3156 | std::string _hostname; |
3157 | in_port_t _port; |
3158 | int sock_fd; |
3159 | std::string _error; |
3160 | + const char* _error_file; |
3161 | + int _error_line; |
3162 | int requested_message; |
3163 | + struct CYASSL_CTX* _ctx_ssl; |
3164 | + struct CYASSL* _ssl; |
3165 | + struct addrinfo *_ai; |
3166 | }; |
3167 | |
3168 | } // namespace libtest |
3169 | |
3170 | === modified file 'libtest/cmdline.cc' |
3171 | --- libtest/cmdline.cc 2013-05-04 09:20:42 +0000 |
3172 | +++ libtest/cmdline.cc 2013-06-14 07:11:24 +0000 |
3173 | @@ -388,28 +388,56 @@ |
3174 | } |
3175 | |
3176 | bool data_was_read= false; |
3177 | - if (fds[0].revents & POLLRDNORM) |
3178 | + if (fds[0].revents) |
3179 | { |
3180 | - if (stdout_fd.read(_stdout_buffer) == true) |
3181 | - { |
3182 | - data_was_read= true; |
3183 | + if (fds[0].revents & POLLRDNORM) |
3184 | + { |
3185 | + if (stdout_fd.read(_stdout_buffer) == true) |
3186 | + { |
3187 | + data_was_read= true; |
3188 | + } |
3189 | + } |
3190 | + |
3191 | + if (fds[0].revents & (POLLERR | POLLHUP | POLLNVAL)) |
3192 | + { |
3193 | + stdout_fd.close(); |
3194 | + |
3195 | + if (fds[0].revents & POLLERR) |
3196 | + { |
3197 | + Error << "getsockopt(stdout)"; |
3198 | + } |
3199 | } |
3200 | } |
3201 | |
3202 | - if (fds[1].revents & POLLRDNORM) |
3203 | + if (fds[1].revents) |
3204 | { |
3205 | - if (stderr_fd.read(_stderr_buffer) == true) |
3206 | - { |
3207 | - data_was_read= true; |
3208 | + if (fds[1].revents & POLLRDNORM) |
3209 | + { |
3210 | + if (stderr_fd.read(_stderr_buffer) == true) |
3211 | + { |
3212 | + data_was_read= true; |
3213 | + } |
3214 | + } |
3215 | + |
3216 | + if (fds[1].revents & (POLLERR | POLLHUP | POLLNVAL)) |
3217 | + { |
3218 | + stderr_fd.close(); |
3219 | + |
3220 | + if (fds[1].revents & POLLERR) |
3221 | + { |
3222 | + Error << "getsockopt(stderr)"; |
3223 | + } |
3224 | } |
3225 | } |
3226 | |
3227 | return data_was_read; |
3228 | } |
3229 | |
3230 | +#pragma GCC diagnostic push |
3231 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
3232 | Application::error_t Application::join() |
3233 | { |
3234 | - pid_t waited_pid= waitpid(_pid, &_status, WUNTRACED); |
3235 | + pid_t waited_pid= waitpid(_pid, &_status, 0); |
3236 | slurp(); |
3237 | if (waited_pid == _pid and WIFEXITED(_status) == false) |
3238 | { |
3239 | @@ -505,6 +533,7 @@ |
3240 | |
3241 | return _app_exit_state; |
3242 | } |
3243 | +#pragma GCC diagnostic pop |
3244 | |
3245 | void Application::add_long_option(const std::string& name, const std::string& option_value) |
3246 | { |
3247 | @@ -546,6 +575,25 @@ |
3248 | return _pipe_fd[WRITE]; // STDIN_FILENO |
3249 | } |
3250 | |
3251 | +void Application::Pipe::Pipe::close() |
3252 | +{ |
3253 | + if (_std_fd == STDOUT_FILENO) |
3254 | + { |
3255 | + ::close(_pipe_fd[READ]); |
3256 | + _pipe_fd[READ]= -1; |
3257 | + } |
3258 | + else if (_std_fd == STDERR_FILENO) |
3259 | + { |
3260 | + ::close(_pipe_fd[READ]); |
3261 | + _pipe_fd[READ]= -1; |
3262 | + } |
3263 | + else |
3264 | + { |
3265 | + ::close(_pipe_fd[WRITE]); |
3266 | + _pipe_fd[WRITE]= -1; |
3267 | + } |
3268 | +} |
3269 | + |
3270 | |
3271 | bool Application::Pipe::read(libtest::vchar_t& arg) |
3272 | { |
3273 | @@ -596,7 +644,7 @@ |
3274 | if (flags == -1) |
3275 | { |
3276 | Error << "fcntl(F_GETFL) " << strerror(errno); |
3277 | - throw strerror(errno); |
3278 | + throw std::runtime_error(strerror(errno)); |
3279 | } |
3280 | |
3281 | int rval; |
3282 | @@ -608,7 +656,7 @@ |
3283 | if (rval == -1) |
3284 | { |
3285 | Error << "fcntl(F_SETFL) " << strerror(errno); |
3286 | - throw strerror(errno); |
3287 | + throw std::runtime_error(strerror(errno)); |
3288 | } |
3289 | } |
3290 | |
3291 | @@ -649,7 +697,7 @@ |
3292 | if (flags == -1) |
3293 | { |
3294 | Error << "fcntl(F_GETFD) " << strerror(errno); |
3295 | - throw strerror(errno); |
3296 | + throw std::runtime_error(strerror(errno)); |
3297 | } |
3298 | |
3299 | int rval; |
3300 | @@ -661,7 +709,7 @@ |
3301 | if (rval == -1) |
3302 | { |
3303 | Error << "fcntl(F_SETFD) " << strerror(errno); |
3304 | - throw strerror(errno); |
3305 | + throw std::runtime_error(strerror(errno)); |
3306 | } |
3307 | } |
3308 | } |
3309 | @@ -731,13 +779,26 @@ |
3310 | vchar::append(built_argv, "--leak-check=yes"); |
3311 | #if 0 |
3312 | vchar::append(built_argv, "--show-reachable=yes")); |
3313 | -#endif |
3314 | vchar::append(built_argv, "--track-fds=yes"); |
3315 | +#endif |
3316 | #if 0 |
3317 | built_argv[x++]= strdup("--track-origin=yes"); |
3318 | #endif |
3319 | vchar::append(built_argv, "--malloc-fill=A5"); |
3320 | vchar::append(built_argv, "--free-fill=DE"); |
3321 | + vchar::append(built_argv, "--xml=yes"); |
3322 | + if (getenv("VALGRIND_HOME")) |
3323 | + { |
3324 | + libtest::vchar_t buffer; |
3325 | + buffer.resize(1024); |
3326 | + int length= snprintf(&buffer[0], buffer.size(), "--xml-file=%s/cmd-%%p.xml", getenv("VALGRIND_HOME")); |
3327 | + fatal_assert(length > 0 and size_t(length) < buffer.size()); |
3328 | + vchar::append(built_argv, &buffer[0]); |
3329 | + } |
3330 | + else |
3331 | + { |
3332 | + vchar::append(built_argv, "--xml-file=valgrind-cmd-%p.xml"); |
3333 | + } |
3334 | |
3335 | std::string log_file= create_tmpfile("valgrind"); |
3336 | libtest::vchar_t buffer; |
3337 | |
3338 | === modified file 'libtest/cmdline.h' |
3339 | --- libtest/cmdline.h 2013-04-20 05:43:10 +0000 |
3340 | +++ libtest/cmdline.h 2013-06-14 07:11:24 +0000 |
3341 | @@ -109,6 +109,7 @@ |
3342 | ~Pipe(); |
3343 | |
3344 | int fd(); |
3345 | + void close(); |
3346 | |
3347 | enum close_t { |
3348 | READ= 0, |
3349 | |
3350 | === modified file 'libtest/collection.cc' |
3351 | --- libtest/collection.cc 2013-05-03 07:36:06 +0000 |
3352 | +++ libtest/collection.cc 2013-06-14 07:11:24 +0000 |
3353 | @@ -60,6 +60,7 @@ |
3354 | // system. |
3355 | catch (const libtest::fatal& e) |
3356 | { |
3357 | + alarm(0); |
3358 | if (libtest::fatal::is_disabled()) |
3359 | { |
3360 | libtest::fatal::increment_disabled_counter(); |
3361 | @@ -70,6 +71,11 @@ |
3362 | throw; |
3363 | } |
3364 | } |
3365 | + catch (...) |
3366 | + { |
3367 | + alarm(0); |
3368 | + throw; |
3369 | + } |
3370 | |
3371 | _timer.sample(); |
3372 | |
3373 | |
3374 | === modified file 'libtest/cpu.cc' |
3375 | --- libtest/cpu.cc 2012-12-09 11:40:11 +0000 |
3376 | +++ libtest/cpu.cc 2013-06-14 07:11:24 +0000 |
3377 | @@ -2,7 +2,7 @@ |
3378 | * |
3379 | * Data Differential YATL (i.e. libtest) library |
3380 | * |
3381 | - * Copyright (C) 2012 Data Differential, http://datadifferential.com/ |
3382 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
3383 | * |
3384 | * Redistribution and use in source and binary forms, with or without |
3385 | * modification, are permitted provided that the following conditions are |
3386 | @@ -34,8 +34,11 @@ |
3387 | * |
3388 | */ |
3389 | |
3390 | -#include "libtest/yatlcon.h" |
3391 | -#include <libtest/common.h> |
3392 | +#ifdef HAVE_CONFIG_H |
3393 | +# include "libtest/yatlcon.h" |
3394 | +#endif |
3395 | + |
3396 | +#include "libtest/cpu.hpp" |
3397 | |
3398 | #include <unistd.h> |
3399 | |
3400 | @@ -47,23 +50,21 @@ |
3401 | |
3402 | namespace libtest { |
3403 | |
3404 | -size_t number_of_cpus() |
3405 | +uint32_t number_of_cpus() |
3406 | { |
3407 | - size_t number_of_cpu= 1; |
3408 | -#if defined(TARGET_OS_LINUX) && TARGET_OS_LINUX |
3409 | + uint32_t number_of_cpu= 1; |
3410 | +#ifdef linux |
3411 | number_of_cpu= sysconf(_SC_NPROCESSORS_ONLN); |
3412 | #elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_HW) && defined(HW_NCPU) && defined(HW_AVAILCPU) && defined(HW_NCPU) |
3413 | int mib[4]; |
3414 | size_t len= sizeof(number_of_cpu); |
3415 | |
3416 | /* set the mib for hw.ncpu */ |
3417 | - mib[0] = CTL_HW; |
3418 | - mib[1] = HW_AVAILCPU; // alternatively, try HW_NCPU; |
3419 | + mib[0]= CTL_HW; |
3420 | + mib[1]= HW_AVAILCPU; // alternatively, try HW_NCPU; |
3421 | |
3422 | /* get the number of CPUs from the system */ |
3423 | - sysctl(mib, 2, &number_of_cpu, &len, NULL, 0); |
3424 | - |
3425 | - if (number_of_cpu < 1) |
3426 | + if (sysctl(mib, 2, &number_of_cpu, &len, NULL, 0) == -1) |
3427 | { |
3428 | mib[1]= HW_NCPU; |
3429 | sysctl(mib, 2, &number_of_cpu, &len, NULL, 0 ); |
3430 | |
3431 | === modified file 'libtest/cpu.hpp' |
3432 | --- libtest/cpu.hpp 2012-04-28 05:12:41 +0000 |
3433 | +++ libtest/cpu.hpp 2013-06-14 07:11:24 +0000 |
3434 | @@ -36,8 +36,10 @@ |
3435 | |
3436 | #pragma once |
3437 | |
3438 | +#include <cstdlib> |
3439 | + |
3440 | namespace libtest { |
3441 | |
3442 | -size_t number_of_cpus(); |
3443 | +uint32_t number_of_cpus(); |
3444 | |
3445 | } // namespace libtest |
3446 | |
3447 | === modified file 'libtest/drizzled.cc' |
3448 | --- libtest/drizzled.cc 2013-04-15 19:02:09 +0000 |
3449 | +++ libtest/drizzled.cc 2013-06-14 07:11:24 +0000 |
3450 | @@ -166,6 +166,11 @@ |
3451 | return true; |
3452 | } |
3453 | |
3454 | + bool is_valgrind() const |
3455 | + { |
3456 | + return false; |
3457 | + } |
3458 | + |
3459 | bool has_port_option() const |
3460 | { |
3461 | return true; |
3462 | |
3463 | === modified file 'libtest/error.h' |
3464 | --- libtest/error.h 2012-04-28 05:12:41 +0000 |
3465 | +++ libtest/error.h 2013-06-14 07:11:24 +0000 |
3466 | @@ -52,3 +52,77 @@ |
3467 | { |
3468 | return (rc != TEST_SUCCESS); |
3469 | } |
3470 | + |
3471 | +namespace libtest { |
3472 | + |
3473 | +class Error |
3474 | +{ |
3475 | + public: |
3476 | + Error(): |
3477 | + _is_error(false), |
3478 | + _file(NULL), |
3479 | + _line(-1), |
3480 | + _func(NULL) |
3481 | + { |
3482 | + } |
3483 | + |
3484 | + Error(const Error& error_): |
3485 | + _is_error(false), |
3486 | + _file(NULL), |
3487 | + _line(0), |
3488 | + _func(NULL) |
3489 | + { |
3490 | + if (error_.is_error()) |
3491 | + { |
3492 | + _is_error= true; |
3493 | + _file= error_.file(); |
3494 | + _line= error_.line(); |
3495 | + _func= error_.func(); |
3496 | + _message= error_.error(); |
3497 | + } |
3498 | + } |
3499 | + |
3500 | + Error(const char* file_, int line_, const char* func_, const std::string& message_): |
3501 | + _is_error(true), |
3502 | + _file(file_), |
3503 | + _line(line_), |
3504 | + _func(func_), |
3505 | + _message(message_) |
3506 | + { |
3507 | + } |
3508 | + |
3509 | + bool is_error() const |
3510 | + { |
3511 | + return _is_error; |
3512 | + } |
3513 | + |
3514 | + const char* func() const |
3515 | + { |
3516 | + return _func; |
3517 | + } |
3518 | + |
3519 | + const char* file() const |
3520 | + { |
3521 | + return _file; |
3522 | + } |
3523 | + |
3524 | + int line() const |
3525 | + { |
3526 | + return _line; |
3527 | + } |
3528 | + |
3529 | + const std::string& error() const |
3530 | + { |
3531 | + return _message; |
3532 | + } |
3533 | + |
3534 | + private: |
3535 | + bool _is_error; |
3536 | + const char* _file; |
3537 | + int _line; |
3538 | + const char* _func; |
3539 | + std::string _message; |
3540 | +}; |
3541 | + |
3542 | +} // namespace libtest |
3543 | + |
3544 | |
3545 | === modified file 'libtest/framework.cc' |
3546 | --- libtest/framework.cc 2013-05-03 07:36:06 +0000 |
3547 | +++ libtest/framework.cc 2013-06-14 07:11:24 +0000 |
3548 | @@ -39,10 +39,69 @@ |
3549 | #include <libtest/common.h> |
3550 | #include <libtest/collection.h> |
3551 | #include <libtest/signal.h> |
3552 | +#include <libtest/stream.h> |
3553 | |
3554 | #include <algorithm> |
3555 | +#include <cerrno> |
3556 | #include <fnmatch.h> |
3557 | #include <iostream> |
3558 | +#include <set> |
3559 | +#include <sys/stat.h> |
3560 | +#include <sys/types.h> |
3561 | +#include <unistd.h> |
3562 | + |
3563 | +namespace { |
3564 | +#if defined(DEBUG) && DEBUG |
3565 | + int open_file_descriptors(std::set<int>& pre_existing_fd, const bool report) |
3566 | + { |
3567 | + int max= getdtablesize(); |
3568 | + |
3569 | + int counter= 0; |
3570 | + |
3571 | + for (int x= 3; x < max; ++x) |
3572 | + { |
3573 | + struct stat stats; |
3574 | + |
3575 | + if (fstat(x, &stats) == 0) |
3576 | + { |
3577 | + if (report) |
3578 | + { |
3579 | + std::set<int>::iterator it= pre_existing_fd.find(x); |
3580 | + if (it!= pre_existing_fd.end()) |
3581 | + { } |
3582 | + else |
3583 | + { |
3584 | + std::cerr << "FD: " << x; |
3585 | + |
3586 | + if (S_ISREG(stats.st_mode)) |
3587 | + { |
3588 | + std::cerr << " regular file "; |
3589 | + } |
3590 | + else if (S_ISDIR(stats.st_mode)) |
3591 | + { |
3592 | + std::cerr << " directory "; |
3593 | + } |
3594 | + else if (S_ISSOCK(stats.st_mode)) |
3595 | + { |
3596 | + std::cerr << " socket "; |
3597 | + } |
3598 | + |
3599 | + std::cerr << std::endl; |
3600 | + } |
3601 | + } |
3602 | + else |
3603 | + { |
3604 | + pre_existing_fd.insert(x); |
3605 | + } |
3606 | + |
3607 | + ++counter; |
3608 | + } |
3609 | + } |
3610 | + |
3611 | + return counter; |
3612 | + } |
3613 | +#endif // #if defined(DEBUG) && DEBUG |
3614 | +} // namespace |
3615 | |
3616 | namespace libtest { |
3617 | |
3618 | @@ -107,54 +166,70 @@ |
3619 | iter != _collection.end() and (_signal.is_shutdown() == false); |
3620 | ++iter) |
3621 | { |
3622 | - if (*iter) |
3623 | - { |
3624 | - if (_only_run.empty() == false and |
3625 | - fnmatch(_only_run.c_str(), (*iter)->name(), 0)) |
3626 | - { |
3627 | - continue; |
3628 | - } |
3629 | - |
3630 | - _total++; |
3631 | - |
3632 | - try { |
3633 | - switch ((*iter)->exec()) |
3634 | - { |
3635 | - case TEST_FAILURE: |
3636 | - _failed++; |
3637 | - break; |
3638 | - |
3639 | - case TEST_SKIPPED: |
3640 | - _skipped++; |
3641 | - break; |
3642 | - |
3643 | - // exec() can return SUCCESS, but that doesn't mean that some tests did |
3644 | - // not fail or get skipped. |
3645 | - case TEST_SUCCESS: |
3646 | - _success++; |
3647 | - break; |
3648 | - } |
3649 | - } |
3650 | - catch (const libtest::fatal& e) |
3651 | - { |
3652 | - _failed++; |
3653 | - stream::cerr(e.file(), e.line(), e.func()) << e.what(); |
3654 | - } |
3655 | - catch (const libtest::disconnected& e) |
3656 | - { |
3657 | - _failed++; |
3658 | - Error << "Unhandled disconnection occurred:" << e.what(); |
3659 | - throw; |
3660 | - } |
3661 | - catch (...) |
3662 | - { |
3663 | - _failed++; |
3664 | - throw; |
3665 | - } |
3666 | - } |
3667 | + if (_only_run.empty() == false and |
3668 | + fnmatch(_only_run.c_str(), (*iter)->name(), 0)) |
3669 | + { |
3670 | + continue; |
3671 | + } |
3672 | + |
3673 | + _total++; |
3674 | + |
3675 | +#if defined(DEBUG) && DEBUG |
3676 | + std::set<int> pre_existing_fd; |
3677 | + int open_fd= 0; |
3678 | + if (DEBUG) |
3679 | + { |
3680 | + open_fd= open_file_descriptors(pre_existing_fd, false); |
3681 | + } |
3682 | +#endif |
3683 | + |
3684 | + try { |
3685 | + switch ((*iter)->exec()) |
3686 | + { |
3687 | + case TEST_FAILURE: |
3688 | + _failed++; |
3689 | + break; |
3690 | + |
3691 | + case TEST_SKIPPED: |
3692 | + _skipped++; |
3693 | + break; |
3694 | + |
3695 | + // exec() can return SUCCESS, but that doesn't mean that some tests did |
3696 | + // not fail or get skipped. |
3697 | + case TEST_SUCCESS: |
3698 | + _success++; |
3699 | + break; |
3700 | + } |
3701 | + } |
3702 | + catch (const libtest::fatal& e) |
3703 | + { |
3704 | + _failed++; |
3705 | + stream::cerr(e.file(), e.line(), e.func()) << e.what(); |
3706 | + } |
3707 | + catch (const libtest::disconnected& e) |
3708 | + { |
3709 | + _failed++; |
3710 | + Error << "Unhandled disconnection occurred:" << e.what(); |
3711 | + throw; |
3712 | + } |
3713 | + catch (...) |
3714 | + { |
3715 | + _failed++; |
3716 | + throw; |
3717 | + } |
3718 | + |
3719 | +#if defined(DEBUG) && DEBUG |
3720 | + if (DEBUG) |
3721 | + { |
3722 | + int now_open_fd= open_file_descriptors(pre_existing_fd, true); |
3723 | + |
3724 | + if (open_fd != now_open_fd) |
3725 | + { |
3726 | + Error << "Growing number of file descriptors: " << int(now_open_fd - open_fd); |
3727 | + } |
3728 | + } |
3729 | +#endif |
3730 | } |
3731 | - |
3732 | - void xml(const std::string& testsuites_name, std::ostream& output); |
3733 | } |
3734 | |
3735 | uint32_t Framework::sum_total() |
3736 | |
3737 | === modified file 'libtest/gearmand.cc' |
3738 | --- libtest/gearmand.cc 2013-01-24 11:17:17 +0000 |
3739 | +++ libtest/gearmand.cc 2013-06-14 07:11:24 +0000 |
3740 | @@ -79,9 +79,14 @@ |
3741 | std::string response; |
3742 | bool ret= client.send_message("version", response); |
3743 | |
3744 | + if (ret == false) |
3745 | + { |
3746 | + ASSERT_TRUE_(client.is_error(), "client.send_message() failed but no error was set"); |
3747 | + } |
3748 | + |
3749 | if (client.is_error()) |
3750 | { |
3751 | - error(client.error()); |
3752 | + error(client.error_file(), client.error_line(), client.error()); |
3753 | } |
3754 | |
3755 | return ret; |
3756 | @@ -141,6 +146,12 @@ |
3757 | |
3758 | add_option("--listen=localhost"); |
3759 | |
3760 | + |
3761 | + if (is_ssl()) |
3762 | + { |
3763 | + add_option("--ssl"); |
3764 | + } |
3765 | + |
3766 | return true; |
3767 | } |
3768 | |
3769 | |
3770 | === modified file 'libtest/has.cc' |
3771 | --- libtest/has.cc 2013-05-03 07:36:06 +0000 |
3772 | +++ libtest/has.cc 2013-06-14 07:11:24 +0000 |
3773 | @@ -43,11 +43,8 @@ |
3774 | |
3775 | namespace libtest { |
3776 | |
3777 | -bool has_libmemcached_sasl(void) |
3778 | -{ |
3779 | - return false; |
3780 | -} |
3781 | - |
3782 | +#pragma GCC diagnostic push |
3783 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
3784 | bool has_libmemcached(void) |
3785 | { |
3786 | #if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED |
3787 | @@ -59,6 +56,7 @@ |
3788 | |
3789 | return false; |
3790 | } |
3791 | +#pragma GCC diagnostic pop |
3792 | |
3793 | bool has_libdrizzle(void) |
3794 | { |
3795 | @@ -72,6 +70,8 @@ |
3796 | return false; |
3797 | } |
3798 | |
3799 | +#pragma GCC diagnostic push |
3800 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
3801 | bool has_postgres_support(void) |
3802 | { |
3803 | char *getenv_ptr; |
3804 | @@ -86,6 +86,7 @@ |
3805 | |
3806 | return false; |
3807 | } |
3808 | +#pragma GCC diagnostic pop |
3809 | |
3810 | |
3811 | bool has_gearmand() |
3812 | |
3813 | === modified file 'libtest/http.cc' |
3814 | --- libtest/http.cc 2013-05-03 07:36:06 +0000 |
3815 | +++ libtest/http.cc 2013-06-14 07:11:24 +0000 |
3816 | @@ -114,6 +114,8 @@ |
3817 | initialize_curl(); |
3818 | } |
3819 | |
3820 | +#pragma GCC diagnostic push |
3821 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
3822 | bool GET::execute() |
3823 | { |
3824 | (void)init; |
3825 | @@ -139,7 +141,10 @@ |
3826 | |
3827 | return false; |
3828 | } |
3829 | +#pragma GCC diagnostic pop |
3830 | |
3831 | +#pragma GCC diagnostic push |
3832 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
3833 | bool POST::execute() |
3834 | { |
3835 | #if defined(HAVE_LIBCURL) && HAVE_LIBCURL |
3836 | @@ -163,7 +168,10 @@ |
3837 | |
3838 | return false; |
3839 | } |
3840 | +#pragma GCC diagnostic pop |
3841 | |
3842 | +#pragma GCC diagnostic push |
3843 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
3844 | bool TRACE::execute() |
3845 | { |
3846 | #if defined(HAVE_LIBCURL) && HAVE_LIBCURL |
3847 | @@ -188,7 +196,10 @@ |
3848 | |
3849 | return false; |
3850 | } |
3851 | +#pragma GCC diagnostic pop |
3852 | |
3853 | +#pragma GCC diagnostic push |
3854 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
3855 | bool HEAD::execute() |
3856 | { |
3857 | #if defined(HAVE_LIBCURL) && HAVE_LIBCURL |
3858 | @@ -212,6 +223,7 @@ |
3859 | |
3860 | return false; |
3861 | } |
3862 | +#pragma GCC diagnostic pop |
3863 | |
3864 | } // namespace http |
3865 | } // namespace libtest |
3866 | |
3867 | === modified file 'libtest/include.am' |
3868 | --- libtest/include.am 2013-05-03 07:36:06 +0000 |
3869 | +++ libtest/include.am 2013-06-14 07:11:24 +0000 |
3870 | @@ -115,6 +115,9 @@ |
3871 | EXTRA_libtest_libtest_la_DEPENDENCIES= |
3872 | libtest_libtest_la_LIBADD= |
3873 | libtest_libtest_la_SOURCES= |
3874 | +libtest_libtest_la_CXXFLAGS+= @LIBMEMCACHED_CFLAGS@ |
3875 | +libtest_libtest_la_LIBADD+= @LIBMEMCACHED_LIB@ |
3876 | +libtest_libtest_la_LIBADD+= @CYASSL_LIB@ |
3877 | |
3878 | libtest_libtest_la_SOURCES+= libtest/alarm.cc |
3879 | libtest_libtest_la_SOURCES+= libtest/binaries.cc |
3880 | |
3881 | === modified file 'libtest/is_local.cc' |
3882 | --- libtest/is_local.cc 2012-12-09 11:40:11 +0000 |
3883 | +++ libtest/is_local.cc 2013-06-14 07:11:24 +0000 |
3884 | @@ -56,5 +56,16 @@ |
3885 | return _is_massive; |
3886 | } |
3887 | |
3888 | +static bool _is_ssl= false; |
3889 | +void is_ssl(bool arg) |
3890 | +{ |
3891 | + _is_ssl= arg; |
3892 | +} |
3893 | + |
3894 | +bool is_ssl() |
3895 | +{ |
3896 | + return _is_ssl; |
3897 | +} |
3898 | + |
3899 | } // namespace libtest |
3900 | |
3901 | |
3902 | === modified file 'libtest/is_local.hpp' |
3903 | --- libtest/is_local.hpp 2012-07-15 06:35:11 +0000 |
3904 | +++ libtest/is_local.hpp 2013-06-14 07:11:24 +0000 |
3905 | @@ -47,4 +47,10 @@ |
3906 | LIBTEST_API |
3907 | bool is_massive(); |
3908 | |
3909 | +LIBTEST_API |
3910 | +void is_ssl(bool); |
3911 | + |
3912 | +LIBTEST_API |
3913 | +bool is_ssl(); |
3914 | + |
3915 | } // namespace libtest |
3916 | |
3917 | === modified file 'libtest/lite.h' |
3918 | --- libtest/lite.h 2013-04-21 08:19:20 +0000 |
3919 | +++ libtest/lite.h 2013-06-14 07:11:24 +0000 |
3920 | @@ -2,7 +2,7 @@ |
3921 | * |
3922 | * Data Differential YATL (i.e. libtest) library |
3923 | * |
3924 | - * Copyright (C) 2012 Data Differential, http://datadifferential.com/ |
3925 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
3926 | * |
3927 | * Redistribution and use in source and binary forms, with or without |
3928 | * modification, are permitted provided that the following conditions are |
3929 | @@ -192,6 +192,18 @@ |
3930 | } \ |
3931 | } while (0) |
3932 | |
3933 | +#define ASSERT_NULL(__expression) \ |
3934 | +do \ |
3935 | +{ \ |
3936 | + if ((__expression) != NULL) { \ |
3937 | + if (YATL_FULL) { \ |
3938 | + FAIL("Assertion '%s' != NULL", #__expression);\ |
3939 | + } \ |
3940 | + fprintf(stderr, "\n%s:%d: %s Assertion '%s' != NULL\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #__expression);\ |
3941 | + exit(EXIT_FAILURE); \ |
3942 | + } \ |
3943 | +} while (0) |
3944 | + |
3945 | #define ASSERT_NULL_(__expression, ...) \ |
3946 | do \ |
3947 | { \ |
3948 | @@ -213,9 +225,9 @@ |
3949 | { \ |
3950 | if ((__expression) == NULL) { \ |
3951 | if (YATL_FULL) { \ |
3952 | - FAIL("Assertion '%s' == NULL", #__expression,);\ |
3953 | + FAIL("Assertion '%s' == NULL", #__expression);\ |
3954 | } \ |
3955 | - fprintf(stderr, "\n%s:%d: %s Assertion '%s' == NULL\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #__expression,);\ |
3956 | + fprintf(stderr, "\n%s:%d: %s Assertion '%s' == NULL\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, #__expression);\ |
3957 | exit(EXIT_FAILURE); \ |
3958 | } \ |
3959 | } while (0) |
3960 | @@ -285,8 +297,8 @@ |
3961 | { \ |
3962 | size_t __expected_length; \ |
3963 | size_t __actual_length; \ |
3964 | - int ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
3965 | - if (ret) { \ |
3966 | + int __ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
3967 | + if (__ret) { \ |
3968 | if (YATL_FULL) { \ |
3969 | FAIL("Assertion '%.*s' != '%.*s'\n", \ |
3970 | (int)(__expected_length), (__expected_str), \ |
3971 | @@ -304,8 +316,8 @@ |
3972 | { \ |
3973 | size_t __expected_length; \ |
3974 | size_t __actual_length; \ |
3975 | - int ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
3976 | - if (ret) { \ |
3977 | + int __ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
3978 | + if (__ret) { \ |
3979 | size_t ask= snprintf(0, 0, __VA_ARGS__); \ |
3980 | ask++; \ |
3981 | char *buffer= (char*)alloca(sizeof(char) * ask); \ |
3982 | @@ -329,8 +341,8 @@ |
3983 | { \ |
3984 | size_t __expected_length; \ |
3985 | size_t __actual_length; \ |
3986 | - int ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
3987 | - if (ret == 0) { \ |
3988 | + int __ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
3989 | + if (__ret == 0) { \ |
3990 | if (YATL_FULL) { \ |
3991 | FAIL("Assertion '%.*s' == '%.*s'", \ |
3992 | (int)(__expected_length), (__expected_str), \ |
3993 | @@ -348,8 +360,8 @@ |
3994 | { \ |
3995 | size_t __expected_length; \ |
3996 | size_t __actual_length; \ |
3997 | - int ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
3998 | - if (ret == 0) { \ |
3999 | + int __ret= yatl_strcmp(__expected_str, __actual_str, &__expected_length, &__actual_length); \ |
4000 | + if (__ret == 0) { \ |
4001 | size_t ask= snprintf(0, 0, __VA_ARGS__); \ |
4002 | ask++; \ |
4003 | char *buffer= (char*)alloca(sizeof(char) * ask); \ |
4004 | |
4005 | === modified file 'libtest/main.cc' |
4006 | --- libtest/main.cc 2013-04-29 15:24:05 +0000 |
4007 | +++ libtest/main.cc 2013-06-14 07:11:24 +0000 |
4008 | @@ -38,12 +38,13 @@ |
4009 | #include <libtest/common.h> |
4010 | |
4011 | #include <cassert> |
4012 | +#include <cstddef> |
4013 | #include <cstdlib> |
4014 | #include <cstring> |
4015 | #include <ctime> |
4016 | #include <fnmatch.h> |
4017 | +#include <fstream> |
4018 | #include <iostream> |
4019 | -#include <fstream> |
4020 | #include <memory> |
4021 | #include <sys/stat.h> |
4022 | #include <sys/time.h> |
4023 | @@ -81,10 +82,12 @@ |
4024 | #include <getopt.h> |
4025 | #include <unistd.h> |
4026 | |
4027 | -int main(int argc, char *argv[]) |
4028 | +int main(int argc, char *argv[], char* environ_[]) |
4029 | { |
4030 | bool opt_massive= false; |
4031 | + bool opt_ssl= false; |
4032 | unsigned long int opt_repeat= 1; // Run all tests once |
4033 | + bool opt_verbose= false; |
4034 | bool opt_quiet= false; |
4035 | std::string collection_to_run; |
4036 | std::string wildcard; |
4037 | @@ -120,22 +123,27 @@ |
4038 | // Options parsing |
4039 | { |
4040 | enum long_option_t { |
4041 | + OPT_LIBYATL_VERBOSE, |
4042 | OPT_LIBYATL_VERSION, |
4043 | OPT_LIBYATL_MATCH_COLLECTION, |
4044 | OPT_LIBYATL_MASSIVE, |
4045 | OPT_LIBYATL_QUIET, |
4046 | OPT_LIBYATL_MATCH_WILDCARD, |
4047 | - OPT_LIBYATL_REPEAT |
4048 | + OPT_LIBYATL_REPEAT, |
4049 | + OPT_LIBYATL_SSL, |
4050 | + OPT_LIBYATL_MAX |
4051 | }; |
4052 | |
4053 | static struct option long_options[]= |
4054 | { |
4055 | + { "verbose", no_argument, NULL, OPT_LIBYATL_VERBOSE }, |
4056 | { "version", no_argument, NULL, OPT_LIBYATL_VERSION }, |
4057 | { "quiet", no_argument, NULL, OPT_LIBYATL_QUIET }, |
4058 | { "repeat", required_argument, NULL, OPT_LIBYATL_REPEAT }, |
4059 | { "collection", required_argument, NULL, OPT_LIBYATL_MATCH_COLLECTION }, |
4060 | { "wildcard", required_argument, NULL, OPT_LIBYATL_MATCH_WILDCARD }, |
4061 | { "massive", no_argument, NULL, OPT_LIBYATL_MASSIVE }, |
4062 | + { "ssl", no_argument, NULL, OPT_LIBYATL_SSL }, |
4063 | { 0, 0, 0, 0 } |
4064 | }; |
4065 | |
4066 | @@ -150,6 +158,10 @@ |
4067 | |
4068 | switch (option_rv) |
4069 | { |
4070 | + case OPT_LIBYATL_VERBOSE: |
4071 | + opt_verbose= true; |
4072 | + break; |
4073 | + |
4074 | case OPT_LIBYATL_VERSION: |
4075 | break; |
4076 | |
4077 | @@ -175,6 +187,10 @@ |
4078 | wildcard= optarg; |
4079 | break; |
4080 | |
4081 | + case OPT_LIBYATL_SSL: |
4082 | + opt_ssl= true; |
4083 | + break; |
4084 | + |
4085 | case OPT_LIBYATL_MASSIVE: |
4086 | opt_massive= true; |
4087 | break; |
4088 | @@ -190,6 +206,14 @@ |
4089 | } |
4090 | } |
4091 | |
4092 | + if (opt_verbose) |
4093 | + { |
4094 | + for (char** ptr= environ_; *ptr; ptr++) |
4095 | + { |
4096 | + Out << *ptr; |
4097 | + } |
4098 | + } |
4099 | + |
4100 | srandom((unsigned int)time(NULL)); |
4101 | |
4102 | errno= 0; |
4103 | @@ -218,16 +242,31 @@ |
4104 | } |
4105 | } |
4106 | |
4107 | + if ((bool(getenv("YATL_WILDCARD")))) |
4108 | + { |
4109 | + wildcard= getenv("YATL_WILDCARD"); |
4110 | + } |
4111 | + |
4112 | if ((bool(getenv("YATL_RUN_MASSIVE_TESTS"))) or opt_massive) |
4113 | { |
4114 | opt_massive= true; |
4115 | } |
4116 | |
4117 | + if ((bool(getenv("YATL_SSL"))) or opt_ssl) |
4118 | + { |
4119 | + opt_ssl= true; |
4120 | + } |
4121 | + |
4122 | if (opt_quiet) |
4123 | { |
4124 | close(STDOUT_FILENO); |
4125 | } |
4126 | |
4127 | + if (opt_ssl) |
4128 | + { |
4129 | + is_ssl(opt_ssl); |
4130 | + } |
4131 | + |
4132 | if (opt_massive) |
4133 | { |
4134 | is_massive(opt_massive); |
4135 | @@ -345,7 +384,11 @@ |
4136 | |
4137 | std::ofstream xml_file; |
4138 | std::string file_name; |
4139 | - file_name.append(&tmp_directory[0]); |
4140 | + if (getenv("WORKSPACE")) |
4141 | + { |
4142 | + file_name.append(getenv("WORKSPACE")); |
4143 | + file_name.append("/"); |
4144 | + } |
4145 | file_name.append(frame->name()); |
4146 | file_name.append(".xml"); |
4147 | xml_file.open(file_name.c_str(), std::ios::trunc); |
4148 | |
4149 | === modified file 'libtest/memcached.cc' |
4150 | --- libtest/memcached.cc 2013-04-20 09:55:24 +0000 |
4151 | +++ libtest/memcached.cc 2013-06-14 07:11:24 +0000 |
4152 | @@ -38,9 +38,6 @@ |
4153 | |
4154 | #include "libtest/common.h" |
4155 | |
4156 | -#include <libmemcached-1.2/memcached.h> |
4157 | -#include <libmemcachedutil-1.2/util.h> |
4158 | - |
4159 | #include <cassert> |
4160 | #include <cerrno> |
4161 | #include <cstdio> |
4162 | @@ -185,6 +182,11 @@ |
4163 | return true; |
4164 | } |
4165 | |
4166 | + bool is_valgrind() const |
4167 | + { |
4168 | + return false; |
4169 | + } |
4170 | + |
4171 | // Memcached's pidfile is broken |
4172 | bool broken_pid_file() |
4173 | { |
4174 | |
4175 | === modified file 'libtest/result.hpp' |
4176 | --- libtest/result.hpp 2013-04-21 01:17:49 +0000 |
4177 | +++ libtest/result.hpp 2013-06-14 07:11:24 +0000 |
4178 | @@ -2,7 +2,7 @@ |
4179 | * |
4180 | * Data Differential YATL (i.e. libtest) library |
4181 | * |
4182 | - * Copyright (C) 2012 Data Differential, http://datadifferential.com/ |
4183 | + * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
4184 | * |
4185 | * Redistribution and use in source and binary forms, with or without |
4186 | * modification, are permitted provided that the following conditions are |
4187 | |
4188 | === modified file 'libtest/server.cc' |
4189 | --- libtest/server.cc 2013-01-24 11:17:17 +0000 |
4190 | +++ libtest/server.cc 2013-06-14 07:11:24 +0000 |
4191 | @@ -131,6 +131,7 @@ |
4192 | { |
4193 | _app.slurp(); |
4194 | _app.check(); |
4195 | + |
4196 | return true; |
4197 | } |
4198 | |
4199 | @@ -194,7 +195,13 @@ |
4200 | return (_app.pid() > 1); |
4201 | } |
4202 | |
4203 | +bool Server::is_valgrind() const |
4204 | +{ |
4205 | + return getenv("YATL_VALGRIND_SERVER") or valgrind_is_caller(); |
4206 | +} |
4207 | |
4208 | +#pragma GCC diagnostic push |
4209 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
4210 | bool Server::start() |
4211 | { |
4212 | // If we find that we already have a pid then kill it. |
4213 | @@ -220,7 +227,7 @@ |
4214 | { |
4215 | _app.use_ptrcheck(true); |
4216 | } |
4217 | - else if (getenv("YATL_VALGRIND_SERVER")) |
4218 | + else if (is_valgrind()) |
4219 | { |
4220 | _app.use_valgrind(true); |
4221 | } |
4222 | @@ -321,18 +328,20 @@ |
4223 | _app.slurp(); |
4224 | if (kill_file(pid_file()) == false) |
4225 | { |
4226 | - throw libtest::disconnected(LIBYATL_DEFAULT_PARAM, |
4227 | + throw libtest::disconnected(error_file(), error_line(), __PRETTY_FUNCTION__, |
4228 | hostname(), port(), |
4229 | - "Failed to kill off server, waited: %u after startup occurred, when pinging failed: %.*s stderr:%.*s", |
4230 | + "ping(%s) additionally failed to kill off server, waited: %u after startup occurred failed: %.*s error:%s stderr:%.*s", |
4231 | + error().c_str(), |
4232 | this_wait, |
4233 | int(_running.size()), _running.c_str(), |
4234 | int(_app.stderr_result_length()), _app.stderr_c_str()); |
4235 | } |
4236 | else |
4237 | { |
4238 | - throw libtest::disconnected(LIBYATL_DEFAULT_PARAM, |
4239 | + throw libtest::disconnected(error_file(), error_line(), __PRETTY_FUNCTION__, |
4240 | hostname(), port(), |
4241 | - "Failed native ping(), pid: %d was alive: %s waited: %u server started, having pid_file. exec: %.*s stderr:%.*s", |
4242 | + "ping(%s) additionally failed pid: %d was alive: %s waited: %u server started, having pid_file. exec: %.*s stderr:%.*s", |
4243 | + error().c_str(), |
4244 | int(_app.pid()), |
4245 | _app.check() ? "true" : "false", |
4246 | this_wait, |
4247 | @@ -342,9 +351,10 @@ |
4248 | } |
4249 | else |
4250 | { |
4251 | - throw libtest::disconnected(LIBYATL_DEFAULT_PARAM, |
4252 | + throw libtest::disconnected(error_file(), error_line(), __PRETTY_FUNCTION__, |
4253 | hostname(), port(), |
4254 | - "Failed native ping(), pid: %d is alive: %s waited: %u server started. exec: %.*s stderr:%.*s", |
4255 | + "ping(%s), additionally pid: %d is alive: %s waited: %u server started. exec: %.*s stderr:%.*s", |
4256 | + error().c_str(), |
4257 | int(_app.pid()), |
4258 | _app.check() ? "true" : "false", |
4259 | this_wait, |
4260 | @@ -358,6 +368,7 @@ |
4261 | |
4262 | return has_pid(); |
4263 | } |
4264 | +#pragma GCC diagnostic pop |
4265 | |
4266 | void Server::reset_pid() |
4267 | { |
4268 | |
4269 | === modified file 'libtest/server.h' |
4270 | --- libtest/server.h 2013-01-24 11:17:17 +0000 |
4271 | +++ libtest/server.h 2013-06-14 07:11:24 +0000 |
4272 | @@ -219,6 +219,23 @@ |
4273 | return _error; |
4274 | } |
4275 | |
4276 | + void error(const char* file_, int line_, const std::string& error_) |
4277 | + { |
4278 | + _error_file= file_; |
4279 | + _error_line= line_; |
4280 | + _error= error_; |
4281 | + } |
4282 | + |
4283 | + const char* error_file() const |
4284 | + { |
4285 | + return _error_file; |
4286 | + } |
4287 | + |
4288 | + int error_line() const |
4289 | + { |
4290 | + return _error_line; |
4291 | + } |
4292 | + |
4293 | void error(std::string arg) |
4294 | { |
4295 | _error= arg; |
4296 | @@ -278,7 +295,7 @@ |
4297 | |
4298 | private: |
4299 | bool is_helgrind() const; |
4300 | - bool is_valgrind() const; |
4301 | + virtual bool is_valgrind() const; |
4302 | bool is_debug() const; |
4303 | bool set_log_file(); |
4304 | bool set_socket_file(); |
4305 | @@ -287,6 +304,8 @@ |
4306 | bool args(Application&); |
4307 | |
4308 | std::string _error; |
4309 | + const char* _error_file; |
4310 | + int _error_line; |
4311 | uint32_t _timeout; // This number should be high enough for valgrind startup (which is slow) |
4312 | }; |
4313 | |
4314 | |
4315 | === modified file 'libtest/signal.cc' |
4316 | --- libtest/signal.cc 2013-04-15 19:02:09 +0000 |
4317 | +++ libtest/signal.cc 2013-06-14 07:11:24 +0000 |
4318 | @@ -88,7 +88,8 @@ |
4319 | |
4320 | void SignalThread::test() |
4321 | { |
4322 | - assert(magic_memory == MAGIC_MEMORY); |
4323 | + fatal_assert(magic_memory == MAGIC_MEMORY); |
4324 | + |
4325 | if (bool(getenv("LIBTEST_IN_GDB")) == false) |
4326 | { |
4327 | assert(sigismember(&set, SIGALRM)); |
4328 | |
4329 | === modified file 'libtest/string.hpp' |
4330 | --- libtest/string.hpp 2012-04-28 05:12:41 +0000 |
4331 | +++ libtest/string.hpp 2013-06-14 07:11:24 +0000 |
4332 | @@ -40,6 +40,7 @@ |
4333 | |
4334 | #define test_literal_param util_literal_param |
4335 | #define test_literal_compare_param util_literal_compare_param |
4336 | +#define test_literal_printf_param util_literal_printf_param |
4337 | #define test_literal_param_size util_literal_param_size |
4338 | #define test_string_make_from_cstr util_string_make_from_cstr |
4339 | #define test_string_make_from_array util_string_make_from_array |
4340 | |
4341 | === modified file 'libtest/unittest.cc' |
4342 | --- libtest/unittest.cc 2013-05-03 07:36:06 +0000 |
4343 | +++ libtest/unittest.cc 2013-06-14 07:11:24 +0000 |
4344 | @@ -80,6 +80,19 @@ |
4345 | return TEST_SUCCESS; |
4346 | } |
4347 | |
4348 | +static test_return_t VALGRIND_CHECK_TEST(void *) |
4349 | +{ |
4350 | + SKIP_IF(bool(getenv("VALGRIND_COMMAND")) == false); |
4351 | + SKIP_IF(bool(getenv("TESTS_ENVIRONMENT")) == false); |
4352 | + |
4353 | + if (getenv("TESTS_ENVIRONMENT") && strstr(getenv("TESTS_ENVIRONMENT"), "valgrind")) |
4354 | + { |
4355 | + ASSERT_TRUE(valgrind_is_caller()); |
4356 | + } |
4357 | + |
4358 | + return TEST_SUCCESS; |
4359 | +} |
4360 | + |
4361 | static test_return_t HELGRIND_COMMAND_test(void *) |
4362 | { |
4363 | test_true(getenv("HELGRIND_COMMAND")); |
4364 | @@ -106,6 +119,8 @@ |
4365 | return TEST_SUCCESS; |
4366 | } |
4367 | |
4368 | +#pragma GCC diagnostic push |
4369 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
4370 | static test_return_t test_throw_success_TEST(void *) |
4371 | { |
4372 | try { |
4373 | @@ -122,6 +137,7 @@ |
4374 | |
4375 | return TEST_FAILURE; |
4376 | } |
4377 | +#pragma GCC diagnostic pop |
4378 | |
4379 | static test_return_t test_throw_skip_macro_TEST(void *) |
4380 | { |
4381 | @@ -198,10 +214,10 @@ |
4382 | |
4383 | return TEST_FAILURE; |
4384 | } |
4385 | + |
4386 | +#pragma GCC diagnostic push |
4387 | #pragma GCC diagnostic ignored "-Wstack-protector" |
4388 | - |
4389 | #ifdef __clang__ |
4390 | -# pragma GCC diagnostic push |
4391 | # pragma GCC diagnostic ignored "-Wformat-security" |
4392 | #endif |
4393 | |
4394 | @@ -222,10 +238,25 @@ |
4395 | |
4396 | return TEST_FAILURE; |
4397 | } |
4398 | - |
4399 | -#ifdef __clang__ |
4400 | -# pragma GCC diagnostic pop |
4401 | -#endif |
4402 | +#pragma GCC diagnostic pop |
4403 | + |
4404 | +static test_return_t ASSERT_NOT_NULL_FAIL_TEST(void *) |
4405 | +{ |
4406 | + const char *valid_ptr= NULL; |
4407 | + try { |
4408 | + ASSERT_NOT_NULL(valid_ptr); |
4409 | + } |
4410 | + catch (const libtest::__failure& e) |
4411 | + { |
4412 | + return TEST_SUCCESS; |
4413 | + } |
4414 | + catch (...) |
4415 | + { |
4416 | + return TEST_FAILURE; |
4417 | + } |
4418 | + |
4419 | + return TEST_FAILURE; |
4420 | +} |
4421 | |
4422 | static test_return_t ASSERT_NEQ_FAIL_TEST(void *) |
4423 | { |
4424 | @@ -272,10 +303,14 @@ |
4425 | |
4426 | static test_return_t test_failure_test(void *) |
4427 | { |
4428 | - return TEST_SKIPPED; // Only run this when debugging |
4429 | - |
4430 | - ASSERT_EQ(1, 2); |
4431 | - return TEST_SUCCESS; |
4432 | + try { |
4433 | + ASSERT_EQ(1, 2); |
4434 | + } |
4435 | + catch (...) |
4436 | + { |
4437 | + return TEST_SUCCESS; |
4438 | + } |
4439 | + return TEST_FAILURE; |
4440 | } |
4441 | |
4442 | static test_return_t local_test(void *) |
4443 | @@ -296,6 +331,7 @@ |
4444 | { |
4445 | return TEST_SKIPPED; |
4446 | |
4447 | +#if 0 |
4448 | std::string temp; |
4449 | |
4450 | const char *ptr; |
4451 | @@ -323,6 +359,7 @@ |
4452 | } |
4453 | |
4454 | return TEST_SUCCESS; |
4455 | +#endif |
4456 | } |
4457 | |
4458 | static test_return_t var_exists_test(void *) |
4459 | @@ -618,7 +655,7 @@ |
4460 | true_app.will_fail(); |
4461 | |
4462 | const char *args[]= { "--fubar", 0 }; |
4463 | -#if defined(TARGET_OS_OSX) && TARGET_OS_OSX |
4464 | +#if defined(__APPLE__) && __APPLE__ |
4465 | ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); |
4466 | #elif defined(TARGET_OS_FREEBSD) && TARGET_OS_FREEBSD |
4467 | ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); |
4468 | @@ -878,8 +915,6 @@ |
4469 | { |
4470 | ASSERT_EQ(fatal_calls++, fatal::disabled_counter()); |
4471 | throw libtest::fatal(LIBYATL_DEFAULT_PARAM, "Testing va_args based fatal(): %d", 10); |
4472 | - |
4473 | - return TEST_SUCCESS; |
4474 | } |
4475 | |
4476 | static test_return_t number_of_cpus_TEST(void *) |
4477 | @@ -966,6 +1001,8 @@ |
4478 | return TEST_SUCCESS; |
4479 | } |
4480 | |
4481 | +#pragma GCC diagnostic push |
4482 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
4483 | static test_return_t check_for_gearman(void *) |
4484 | { |
4485 | test_skip(true, HAVE_LIBGEARMAN); |
4486 | @@ -988,9 +1025,14 @@ |
4487 | |
4488 | return TEST_SUCCESS; |
4489 | } |
4490 | +#pragma GCC diagnostic pop |
4491 | |
4492 | static test_return_t check_for_drizzle(void *) |
4493 | { |
4494 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
4495 | + SKIP_IF(HAVE_CYASSL); |
4496 | +#endif |
4497 | + |
4498 | test_skip(true, has_drizzled()); |
4499 | |
4500 | testing_service= "drizzled"; |
4501 | @@ -1027,6 +1069,10 @@ |
4502 | |
4503 | static test_return_t check_for_memcached(void* object) |
4504 | { |
4505 | +#if defined(HAVE_CYASSL) && HAVE_CYASSL |
4506 | + SKIP_IF(HAVE_CYASSL); |
4507 | +#endif |
4508 | + |
4509 | test_skip(true, has_memcached()); |
4510 | |
4511 | server_startup_st *servers= (server_startup_st*)object; |
4512 | @@ -1058,6 +1104,7 @@ |
4513 | {"VALGRIND_COMMAND", 0, VALGRIND_COMMAND_test }, |
4514 | {"HELGRIND_COMMAND", 0, HELGRIND_COMMAND_test }, |
4515 | {"GDB_COMMAND", 0, GDB_COMMAND_test }, |
4516 | + {"valgrind_is_caller()", 0, VALGRIND_CHECK_TEST }, |
4517 | {0, 0, 0} |
4518 | }; |
4519 | |
4520 | @@ -1074,6 +1121,7 @@ |
4521 | {"ASSERT_FALSE", false, ASSERT_FALSE_TEST }, |
4522 | {"ASSERT_NEQ", false, ASSERT_NEQ_TEST }, |
4523 | {"ASSERT_NEQ FAIL", false, ASSERT_NEQ_FAIL_TEST }, |
4524 | + {"ASSERT_NOT_NULL FAIL", false, ASSERT_NOT_NULL_FAIL_TEST }, |
4525 | {0, 0, 0} |
4526 | }; |
4527 | |
4528 | |
4529 | === modified file 'm4/ax_harden_compiler_flags.m4' |
4530 | --- m4/ax_harden_compiler_flags.m4 2013-04-29 14:58:26 +0000 |
4531 | +++ m4/ax_harden_compiler_flags.m4 2013-06-14 07:11:24 +0000 |
4532 | @@ -197,7 +197,7 @@ |
4533 | _APPEND_COMPILE_FLAGS_ERROR([-Wsizeof-pointer-memaccess]) |
4534 | _APPEND_COMPILE_FLAGS_ERROR([-Wpacked]) |
4535 | # _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) |
4536 | - _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) |
4537 | +# _APPEND_COMPILE_FLAGS_ERROR([-Wunreachable-code]) |
4538 | |
4539 | AS_IF([test "x$ax_enable_debug" = xno], |
4540 | [AS_IF([test "x$ac_cv_vcs_checkout" = xyes], |
4541 | |
4542 | === modified file 'm4/ax_prog_sphinx_build.m4' |
4543 | --- m4/ax_prog_sphinx_build.m4 2013-04-29 10:38:15 +0000 |
4544 | +++ m4/ax_prog_sphinx_build.m4 2013-06-14 07:11:24 +0000 |
4545 | @@ -19,26 +19,29 @@ |
4546 | # and this notice are preserved. This file is offered as-is, without any |
4547 | # warranty. |
4548 | |
4549 | -#serial 3 |
4550 | +#serial 4 |
4551 | |
4552 | AC_DEFUN([AX_PROG_SPHINX_BUILD], |
4553 | - [AX_WITH_PROG([SPHINXBUILD],[sphinx-build],[:]) |
4554 | - AS_IF([test x"SPHINXBUILD" = x":"], |
4555 | - [SPHINXBUILD=], |
4556 | - [AS_IF([test -x "$SPHINXBUILD"], |
4557 | - [AC_MSG_CHECKING([Checking to see if $SPHINXBUILD is recent]) |
4558 | - junk=`$SPHINXBUILD &> version_file` |
4559 | - ax_sphinx_build_version=`head -1 version_file` |
4560 | - rm version_file |
4561 | - AC_MSG_RESULT([$SPHINXBUILD is version "$ax_sphinx_build_version"]) |
4562 | - $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1 |
4563 | - AS_IF([test $? -eq 0], ,[SPHINXBUILD=]) |
4564 | - rm -rf conftest.d |
4565 | - ]) |
4566 | - ]) |
4567 | + [AX_WITH_PROG([SPHINXBUILD],[sphinx-build],[:]) |
4568 | + AS_IF([test x"SPHINXBUILD" = x":"], |
4569 | + [SPHINXBUILD=], |
4570 | + [AS_IF([test -x "$SPHINXBUILD"], |
4571 | + [AC_MSG_CHECKING([Checking to see if $SPHINXBUILD is recent]) |
4572 | + junk=`$SPHINXBUILD --version &> version_file` |
4573 | + AS_IF([test $? -eq 0], |
4574 | + [ax_sphinx_build_version=`head -1 version_file`], |
4575 | + [junk=`$SPHINXBUILD &> version_file` |
4576 | + ax_sphinx_build_version=`head -1 version_file` |
4577 | + rm version_file |
4578 | + AC_MSG_RESULT([$SPHINXBUILD is version "$ax_sphinx_build_version"]) |
4579 | + $SPHINXBUILD -Q -C -b man -d conftest.d . . >/dev/null 2>&1 |
4580 | + AS_IF([test $? -eq 0], ,[SPHINXBUILD=]) |
4581 | + rm -rf conftest.d ]) |
4582 | + ]) |
4583 | + ]) |
4584 | |
4585 | - AS_IF([test -n "${SPHINXBUILD}"], |
4586 | - [AC_SUBST([SPHINXBUILD]) |
4587 | - ifelse([$1], , :, [$1])], |
4588 | - [ifelse([$2], , :, [$2])]) |
4589 | - ]) |
4590 | + AS_IF([test -n "${SPHINXBUILD}"], |
4591 | + [AC_SUBST([SPHINXBUILD]) |
4592 | + ifelse([$1], , :, [$1])], |
4593 | + [ifelse([$2], , :, [$2])]) |
4594 | + ]) |
4595 | |
4596 | === modified file 'rpm/include.am' |
4597 | --- rpm/include.am 2012-12-04 23:19:34 +0000 |
4598 | +++ rpm/include.am 2013-06-14 07:11:24 +0000 |
4599 | @@ -1,6 +1,6 @@ |
4600 | # vim:ft=automake |
4601 | |
4602 | -rpm-build: support/$(PACKAGE).spec distcheck |
4603 | +rpm-build: support/$(PACKAGE).spec dist |
4604 | @rm -f *.rpm |
4605 | @rm -f ~/rpmbuild/RPMS/x86_64/$(PACKAGE)-$(VERSION)*.rpm |
4606 | @rm -f ~/rpmbuild/SRPMS/$(PACKAGE)-$(VERSION)*.rpm |
4607 | |
4608 | === modified file 'support/libmemcached.spec.in' |
4609 | --- support/libmemcached.spec.in 2013-04-03 13:14:23 +0000 |
4610 | +++ support/libmemcached.spec.in 2013-06-14 07:11:24 +0000 |
4611 | @@ -174,6 +174,7 @@ |
4612 | %{_includedir}/libmemcached-1.2/error.h |
4613 | %{_includedir}/libmemcached-1.2/exception.hpp |
4614 | %{_includedir}/libmemcached-1.2/exist.h |
4615 | +%{_includedir}/libmemcached-1.2/feature.h |
4616 | %{_includedir}/libmemcached-1.2/fetch.h |
4617 | %{_includedir}/libmemcached-1.2/flush.h |
4618 | %{_includedir}/libmemcached-1.2/flush_buffers.h |
4619 | |
4620 | === modified file 'tests/keys.hpp' |
4621 | --- tests/keys.hpp 2013-04-19 06:26:06 +0000 |
4622 | +++ tests/keys.hpp 2013-06-14 07:11:24 +0000 |
4623 | @@ -39,6 +39,8 @@ |
4624 | #include <uuid/uuid.h> |
4625 | #endif |
4626 | |
4627 | +#pragma GCC diagnostic push |
4628 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
4629 | struct keys_st { |
4630 | public: |
4631 | keys_st(size_t arg) |
4632 | @@ -143,3 +145,4 @@ |
4633 | libtest::vchar_ptr_t _keys; |
4634 | std::vector<size_t> _lengths; |
4635 | }; |
4636 | +#pragma GCC diagnostic pop |
4637 | |
4638 | === modified file 'tests/libmemcached-1.0/all_tests.cc' |
4639 | --- tests/libmemcached-1.0/all_tests.cc 2012-10-29 00:38:35 +0000 |
4640 | +++ tests/libmemcached-1.0/all_tests.cc 2013-06-14 07:11:24 +0000 |
4641 | @@ -83,7 +83,7 @@ |
4642 | { |
4643 | // Assume a minimum of 3, and a maximum of 8 |
4644 | world->servers().set_servers_to_run((libtest::number_of_cpus() > 3) ? |
4645 | - std::min(libtest::number_of_cpus(), size_t(8)) : 3); |
4646 | + std::min(libtest::number_of_cpus(), uint32_t(8)) : 3); |
4647 | } |
4648 | |
4649 | world->collections(collection); |
4650 | |
4651 | === modified file 'tests/libmemcached-1.0/generate.cc' |
4652 | --- tests/libmemcached-1.0/generate.cc 2013-04-03 13:14:23 +0000 |
4653 | +++ tests/libmemcached-1.0/generate.cc 2013-06-14 07:11:24 +0000 |
4654 | @@ -113,6 +113,8 @@ |
4655 | return TEST_SUCCESS; |
4656 | } |
4657 | |
4658 | +#pragma GCC diagnostic push |
4659 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
4660 | test_return_t generate_data_with_stats(memcached_st *memc) |
4661 | { |
4662 | test_compare(TEST_SUCCESS, generate_pairs(memc)); |
4663 | @@ -147,6 +149,7 @@ |
4664 | |
4665 | return TEST_SUCCESS; |
4666 | } |
4667 | +#pragma GCC diagnostic pop |
4668 | |
4669 | test_return_t generate_buffer_data(memcached_st *memc) |
4670 | { |
4671 | |
4672 | === modified file 'tests/libmemcached-1.0/pool.cc' |
4673 | --- tests/libmemcached-1.0/pool.cc 2013-04-03 13:14:23 +0000 |
4674 | +++ tests/libmemcached-1.0/pool.cc 2013-06-14 07:11:24 +0000 |
4675 | @@ -252,10 +252,12 @@ |
4676 | pthread_exit(arg); |
4677 | } |
4678 | |
4679 | +#pragma GCC diagnostic push |
4680 | +#pragma GCC diagnostic ignored "-Wunreachable-code" |
4681 | test_return_t connection_pool3_test(memcached_st *memc) |
4682 | { |
4683 | #ifdef __APPLE__ |
4684 | - return TEST_SKIPPED; |
4685 | + SKIP_IF(__APPLE__); |
4686 | #endif |
4687 | |
4688 | memcached_pool_st* pool= memcached_pool_create(memc, 1, 1); |
4689 | @@ -321,6 +323,7 @@ |
4690 | |
4691 | return TEST_SUCCESS; |
4692 | } |
4693 | +#pragma GCC diagnostic pop |
4694 | |
4695 | static memcached_st * create_single_instance_memcached(const memcached_st *original_memc, const char *options) |
4696 | { |
4697 | |
4698 | === modified file 'tests/libmemcached-1.0/sasl.cc' |
4699 | --- tests/libmemcached-1.0/sasl.cc 2013-04-20 09:51:38 +0000 |
4700 | +++ tests/libmemcached-1.0/sasl.cc 2013-06-14 07:11:24 +0000 |
4701 | @@ -64,28 +64,21 @@ |
4702 | */ |
4703 | static test_return_t sasl_auth_test(memcached_st *memc) |
4704 | { |
4705 | -#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT |
4706 | - if (LIBMEMCACHED_WITH_SASL_SUPPORT) |
4707 | - { |
4708 | - test_compare(MEMCACHED_SUCCESS, memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0)); |
4709 | - test_compare(MEMCACHED_SUCCESS, memcached_delete(memc, "foo", 3, 0)); |
4710 | - test_compare(MEMCACHED_SUCCESS, memcached_destroy_sasl_auth_data(memc)); |
4711 | - test_compare(MEMCACHED_SUCCESS, memcached_destroy_sasl_auth_data(memc)); |
4712 | - test_compare(MEMCACHED_INVALID_ARGUMENTS, memcached_destroy_sasl_auth_data(NULL)); |
4713 | - memcached_quit(memc); |
4714 | - |
4715 | - test_compare(MEMCACHED_AUTH_FAILURE, |
4716 | - memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0)); |
4717 | - test_compare(MEMCACHED_SUCCESS, memcached_destroy_sasl_auth_data(memc)); |
4718 | - |
4719 | - memcached_quit(memc); |
4720 | - return TEST_SUCCESS; |
4721 | - } |
4722 | -#else |
4723 | - (void)memc; |
4724 | -#endif |
4725 | - |
4726 | - return TEST_SKIPPED; |
4727 | + SKIP_IF(libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL)); |
4728 | + |
4729 | + test_compare(MEMCACHED_SUCCESS, memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0)); |
4730 | + test_compare(MEMCACHED_SUCCESS, memcached_delete(memc, "foo", 3, 0)); |
4731 | + test_compare(MEMCACHED_SUCCESS, memcached_destroy_sasl_auth_data(memc)); |
4732 | + test_compare(MEMCACHED_SUCCESS, memcached_destroy_sasl_auth_data(memc)); |
4733 | + test_compare(MEMCACHED_INVALID_ARGUMENTS, memcached_destroy_sasl_auth_data(NULL)); |
4734 | + memcached_quit(memc); |
4735 | + |
4736 | + test_compare(MEMCACHED_AUTH_FAILURE, |
4737 | + memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0)); |
4738 | + test_compare(MEMCACHED_SUCCESS, memcached_destroy_sasl_auth_data(memc)); |
4739 | + |
4740 | + memcached_quit(memc); |
4741 | + return TEST_SUCCESS; |
4742 | } |
4743 | |
4744 | |
4745 | |
4746 | === modified file 'tests/libmemcached_world.h' |
4747 | --- tests/libmemcached_world.h 2013-04-21 08:19:20 +0000 |
4748 | +++ tests/libmemcached_world.h 2013-06-14 07:11:24 +0000 |
4749 | @@ -47,7 +47,7 @@ |
4750 | |
4751 | if (servers.sasl()) |
4752 | { |
4753 | - SKIP_UNLESS(libtest::has_libmemcached_sasl()); |
4754 | + SKIP_UNLESS(libmemcached_has_feature(LIBMEMCACHED_FEATURE_HAS_SASL)); |
4755 | |
4756 | // Assume we are running under valgrind, and bail |
4757 | if (getenv("TESTS_ENVIRONMENT")) |
4758 | |
4759 | === modified file 'tests/memcp.cc' |
4760 | --- tests/memcp.cc 2013-05-04 09:20:42 +0000 |
4761 | +++ tests/memcp.cc 2013-06-14 07:11:24 +0000 |
4762 | @@ -66,7 +66,7 @@ |
4763 | static test_return_t server_test(void *) |
4764 | { |
4765 | int fd; |
4766 | - std::string tmp_file= create_tmpfile("memcp", fd); |
4767 | + std::string tmp_file= libtest::create_tmpfile("memcp", fd); |
4768 | ASSERT_TRUE(tmp_file.c_str()); |
4769 | struct stat buf; |
4770 | ASSERT_EQ(fstat(fd, &buf), 0); |
4771 | |
4772 | === modified file 'version.m4' |
4773 | --- version.m4 2013-05-04 11:12:31 +0000 |
4774 | +++ version.m4 2013-06-14 07:11:24 +0000 |
4775 | @@ -1,1 +1,1 @@ |
4776 | -m4_define([VERSION_NUMBER], [1.1.0-dev]) |
4777 | +m4_define([VERSION_NUMBER], [1.1.0]) |