#!/bin/sh
-autoreconf -ivf -Wall
+autoreconf --install --force --verbose -Wall
HASHKIT_LIBRARY_VERSION=1:0:0
AC_SUBST(HASHKIT_LIBRARY_VERSION)
-LT_INIT
+LT_PREREQ([2.2])
+LT_INIT()
+LT_LANG([C++])
+LT_LANG([C])
+gl_VISIBILITY
+
m4_include([m4/memcached.m4])
m4_include([m4/memcached_sasl.m4])
m4_include([m4/gearmand.m4])
esac
dnl Specialty checks
-ACX_PTHREAD
+AX_PTHREAD
CONFIG_EXTRA
DETECT_BYTEORDER
ENABLE_UTILLIB
* @brief HashKit Header
*/
-#ifndef HASHKIT_ALGORITHM_H
-#define HASHKIT_ALGORITHM_H
+#pragma once
#ifdef __cplusplus
extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* HASHKIT_ALGORITHM_H */
* @brief HashKit Header
*/
-#ifndef HASHKIT_BEHAVIOR_H
-#define HASHKIT_BEHAVIOR_H
+#pragma once
#ifdef __cplusplus
extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* HASHKIT_BEHAVIOR_H */
* Use and distribution licensed under the BSD license. See
* the COPYING file in the parent directory for full text.
*/
-#ifndef LIBHASHKIT_CONFIGURE_H
-#define LIBHASHKIT_CONFIGURE_H
+
+#pragma once
#ifdef __cplusplus
extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* LIBHASHKIT_CONFIGURE_H */
* the COPYING file in the parent directory for full text.
*/
-#ifndef HASHKIT_DIGEST_H
-#define HASHKIT_DIGEST_H
+#pragma once
#ifdef __cplusplus
extern "C" {
#ifdef __cplusplus
}
#endif
-
-#endif /* HASHKIT_DIGEST_H */
libhashkit_libhashkit_la_SOURCES+= libhashkit/murmur.cc
endif
-libhashkit_libhashkit_la_CPPFLAGS= \
- ${AM_CPPFLAGS} \
- -DBUILDING_HASHKIT
+libhashkit_libhashkit_la_CPPFLAGS= -DBUILDING_HASHKIT
-libhashkit_libhashkit_la_CFLAGS= \
- ${AM_CFLAGS} \
- -DBUILDING_HASHKIT
+libhashkit_libhashkit_la_CFLAGS= -DBUILDING_HASHKIT
-libhashkit_libhashkit_la_CXXFLAGS= \
- ${AM_CXXFLAGS} \
- -DBUILDING_HASHKIT
+libhashkit_libhashkit_la_CXXFLAGS= -DBUILDING_HASHKIT
libhashkit_libhashkit_la_LDFLAGS= \
$(LIBM) \
#endif
LIBMEMCACHED_LOCAL
-memcached_array_st *memcached_array_clone(memcached_st *memc, const memcached_array_st *original);
+memcached_array_st *memcached_array_clone(struct memcached_st *memc, const memcached_array_st *original);
LIBMEMCACHED_LOCAL
-memcached_array_st *memcached_strcpy(memcached_st *memc, const char *str, size_t str_length);
+memcached_array_st *memcached_strcpy(struct memcached_st *memc, const char *str, size_t str_length);
LIBMEMCACHED_LOCAL
void memcached_array_free(memcached_array_st *array);
#include <libmemcached/common.h>
#include <sys/types.h>
+#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
+#endif
/*
These functions provide data and function callback support
#include <libmemcached/csl/symbol.h>
#include <libmemcached/csl/scanner.h>
+#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wold-style-cast"
+#endif
int conf_lex(YYSTYPE* lvalp, void* scanner);
/* Line 189 of yacc.c */
-#line 118 "libmemcached/csl/parser.cc"
+#line 120 "libmemcached/csl/parser.cc"
/* Enabling traces. */
#ifndef YYDEBUG
/* Line 264 of yacc.c */
-#line 230 "libmemcached/csl/parser.cc"
+#line 232 "libmemcached/csl/parser.cc"
#ifdef short
# undef short
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 170, 170, 171, 175, 177, 179, 181, 186, 191,
- 195, 199, 210, 218, 226, 233, 237, 241, 245, 249,
- 256, 263, 274, 281, 288, 295, 301, 305, 309, 313,
- 317, 321, 325, 329, 333, 337, 341, 345, 352, 356,
- 360, 364, 368, 372, 376, 380, 384, 388, 392, 396,
- 403, 404, 409, 410, 415, 419, 423, 427, 431, 435,
- 439, 443, 447, 454, 458, 465, 469, 473
+ 0, 172, 172, 173, 177, 179, 181, 183, 188, 193,
+ 197, 201, 212, 220, 228, 235, 239, 243, 247, 251,
+ 258, 265, 276, 283, 290, 297, 303, 307, 311, 315,
+ 319, 323, 327, 331, 335, 339, 343, 347, 354, 358,
+ 362, 366, 370, 374, 378, 382, 386, 390, 394, 398,
+ 405, 406, 411, 412, 417, 421, 425, 429, 433, 437,
+ 441, 445, 449, 456, 460, 467, 471, 475
};
#endif
case 4:
/* Line 1464 of yacc.c */
-#line 176 "libmemcached/csl/parser.yy"
+#line 178 "libmemcached/csl/parser.yy"
{ ;}
break;
case 5:
/* Line 1464 of yacc.c */
-#line 178 "libmemcached/csl/parser.yy"
+#line 180 "libmemcached/csl/parser.yy"
{ ;}
break;
case 6:
/* Line 1464 of yacc.c */
-#line 180 "libmemcached/csl/parser.yy"
+#line 182 "libmemcached/csl/parser.yy"
{ ;}
break;
case 7:
/* Line 1464 of yacc.c */
-#line 182 "libmemcached/csl/parser.yy"
+#line 184 "libmemcached/csl/parser.yy"
{
context->set_end();
YYACCEPT;
case 8:
/* Line 1464 of yacc.c */
-#line 187 "libmemcached/csl/parser.yy"
+#line 189 "libmemcached/csl/parser.yy"
{
context->rc= MEMCACHED_PARSE_USER_ERROR;
parser_abort(context, NULL);
case 9:
/* Line 1464 of yacc.c */
-#line 192 "libmemcached/csl/parser.yy"
+#line 194 "libmemcached/csl/parser.yy"
{
memcached_reset(context->memc);
;}
case 10:
/* Line 1464 of yacc.c */
-#line 196 "libmemcached/csl/parser.yy"
+#line 198 "libmemcached/csl/parser.yy"
{
yydebug= 1;
;}
case 11:
/* Line 1464 of yacc.c */
-#line 200 "libmemcached/csl/parser.yy"
+#line 202 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_parse_configure_file(*context->memc, (yyvsp[(3) - (3)].string).c_str, (yyvsp[(3) - (3)].string).size)) != MEMCACHED_SUCCESS)
{
case 12:
/* Line 1464 of yacc.c */
-#line 211 "libmemcached/csl/parser.yy"
+#line 213 "libmemcached/csl/parser.yy"
{
if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number))))
{
case 13:
/* Line 1464 of yacc.c */
-#line 219 "libmemcached/csl/parser.yy"
+#line 221 "libmemcached/csl/parser.yy"
{
if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number))))
{
case 14:
/* Line 1464 of yacc.c */
-#line 227 "libmemcached/csl/parser.yy"
+#line 229 "libmemcached/csl/parser.yy"
{
if (memcached_failed(context->rc= memcached_server_add_unix_socket_with_weight(context->memc, (yyvsp[(2) - (3)].string).c_str, (yyvsp[(3) - (3)].number))))
{
case 15:
/* Line 1464 of yacc.c */
-#line 234 "libmemcached/csl/parser.yy"
+#line 236 "libmemcached/csl/parser.yy"
{
memcached_set_configuration_file(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size);
;}
case 16:
/* Line 1464 of yacc.c */
-#line 238 "libmemcached/csl/parser.yy"
+#line 240 "libmemcached/csl/parser.yy"
{
context->memc->configure.initial_pool_size= (yyvsp[(2) - (2)].number);
;}
case 17:
/* Line 1464 of yacc.c */
-#line 242 "libmemcached/csl/parser.yy"
+#line 244 "libmemcached/csl/parser.yy"
{
context->memc->configure.max_pool_size= (yyvsp[(2) - (2)].number);
;}
case 19:
/* Line 1464 of yacc.c */
-#line 250 "libmemcached/csl/parser.yy"
+#line 252 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_set_namespace(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size)) != MEMCACHED_SUCCESS)
{
case 20:
/* Line 1464 of yacc.c */
-#line 257 "libmemcached/csl/parser.yy"
+#line 259 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (2)].distribution))) != MEMCACHED_SUCCESS)
{
case 21:
/* Line 1464 of yacc.c */
-#line 264 "libmemcached/csl/parser.yy"
+#line 266 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, (yyvsp[(2) - (4)].distribution))) != MEMCACHED_SUCCESS)
{
case 22:
/* Line 1464 of yacc.c */
-#line 275 "libmemcached/csl/parser.yy"
+#line 277 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, MEMCACHED_BEHAVIOR_HASH, (yyvsp[(2) - (2)].hash))) != MEMCACHED_SUCCESS)
{
case 23:
/* Line 1464 of yacc.c */
-#line 282 "libmemcached/csl/parser.yy"
+#line 284 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (2)].behavior), (yyvsp[(2) - (2)].number))) != MEMCACHED_SUCCESS)
{
case 24:
/* Line 1464 of yacc.c */
-#line 289 "libmemcached/csl/parser.yy"
+#line 291 "libmemcached/csl/parser.yy"
{
if ((context->rc= memcached_behavior_set(context->memc, (yyvsp[(1) - (1)].behavior), true)) != MEMCACHED_SUCCESS)
{
case 25:
/* Line 1464 of yacc.c */
-#line 296 "libmemcached/csl/parser.yy"
+#line 298 "libmemcached/csl/parser.yy"
{
;}
break;
case 26:
/* Line 1464 of yacc.c */
-#line 302 "libmemcached/csl/parser.yy"
+#line 304 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS;
;}
case 27:
/* Line 1464 of yacc.c */
-#line 306 "libmemcached/csl/parser.yy"
+#line 308 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT;
;}
case 28:
/* Line 1464 of yacc.c */
-#line 310 "libmemcached/csl/parser.yy"
+#line 312 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK;
;}
case 29:
/* Line 1464 of yacc.c */
-#line 314 "libmemcached/csl/parser.yy"
+#line 316 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_BYTES_WATERMARK;
;}
case 30:
/* Line 1464 of yacc.c */
-#line 318 "libmemcached/csl/parser.yy"
+#line 320 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH;
;}
case 31:
/* Line 1464 of yacc.c */
-#line 322 "libmemcached/csl/parser.yy"
+#line 324 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS;
;}
case 32:
/* Line 1464 of yacc.c */
-#line 326 "libmemcached/csl/parser.yy"
+#line 328 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_POLL_TIMEOUT;
;}
case 33:
/* Line 1464 of yacc.c */
-#line 330 "libmemcached/csl/parser.yy"
+#line 332 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RCV_TIMEOUT;
;}
case 34:
/* Line 1464 of yacc.c */
-#line 334 "libmemcached/csl/parser.yy"
+#line 336 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RETRY_TIMEOUT;
;}
case 35:
/* Line 1464 of yacc.c */
-#line 338 "libmemcached/csl/parser.yy"
+#line 340 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SND_TIMEOUT;
;}
case 36:
/* Line 1464 of yacc.c */
-#line 342 "libmemcached/csl/parser.yy"
+#line 344 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE;
;}
case 37:
/* Line 1464 of yacc.c */
-#line 346 "libmemcached/csl/parser.yy"
+#line 348 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE;
;}
case 38:
/* Line 1464 of yacc.c */
-#line 353 "libmemcached/csl/parser.yy"
+#line 355 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_BINARY_PROTOCOL;
;}
case 39:
/* Line 1464 of yacc.c */
-#line 357 "libmemcached/csl/parser.yy"
+#line 359 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_BUFFER_REQUESTS;
;}
case 40:
/* Line 1464 of yacc.c */
-#line 361 "libmemcached/csl/parser.yy"
+#line 363 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY;
;}
case 41:
/* Line 1464 of yacc.c */
-#line 365 "libmemcached/csl/parser.yy"
+#line 367 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_NOREPLY;
;}
case 42:
/* Line 1464 of yacc.c */
-#line 369 "libmemcached/csl/parser.yy"
+#line 371 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ;
;}
case 43:
/* Line 1464 of yacc.c */
-#line 373 "libmemcached/csl/parser.yy"
+#line 375 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SORT_HOSTS;
;}
case 44:
/* Line 1464 of yacc.c */
-#line 377 "libmemcached/csl/parser.yy"
+#line 379 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_SUPPORT_CAS;
;}
case 45:
/* Line 1464 of yacc.c */
-#line 381 "libmemcached/csl/parser.yy"
+#line 383 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_NODELAY;
;}
case 46:
/* Line 1464 of yacc.c */
-#line 385 "libmemcached/csl/parser.yy"
+#line 387 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPALIVE;
;}
case 47:
/* Line 1464 of yacc.c */
-#line 389 "libmemcached/csl/parser.yy"
+#line 391 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_TCP_KEEPIDLE;
;}
case 48:
/* Line 1464 of yacc.c */
-#line 393 "libmemcached/csl/parser.yy"
+#line 395 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_USE_UDP;
;}
case 49:
/* Line 1464 of yacc.c */
-#line 397 "libmemcached/csl/parser.yy"
+#line 399 "libmemcached/csl/parser.yy"
{
(yyval.behavior)= MEMCACHED_BEHAVIOR_VERIFY_KEY;
;}
case 50:
/* Line 1464 of yacc.c */
-#line 403 "libmemcached/csl/parser.yy"
+#line 405 "libmemcached/csl/parser.yy"
{ (yyval.number)= MEMCACHED_DEFAULT_PORT;;}
break;
case 51:
/* Line 1464 of yacc.c */
-#line 405 "libmemcached/csl/parser.yy"
+#line 407 "libmemcached/csl/parser.yy"
{ ;}
break;
case 52:
/* Line 1464 of yacc.c */
-#line 409 "libmemcached/csl/parser.yy"
+#line 411 "libmemcached/csl/parser.yy"
{ (yyval.number)= 1; ;}
break;
case 53:
/* Line 1464 of yacc.c */
-#line 411 "libmemcached/csl/parser.yy"
+#line 413 "libmemcached/csl/parser.yy"
{ ;}
break;
case 54:
/* Line 1464 of yacc.c */
-#line 416 "libmemcached/csl/parser.yy"
+#line 418 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_MD5;
;}
case 55:
/* Line 1464 of yacc.c */
-#line 420 "libmemcached/csl/parser.yy"
+#line 422 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_CRC;
;}
case 56:
/* Line 1464 of yacc.c */
-#line 424 "libmemcached/csl/parser.yy"
+#line 426 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1_64;
;}
case 57:
/* Line 1464 of yacc.c */
-#line 428 "libmemcached/csl/parser.yy"
+#line 430 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1A_64;
;}
case 58:
/* Line 1464 of yacc.c */
-#line 432 "libmemcached/csl/parser.yy"
+#line 434 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1_32;
;}
case 59:
/* Line 1464 of yacc.c */
-#line 436 "libmemcached/csl/parser.yy"
+#line 438 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_FNV1A_32;
;}
case 60:
/* Line 1464 of yacc.c */
-#line 440 "libmemcached/csl/parser.yy"
+#line 442 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_HSIEH;
;}
case 61:
/* Line 1464 of yacc.c */
-#line 444 "libmemcached/csl/parser.yy"
+#line 446 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_MURMUR;
;}
case 62:
/* Line 1464 of yacc.c */
-#line 448 "libmemcached/csl/parser.yy"
+#line 450 "libmemcached/csl/parser.yy"
{
(yyval.hash)= MEMCACHED_HASH_JENKINS;
;}
case 63:
/* Line 1464 of yacc.c */
-#line 455 "libmemcached/csl/parser.yy"
+#line 457 "libmemcached/csl/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
;}
case 64:
/* Line 1464 of yacc.c */
-#line 459 "libmemcached/csl/parser.yy"
+#line 461 "libmemcached/csl/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
;}
case 65:
/* Line 1464 of yacc.c */
-#line 466 "libmemcached/csl/parser.yy"
+#line 468 "libmemcached/csl/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_CONSISTENT;
;}
case 66:
/* Line 1464 of yacc.c */
-#line 470 "libmemcached/csl/parser.yy"
+#line 472 "libmemcached/csl/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_MODULA;
;}
case 67:
/* Line 1464 of yacc.c */
-#line 474 "libmemcached/csl/parser.yy"
+#line 476 "libmemcached/csl/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_RANDOM;
;}
/* Line 1464 of yacc.c */
-#line 2127 "libmemcached/csl/parser.cc"
+#line 2129 "libmemcached/csl/parser.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
/* Line 1684 of yacc.c */
-#line 479 "libmemcached/csl/parser.yy"
+#line 481 "libmemcached/csl/parser.yy"
void Context::start()
#include <libmemcached/csl/parser.h>
#include <libmemcached/csl/symbol.h>
+#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
#define YY_EXTRA_TYPE Context*
-#line 19 "libmemcached/csl/scanner.cc"
+#line 21 "libmemcached/csl/scanner.cc"
#define YY_INT_ALIGNED short int
static yyconst flex_int16_t yy_rule_linenum[65] =
{ 0,
- 77, 79, 81, 83, 85, 88, 92, 94, 96, 97,
- 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
- 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
- 118, 119, 120, 121, 122, 123, 125, 126, 128, 130,
- 131, 132, 133, 134, 135, 137, 138, 141, 146, 147,
- 148, 150, 151, 152, 153, 154, 155, 156, 157, 158,
- 160, 169, 187, 194
+ 79, 81, 83, 85, 87, 90, 94, 96, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 127, 128, 130, 132,
+ 133, 134, 135, 136, 137, 139, 140, 143, 148, 149,
+ 150, 152, 153, 154, 155, 156, 157, 158, 159, 160,
+ 162, 171, 189, 196
} ;
/* The intent behind this definition is that it'll catch
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#line 38 "libmemcached/csl/scanner.l"
+#line 40 "libmemcached/csl/scanner.l"
#include <cstdlib>
#include <cstring>
#define YY_INPUT(buffer, result, max_size) get_lex_chars(buffer, result, max_size, PARAM)
-#line 1154 "libmemcached/csl/scanner.cc"
+#line 1156 "libmemcached/csl/scanner.cc"
#define INITIAL 0
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* %% [7.0] user's declarations go here */
-#line 74 "libmemcached/csl/scanner.l"
+#line 76 "libmemcached/csl/scanner.l"
-#line 1461 "libmemcached/csl/scanner.cc"
+#line 1463 "libmemcached/csl/scanner.cc"
yylval = yylval_param;
case 1:
YY_RULE_SETUP
-#line 77 "libmemcached/csl/scanner.l"
+#line 79 "libmemcached/csl/scanner.l"
{ return yytext[0];}
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 79 "libmemcached/csl/scanner.l"
+#line 81 "libmemcached/csl/scanner.l"
{ yylval->number= atoi(yytext); return (NUMBER); }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 81 "libmemcached/csl/scanner.l"
+#line 83 "libmemcached/csl/scanner.l"
{ yylval->number= atoi(yytext +1); return PORT; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 83 "libmemcached/csl/scanner.l"
+#line 85 "libmemcached/csl/scanner.l"
{ yylval->number= atoi(yytext +2); return WEIGHT_START; }
YY_BREAK
case 5:
/* rule 5 can match eol */
YY_RULE_SETUP
-#line 85 "libmemcached/csl/scanner.l"
+#line 87 "libmemcached/csl/scanner.l"
; /* skip whitespace */
YY_BREAK
case 6:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 88 "libmemcached/csl/scanner.l"
+#line 90 "libmemcached/csl/scanner.l"
{
return COMMENT;
}
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 92 "libmemcached/csl/scanner.l"
+#line 94 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; yyextra->set_server(); return yyextra->previous_token= SERVER; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 94 "libmemcached/csl/scanner.l"
+#line 96 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= SOCKET; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 96 "libmemcached/csl/scanner.l"
+#line 98 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= BINARY_PROTOCOL; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 97 "libmemcached/csl/scanner.l"
+#line 99 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= BUFFER_REQUESTS; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 98 "libmemcached/csl/scanner.l"
+#line 100 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= CONFIGURE_FILE; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 99 "libmemcached/csl/scanner.l"
+#line 101 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= CONNECT_TIMEOUT; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 100 "libmemcached/csl/scanner.l"
+#line 102 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= DISTRIBUTION; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 101 "libmemcached/csl/scanner.l"
+#line 103 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= HASH_WITH_NAMESPACE; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 102 "libmemcached/csl/scanner.l"
+#line 104 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= HASH; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 103 "libmemcached/csl/scanner.l"
+#line 105 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= IO_BYTES_WATERMARK; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 104 "libmemcached/csl/scanner.l"
+#line 106 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= IO_KEY_PREFETCH; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 105 "libmemcached/csl/scanner.l"
+#line 107 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= IO_MSG_WATERMARK; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 106 "libmemcached/csl/scanner.l"
+#line 108 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= NOREPLY; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 107 "libmemcached/csl/scanner.l"
+#line 109 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= NUMBER_OF_REPLICAS; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 108 "libmemcached/csl/scanner.l"
+#line 110 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= POLL_TIMEOUT; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 109 "libmemcached/csl/scanner.l"
+#line 111 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= RANDOMIZE_REPLICA_READ; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 110 "libmemcached/csl/scanner.l"
+#line 112 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= RCV_TIMEOUT; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 111 "libmemcached/csl/scanner.l"
+#line 113 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= REMOVE_FAILED_SERVERS; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 112 "libmemcached/csl/scanner.l"
+#line 114 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= RETRY_TIMEOUT; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 113 "libmemcached/csl/scanner.l"
+#line 115 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= SND_TIMEOUT; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 114 "libmemcached/csl/scanner.l"
+#line 116 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= SOCKET_RECV_SIZE; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 115 "libmemcached/csl/scanner.l"
+#line 117 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= SOCKET_SEND_SIZE; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 116 "libmemcached/csl/scanner.l"
+#line 118 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= SORT_HOSTS; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 117 "libmemcached/csl/scanner.l"
+#line 119 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= SUPPORT_CAS; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 118 "libmemcached/csl/scanner.l"
+#line 120 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= _TCP_KEEPALIVE; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 119 "libmemcached/csl/scanner.l"
+#line 121 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= _TCP_KEEPIDLE; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 120 "libmemcached/csl/scanner.l"
+#line 122 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= _TCP_NODELAY; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 121 "libmemcached/csl/scanner.l"
+#line 123 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= USE_UDP; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 122 "libmemcached/csl/scanner.l"
+#line 124 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= USER_DATA; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 123 "libmemcached/csl/scanner.l"
+#line 125 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= VERIFY_KEY; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 125 "libmemcached/csl/scanner.l"
+#line 127 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= POOL_MIN; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 126 "libmemcached/csl/scanner.l"
+#line 128 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= POOL_MAX; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 128 "libmemcached/csl/scanner.l"
+#line 130 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= NAMESPACE; }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 130 "libmemcached/csl/scanner.l"
+#line 132 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= INCLUDE; }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 131 "libmemcached/csl/scanner.l"
+#line 133 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= RESET; }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 132 "libmemcached/csl/scanner.l"
+#line 134 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= PARSER_DEBUG; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 133 "libmemcached/csl/scanner.l"
+#line 135 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= SERVERS; }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 134 "libmemcached/csl/scanner.l"
+#line 136 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= END; }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 135 "libmemcached/csl/scanner.l"
+#line 137 "libmemcached/csl/scanner.l"
{ yyextra->begin= yytext; return yyextra->previous_token= ERROR; }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 137 "libmemcached/csl/scanner.l"
+#line 139 "libmemcached/csl/scanner.l"
{ return yyextra->previous_token= TRUE; }
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 138 "libmemcached/csl/scanner.l"
+#line 140 "libmemcached/csl/scanner.l"
{ return yyextra->previous_token= FALSE; }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 141 "libmemcached/csl/scanner.l"
+#line 143 "libmemcached/csl/scanner.l"
{
yyextra->begin= yytext;
return UNKNOWN_OPTION;
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 146 "libmemcached/csl/scanner.l"
+#line 148 "libmemcached/csl/scanner.l"
{ return CONSISTENT; }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 147 "libmemcached/csl/scanner.l"
+#line 149 "libmemcached/csl/scanner.l"
{ return MODULA; }
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 148 "libmemcached/csl/scanner.l"
+#line 150 "libmemcached/csl/scanner.l"
{ return RANDOM; }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 150 "libmemcached/csl/scanner.l"
+#line 152 "libmemcached/csl/scanner.l"
{ return MD5; }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 151 "libmemcached/csl/scanner.l"
+#line 153 "libmemcached/csl/scanner.l"
{ return CRC; }
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 152 "libmemcached/csl/scanner.l"
+#line 154 "libmemcached/csl/scanner.l"
{ return FNV1_64; }
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 153 "libmemcached/csl/scanner.l"
+#line 155 "libmemcached/csl/scanner.l"
{ return FNV1A_64; }
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 154 "libmemcached/csl/scanner.l"
+#line 156 "libmemcached/csl/scanner.l"
{ return FNV1_32; }
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 155 "libmemcached/csl/scanner.l"
+#line 157 "libmemcached/csl/scanner.l"
{ return FNV1A_32; }
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 156 "libmemcached/csl/scanner.l"
+#line 158 "libmemcached/csl/scanner.l"
{ return HSIEH; }
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 157 "libmemcached/csl/scanner.l"
+#line 159 "libmemcached/csl/scanner.l"
{ return MURMUR; }
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 158 "libmemcached/csl/scanner.l"
+#line 160 "libmemcached/csl/scanner.l"
{ return JENKINS; }
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 160 "libmemcached/csl/scanner.l"
+#line 162 "libmemcached/csl/scanner.l"
{
yylval->server.port= MEMCACHED_DEFAULT_PORT;
yylval->server.weight= 1;
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 169 "libmemcached/csl/scanner.l"
+#line 171 "libmemcached/csl/scanner.l"
{
if (yyextra->is_server())
{
case 63:
/* rule 63 can match eol */
YY_RULE_SETUP
-#line 187 "libmemcached/csl/scanner.l"
+#line 189 "libmemcached/csl/scanner.l"
{
config_get_text(yyscanner)[yyleng -1]= 0;
yylval->string.c_str= yytext +1;
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 194 "libmemcached/csl/scanner.l"
+#line 196 "libmemcached/csl/scanner.l"
{
yyextra->begin= yytext;
return UNKNOWN;
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 199 "libmemcached/csl/scanner.l"
+#line 201 "libmemcached/csl/scanner.l"
ECHO;
YY_BREAK
-#line 1944 "libmemcached/csl/scanner.cc"
+#line 1946 "libmemcached/csl/scanner.cc"
case YY_STATE_EOF(INITIAL):
yyterminate();
/* %ok-for-header */
-#line 199 "libmemcached/csl/scanner.l"
+#line 201 "libmemcached/csl/scanner.l"
#include <libmemcached/csl/parser.h>
#include <libmemcached/csl/symbol.h>
+#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-parameter"
+#endif
#define YY_EXTRA_TYPE Context*
-#line 23 "libmemcached/csl/scanner.h"
+#line 25 "libmemcached/csl/scanner.h"
#define YY_INT_ALIGNED short int
#undef YY_DECL
#endif
-#line 199 "libmemcached/csl/scanner.l"
+#line 201 "libmemcached/csl/scanner.l"
-#line 478 "libmemcached/csl/scanner.h"
+#line 480 "libmemcached/csl/scanner.h"
#undef config_IN_HEADER
#endif /* config_HEADER_H */
libmemcached/watchpoint.h
lib_LTLIBRARIES+= libmemcached/libmemcached.la
-libmemcached_libmemcached_la_CFLAGS= \
- ${AM_CFLAGS} \
- ${NO_CONVERSION} \
- -DBUILDING_LIBMEMCACHED
+libmemcached_libmemcached_la_CFLAGS= -DBUILDING_LIBMEMCACHED
-libmemcached_libmemcached_la_CXXFLAGS= \
- ${AM_CXXFLAGS} \
- ${NO_CONVERSION} \
- -DBUILDING_LIBMEMCACHED
+libmemcached_libmemcached_la_CXXFLAGS= -DBUILDING_LIBMEMCACHED
libmemcached_libmemcached_la_SOURCES+= \
${libhashkit_libhashkit_la_SOURCES} \
libmemcached_libmemcached_la_DEPENDENCIES=
libmemcached_libmemcached_la_LIBADD= $(LIBM)
-libmemcached_libmemcached_la_LDFLAGS+= ${AM_LDFLAGS} -version-info ${MEMCACHED_LIBRARY_VERSION}
+libmemcached_libmemcached_la_LDFLAGS+= -version-info ${MEMCACHED_LIBRARY_VERSION}
libmemcached_libmemcached_la_LIBADD+= $(LTLIBSASL) $(LTLIBSASL2)
libmemcached_libmemcached_la_SOURCES += libmemcached/sasl.cc
#include <libtest/common.h>
#include <libtest/blobslap_worker.h>
-#include <libtest/killpid.h>
-
-using namespace libtest;
#include <cassert>
#include <cerrno>
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
-using namespace libtest;
+namespace libtest {
class BlobslapWorker : public Server
{
return true;
}
-namespace libtest {
-
Server *build_blobslap_worker(in_port_t try_port)
{
return new BlobslapWorker(try_port);
}
-}
+} // namespace libtest
#include <fnmatch.h>
#endif
-static inline bool is_pid_valid(const pid_t pid)
-{
- return (pid > 1) ? true : false;
-}
+#include <libtest/test.hpp>
+
+#include <libtest/is_pid.hpp>
#include <libtest/gearmand.h>
#include <libtest/blobslap_worker.h>
#include <libtest/libtool.hpp>
#include <libtest/killpid.h>
+#include <libtest/stats.h>
+#include <libtest/signal.h>
-#include <libtest/test.hpp>
#pragma once
#include <typeinfo>
-#include <libtest/strerror.h>
#if defined(HAVE_LIBMEMCACHED) && HAVE_LIBMEMCACHED
#include <libmemcached/memcached.h>
namespace libtest {
template <class T_comparable, class T_hint>
-bool _compare_true_hint(const char *file, int line, const char *func, T_comparable __expected, const char *assertation_label, T_hint __hint)
+bool _compare_truth_hint(const char *file, int line, const char *func, T_comparable __expected, const char *assertation_label, T_hint __hint)
{
if (__expected == false)
{
return true;
}
+template <class T_comparable>
+bool _truth(const char *file, int line, const char *func, T_comparable __truth)
+{
+ if (bool(__truth))
+ {
+ libtest::stream::make_cerr(file, line, func) << "Assertion failed for " << func << "() with \"" << __truth << "\"";
+ return false;
+ }
+
+ return true;
+}
+
template <class T_comparable, class T_hint>
bool _compare_hint(const char *file, int line, const char *func, T_comparable __expected, T_comparable __actual, T_hint __hint)
{
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * libtest
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <libtest/common.h>
+
+
+namespace libtest {
+
+void create_core(void)
+{
+ if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL)
+ {
+ pid_t pid= fork();
+
+ if (pid == 0)
+ {
+ abort();
+ }
+ else
+ {
+ while (waitpid(pid, NULL, 0) != pid) {};
+ }
+ }
+}
+
+} // namespace libtest
#pragma once
+namespace libtest {
+
LIBTEST_API
void create_core(void);
+
+} // namespace libtest
};
-#define test_failed(__test_return_t) ((__test_return_t) != TEST_SUCCESS)
-#define test_success(__test_return_t) ((__test_return_t) == TEST_SUCCESS)
+static inline bool test_success(test_return_t rc)
+{
+ return (rc == TEST_SUCCESS);
+}
+
+static inline bool test_failed(test_return_t rc)
+{
+ return (rc != TEST_SUCCESS);
+}
-rm -rf tmp_chroot
noinst_HEADERS+= \
+ libtest/binaries.h \
libtest/blobslap_worker.h \
libtest/callbacks.h \
libtest/cmdline.h \
libtest/framework.h \
libtest/gearmand.h \
libtest/get.h \
+ libtest/is_pid.hpp \
+ libtest/is_local.hpp \
libtest/killpid.h \
libtest/libtool.hpp \
libtest/memcached.h \
libtest/server.h \
libtest/server_container.h \
libtest/signal.h \
+ libtest/socket.hpp \
libtest/stats.h \
libtest/stream.h \
libtest/strerror.h \
libtest_libtest_la_SOURCES= \
libtest/binaries.cc \
libtest/cmdline.cc \
+ libtest/core.cc \
libtest/framework.cc \
+ libtest/is_local.cc \
libtest/killpid.cc \
libtest/libtool.cc \
libtest/port.cc \
libtest/server.cc \
libtest/server_container.cc \
libtest/signal.cc \
+ libtest/socket.cc \
+ libtest/strerror.cc \
libtest/test.cc
libtest_libtest_la_CXXFLAGS= ${AM_CXXFLAGS}
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * libtest
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <libtest/common.h>
+
+
+namespace libtest {
+
+bool test_is_local()
+{
+ return (getenv("LIBTEST_LOCAL"));
+}
+
+} // namespace libtest
+
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * libtest
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+namespace libtest {
+
+LIBTEST_API
+bool test_is_local();
+
+} // namespace libtest
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * libtest
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+static inline bool is_pid_valid(const pid_t pid)
+{
+ return (pid > 1) ? true : false;
+}
+
static in_port_t global_port= 0;
static in_port_t global_max_port= 0;
+namespace libtest {
+
in_port_t default_port()
{
return global_port;
global_max_port= port;
}
+
+} // namespace libtest
#pragma once
+namespace libtest {
+
LIBTEST_API
in_port_t default_port();
LIBTEST_API
void set_max_port(in_port_t port);
+
+} // namespace libtest
#include <pthread.h>
#include <semaphore.h>
+#include <signal.h>
enum shutdown_t {
SHUTDOWN_RUNNING,
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * libtest
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <libtest/common.h>
+
+static char global_socket[1024];
+
+namespace libtest {
+
+const char *default_socket()
+{
+ assert(global_socket[0]);
+ return global_socket;
+}
+
+void set_default_socket(const char *socket)
+{
+ if (socket)
+ {
+ strncpy(global_socket, socket, strlen(socket));
+ }
+}
+
+}
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * libtest
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#pragma once
+
+namespace libtest {
+
+const char *default_socket();
+
+void set_default_socket(const char *socket);
+
+} // namespace libtest
+
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * libtest
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <libtest/common.h>
+
+namespace libtest {
+
+const char *test_strerror(test_return_t code)
+{
+ switch (code) {
+ case TEST_SUCCESS:
+ return "ok";
+
+ case TEST_FAILURE:
+ return "failed";
+
+ case TEST_MEMORY_ALLOCATION_FAILURE:
+ return "memory allocation";
+
+ case TEST_SKIPPED:
+ return "skipped";
+
+ case TEST_FATAL:
+ break;
+ }
+
+ return "failed";
+}
+
+} // namespace libtest
#pragma once
+namespace libtest {
+
/**
@note Friendly print function for errors.
*/
LIBTEST_API
const char *test_strerror(test_return_t code);
+
+} // namespace libtest
#include <signal.h>
-#include <libtest/stats.h>
-#include <libtest/signal.h>
-
#ifndef __INTEL_COMPILER
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
using namespace libtest;
-static char global_socket[1024];
-
-const char *default_socket()
-{
- assert(global_socket[0]);
- return global_socket;
-}
-
-bool test_is_local()
-{
- return (getenv("LIBTEST_LOCAL"));
-}
-
-void set_default_socket(const char *socket)
-{
- if (socket)
- {
- strncpy(global_socket, socket, strlen(socket));
- }
-}
-
static void stats_print(Stats *stats)
{
if (stats->collection_failed == 0 and stats->collection_success == 0)
return s + us;
}
-const char *test_strerror(test_return_t code)
-{
- switch (code) {
- case TEST_SUCCESS:
- return "ok";
-
- case TEST_FAILURE:
- return "failed";
-
- case TEST_MEMORY_ALLOCATION_FAILURE:
- return "memory allocation";
-
- case TEST_SKIPPED:
- return "skipped";
-
- case TEST_FATAL:
- break;
- }
-
- return "failed";
-}
-
-void create_core(void)
-{
- if (getenv("LIBMEMCACHED_NO_COREDUMP") == NULL)
- {
- pid_t pid= fork();
-
- if (pid == 0)
- {
- abort();
- }
- else
- {
- while (waitpid(pid, NULL, 0) != pid) {};
- }
- }
-}
-
static Framework *world= NULL;
int main(int argc, char *argv[])
{
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
-#include <libtest/stream.h>
-#include <libtest/comparison.hpp>
-
/**
A structure describing the test case.
*/
fprintf(stderr, "\n%s:%d: Assertion failed for %s: ", __FILE__, __LINE__, __func__);\
perror(#A); \
fprintf(stderr, "\n"); \
- create_core(); \
+ libtest::create_core(); \
assert((A)); \
} \
} while (0)
if ((A)) { \
fprintf(stderr, "\n%s:%d: Assertion failed %s, with message %s, in %s", __FILE__, __LINE__, (B), #A, __func__ );\
fprintf(stderr, "\n"); \
- create_core(); \
+ libtest::create_core(); \
assert((A)); \
} \
} while (0)
{ \
if (! (A)) { \
fprintf(stderr, "\n%s:%d: Assertion \"%s\" failed, in %s\n", __FILE__, __LINE__, #A, __func__);\
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
{ \
if (! (A)) { \
fprintf(stderr, "\n%s:%d: Assertion \"%s\" failed, in %s\n", __FILE__, __LINE__, #A, __func__);\
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
#define test_true_got(__expected, __hint) \
do \
{ \
- if (not libtest::_compare_true_hint(__FILE__, __LINE__, __func__, ((__expected)), #__expected, ((__hint)))) \
+ if (not libtest::_compare_truth_hint(__FILE__, __LINE__, __func__, ((__expected)), #__expected, ((__hint)))) \
{ \
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
{ \
if (1) { \
fprintf(stderr, "\n%s:%d: Failed with %s, in %s\n", __FILE__, __LINE__, #A, __func__);\
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
{ \
if ((A)) { \
fprintf(stderr, "\n%s:%d: Assertion failed %s, in %s\n", __FILE__, __LINE__, #A, __func__);\
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
{ \
if ((A)) { \
fprintf(stderr, "\n%s:%d: Assertion failed %s with %s\n", __FILE__, __LINE__, #A, (B));\
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
{ \
if (not libtest::_compare(__FILE__, __LINE__, __func__, ((__expected)), ((__actual)))) \
{ \
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
{ \
if (not libtest::_compare_zero(__FILE__, __LINE__, __func__, ((__actual)))) \
{ \
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
{ \
if (not libtest::_compare_hint(__FILE__, __LINE__, __func__, (__expected), (__actual), (__hint))) \
{ \
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
+#define test_compare_warn(__expected, __actual) \
+do \
+{ \
+ void(libtest::_compare(__FILE__, __LINE__, __func__, (__expected), (__actual))); \
+} while (0)
+
+#define test_compare_warn_hint(__expected, __actual, __hint) \
+do \
+{ \
+ libtest::_compare_hint(__FILE__, __LINE__, __func__, (__expected), (__actual), (__hint)); \
+} while (0)
+
+#define test_warn(__truth) \
+do \
+{ \
+ void(libtest::_truth(__FILE__, __LINE__, __func__, (__truth))); \
+} while (0)
+
+#define test_warn_hint(__truth, __hint) \
+do \
+{ \
+ void(libtest::_compare_truth_hint(__FILE__, __LINE__, __func__, (__truth), #__truth, (__hint))); \
+} while (0)
+
#define test_strcmp(A,B) \
do \
if (strcmp((A), (B))) \
{ \
fprintf(stderr, "\n%s:%d: Expected %s, got %s\n", __FILE__, __LINE__, (A), (B)); \
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
if (memcmp((A), (B), (C))) \
{ \
fprintf(stderr, "\n%s:%d: %.*s -> %.*s\n", __FILE__, __LINE__, (int)(C), (char *)(A), (int)(C), (char *)(B)); \
- create_core(); \
+ libtest::create_core(); \
return TEST_FAILURE; \
} \
} while (0)
#include <libtest/version.h>
#include <libtest/error.h>
+#include <libtest/strerror.h>
+#include <libtest/stream.h>
+#include <libtest/comparison.hpp>
#include <libtest/server.h>
#include <libtest/server_container.h>
#include <libtest/wait.h>
#include <libtest/callbacks.h>
#include <libtest/test.h>
-#include <libtest/strerror.h>
#include <libtest/core.h>
#include <libtest/runner.h>
#include <libtest/port.h>
+#include <libtest/is_local.hpp>
+#include <libtest/socket.hpp>
#include <libtest/stats.h>
#include <libtest/collection.h>
#include <libtest/framework.h>
#include <libtest/cmdline.h>
#include <libtest/string.hpp>
#include <libtest/binaries.h>
-
-#pragma once
-
-LIBTEST_API
-in_port_t default_port();
-
-LIBTEST_API
-void set_default_port(in_port_t port);
-
-LIBTEST_API
-const char* default_socket();
-
-LIBTEST_API
-void set_default_socket(const char *socket);
-
-LIBTEST_API
-bool test_is_local(void);
#pragma once
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define LIBTEST_VERSION_STRING "@VERSION@"
#define LIBTEST_VERSION_HEX @HEX_VERSION@
-
-#ifdef __cplusplus
-}
-#endif
#pragma once
#if defined(BUILDING_LIBTEST)
-# if defined(HAVE_VISIBILITY)
+# if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
# define LIBTEST_API __attribute__ ((visibility("default")))
-# define LIBTEST_INTERNAL_API __attribute__ ((visibility("hidden")))
-# define LIBTEST_API_DEPRECATED __attribute__ ((deprecated,visibility("default")))
-# define LIBTEST_LOCAL __attribute__ ((visibility("hidden")))
+# define LIBTEST_LOCAL __attribute__ ((visibility("default")))
# elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
# define LIBTEST_API __global
-# define LIBTEST_INTERNAL_API __hidden
-# define LIBTEST_API_DEPRECATED __global
-# define LIBTEST_LOCAL __hidden
+# define LIBTEST_LOCAL __global
# elif defined(_MSC_VER)
-# define LIBTEST_API extern __declspec(dllexport)
-# define LIBTEST_INTERNAL_API extern __declspec(dllexport)
-# define LIBTEST_DEPRECATED_API extern __declspec(dllexport)
-# define LIBTEST_LOCAL
-# endif /* defined(HAVE_VISIBILITY) */
-#else /* defined(BUILDING_LIBTEST) */
-# if defined(_MSC_VER)
-# define LIBTEST_API extern __declspec(dllimport)
-# define LIBTEST_INTERNAL_API extern __declspec(dllimport)
-# define LIBTEST_API_DEPRECATED extern __declspec(dllimport)
-# define LIBTEST_LOCAL
+# define LIBTEST_API extern __declspec(dllexport)
+# define LIBTEST_LOCAL extern __declspec(dllexport)
# else
# define LIBTEST_API
-# define LIBTEST_INTERNAL_API
-# define LIBTEST_API_DEPRECATED
# define LIBTEST_LOCAL
-# endif /* defined(_MSC_VER) */
-#endif /* defined(BUILDING_LIBTEST) */
+# endif
+#else
+# if defined(BUILDING_LIBTEST)
+# if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
+# define LIBTEST_API __attribute__ ((visibility("default")))
+# define LIBTEST_LOCAL __attribute__ ((visibility("hidden")))
+# elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define LIBTEST_API __global
+# define LIBTEST_LOCAL __hidden
+# elif defined(_MSC_VER)
+# define LIBTEST_API extern __declspec(dllexport)
+# define LIBTEST_LOCAL
+# else
+# define LIBTEST_API
+# define LIBTEST_LOCAL
+# endif /* defined(HAVE_VISIBILITY) */
+# else /* defined(BUILDING_LIBTEST) */
+# if defined(_MSC_VER)
+# define LIBTEST_API extern __declspec(dllimport)
+# define LIBTEST_LOCAL
+# else
+# define LIBTEST_API
+# define LIBTEST_LOCAL
+# endif /* defined(_MSC_VER) */
+# endif /* defined(BUILDING_LIBTEST) */
+#endif /* defined(BUILDING_LIBTESTINTERNAL) */
AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],
[CXXFLAGS=""])
- m4_if(PCT_DONT_SUPRESS_INCLUDE,yes,[
- AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar)
- ],[
- AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability nostdinc subdir-objects foreign tar-ustar)
- ])
+ AM_INIT_AUTOMAKE(-Wall -Werror -Wno-portability subdir-objects foreign tar-ustar)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
PANDORA_PLATFORM
- PANDORA_LIBTOOL
-
dnl autoconf doesn't automatically provide a fail-if-no-C++ macro
dnl so we check c++98 features and fail if we don't have them, mainly
dnl for that reason
PANDORA_HAVE_GCC_ATOMICS
- m4_if(PCT_USE_VISIBILITY,[yes],[
- PANDORA_ENABLE_VISIBILITY
- ],[
- PANDORA_CHECK_VISIBILITY
- ])
-
PANDORA_HEADER_ASSERT
PANDORA_WARNINGS(PCT_ALL_ARGS)
+++ /dev/null
-dnl Copyright (C) 2009 Sun Microsystems, Inc.
-dnl This file is free software; Sun Microsystems, Inc.
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([PANDORA_LIBTOOL],[
- AC_REQUIRE([AC_DISABLE_STATIC])
- AC_REQUIRE([AC_PROG_LIBTOOL])
- m4_ifndef([LT_PREREQ],[
- pandora_have_old_libtool=yes
- ],[
- pandora_have_old_libtool=no
- ])
- AS_IF([test "$SUNCC" = "yes" -a "${pandora_have_old_libtool}" = "yes"],[
- AC_MSG_ERROR([Building ${PACKAGE} with Sun Studio requires at least libtool 2.2])
- ])
-
- dnl By requiring AC_PROG_LIBTOOL, we should force the macro system to read
- dnl libtool.m4, where in 2.2 AC_PROG_LIBTOOL is an alias for LT_INIT
- dnl Then, if we're on 2.2, we should have LT_LANG, so we'll call it.
- m4_ifdef([LT_LANG],[
- LT_LANG(C)
- LT_LANG(C++)
- ])
-])
+++ /dev/null
-dnl Copyright (C) 2005, 2008 Free Software Foundation, Inc.
-dnl Copyright (C) 2009 Monty Taylor
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-dnl Tests whether the compiler supports the command-line option
-dnl -fvisibility=hidden and the function and variable attributes
-dnl __attribute__((__visibility__("hidden"))) and
-dnl __attribute__((__visibility__("default"))).
-dnl Does *not* test for __visibility__("protected") - which has tricky
-dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
-dnl MacOS X.
-dnl Does *not* test for __visibility__("internal") - which has processor
-dnl dependent semantics.
-dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
-dnl "really only recommended for legacy code".
-dnl Set the variable CFLAG_VISIBILITY.
-dnl Defines and sets the variable HAVE_VISIBILITY.
-
-AC_DEFUN([PANDORA_CHECK_VISIBILITY],
-[
- AC_REQUIRE([AC_PROG_CC])
- CFLAG_VISIBILITY=
- HAVE_VISIBILITY=0
- AS_IF([test -n "$GCC"],[
- AC_MSG_CHECKING([for simple visibility declarations])
- AC_CACHE_VAL([gl_cv_cc_visibility], [
- gl_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
- AC_TRY_COMPILE(
- [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
- extern __attribute__((__visibility__("default"))) int exportedvar;
- extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
- extern __attribute__((__visibility__("default"))) int exportedfunc (void);],
- [],[
- case "$host_os" in
- *darwin*)
- gl_cv_cc_visibility=no
- ;;
- *)
- gl_cv_cc_visibility=yes
- ;;
- esac
- ],[gl_cv_cc_visibility=no])
- CFLAGS="$gl_save_CFLAGS"])
- AC_MSG_RESULT([$gl_cv_cc_visibility])
- if test $gl_cv_cc_visibility = yes; then
- CFLAG_VISIBILITY="-fvisibility=hidden"
- CXXFLAG_VISIBILITY="-fvisibility=hidden -fvisibility-inlines-hidden"
- NO_VISIBILITY="-fvisibility=default"
- HAVE_VISIBILITY=1
- fi
- ])
- AS_IF([test "x$SUNCC" = "xyes"],[
- CFLAG_VISIBILITY="-xldscope=hidden"
- CXXFLAG_VISIBILITY="-xldscope=hidden"
- NO_VISIBILITY="-xldscope=global"
- HAVE_VISIBILITY=1
- ])
- AC_SUBST([CFLAG_VISIBILITY])
- AC_SUBST([CXXFLAG_VISIBILITY])
- AC_SUBST([NO_VISIBILITY])
- AC_SUBST([HAVE_VISIBILITY])
- AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
- [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
-])
-
-AC_DEFUN([PANDORA_ENABLE_VISIBILITY],[
- AC_REQUIRE([PANDORA_CHECK_VISIBILITY])
- AM_CFLAGS="${AM_CFLAGS} ${CFLAG_VISIBILITY}"
- AM_CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAG_VISIBILITY}"
-])
extern "C" {
#endif
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t basic_init_test(memcached_st *junk);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t basic_clone_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t basic_reset_stack_test(memcached_st *junk);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t basic_reset_heap_test(memcached_st *junk);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t basic_reset_stack_clone_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t basic_reset_heap_clone_test(memcached_st *memc);
#ifdef __cplusplus
}
-test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value)
+test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value, bool require_all)
{
for (size_t x= 0; x < number_of_keys; ++x)
{
test_string_make_from_cstr(keys[x]), // Keys
&value_length,
0, &rc);
- test_true_got(value, keys[x]);
- if (key_matches_value)
+ if (require_all)
{
- test_strcmp(keys[x], value);
+ test_true_got(value, keys[x]);
+ if (key_matches_value)
+ {
+ test_strcmp(keys[x], value);
+ }
+ }
+ else if (memcached_success(rc))
+ {
+ test_warn_hint(value, keys[x]);
+ if (value and key_matches_value)
+ {
+ test_strcmp(keys[x], value);
+ }
+ }
+
+ if (value)
+ {
+ free(value);
}
- free(value);
}
return TEST_SUCCESS;
#pragma once
-test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value= false);
+test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value= false, bool require_all= false);
test_return_t confirm_keys_dont_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys);
{
memcached_return_t rc;
const char *key= "foo bad";
- char *string;
- size_t string_length;
uint32_t flags;
memcached_st *memc_clone;
- unsigned int set= 1;
size_t max_keylen= 0xffff;
// Just skip if we are in binary mode.
query_id= memcached_query_id(memc_clone);
test_compare(MEMCACHED_SUCCESS,
- memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set));
+ memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true));
test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set()
/* All keys are valid in the binary protocol (except for length) */
if (not memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
{
query_id= memcached_query_id(memc_clone);
- string= memcached_get(memc_clone, key, strlen(key),
- &string_length, &flags, &rc);
- test_compare(MEMCACHED_BAD_KEY_PROVIDED, rc);
- test_zero(string_length);
- test_false(string);
+ {
+ size_t string_length;
+ char *string= memcached_get(memc_clone, key, strlen(key),
+ &string_length, &flags, &rc);
+ test_compare(MEMCACHED_BAD_KEY_PROVIDED, rc);
+ test_zero(string_length);
+ test_false(string);
+ }
- set= 0;
query_id= memcached_query_id(memc_clone);
test_compare(MEMCACHED_SUCCESS,
- memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set));
+ memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, false));
test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set()
- string= memcached_get(memc_clone, key, strlen(key),
- &string_length, &flags, &rc);
- test_compare_got(MEMCACHED_NOTFOUND, rc, memcached_strerror(NULL, rc));
- test_zero(string_length);
- test_false(string);
+ {
+ size_t string_length;
+ char *string= memcached_get(memc_clone, key, strlen(key),
+ &string_length, &flags, &rc);
+ test_compare_got(MEMCACHED_NOTFOUND, rc, memcached_strerror(NULL, rc));
+ test_zero(string_length);
+ test_false(string);
+ }
/* Test multi key for bad keys */
const char *keys[] = { "GoodKey", "Bad Key", "NotMine" };
size_t key_lengths[] = { 7, 7, 7 };
- set= 1;
query_id= memcached_query_id(memc_clone);
test_compare(MEMCACHED_SUCCESS,
- memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set));
+ memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true));
test_compare(query_id, memcached_query_id(memc_clone));
query_id= memcached_query_id(memc_clone);
test_compare(MEMCACHED_SUCCESS,
memcached_callback_set(memc_clone, MEMCACHED_CALLBACK_NAMESPACE, NULL));
- char *longkey= (char *)malloc(max_keylen + 1);
- if (longkey)
+ std::vector <char> longkey;
+ longkey.insert(longkey.end(), max_keylen +1, 'a');
+ if (longkey.size())
{
- memset(longkey, 'a', max_keylen + 1);
- string= memcached_get(memc_clone, longkey, max_keylen,
- &string_length, &flags, &rc);
+ size_t string_length;
+ char *string= memcached_get(memc_clone, &longkey[0], max_keylen,
+ &string_length, &flags, &rc);
test_compare(MEMCACHED_NOTFOUND, rc);
test_zero(string_length);
test_false(string);
- string= memcached_get(memc_clone, longkey, max_keylen + 1,
+ string= memcached_get(memc_clone, &longkey[0], max_keylen +1,
&string_length, &flags, &rc);
test_compare(MEMCACHED_BAD_KEY_PROVIDED, rc);
test_zero(string_length);
test_false(string);
-
- free(longkey);
}
}
/* Make sure zero length keys are marked as bad */
- set= 1;
- test_compare(MEMCACHED_SUCCESS,
- memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set));
- string= memcached_get(memc_clone, key, 0,
- &string_length, &flags, &rc);
- test_compare(MEMCACHED_BAD_KEY_PROVIDED, rc);
- test_zero(string_length);
- test_false(string);
+ {
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true));
+ size_t string_length;
+ char *string= memcached_get(memc_clone, key, 0,
+ &string_length, &flags, &rc);
+ test_compare(MEMCACHED_BAD_KEY_PROVIDED, rc);
+ test_zero(string_length);
+ test_false(string);
+ }
memcached_free(memc_clone);
*/
static test_return_t user_supplied_bug14(memcached_st *memc)
{
- size_t setter= 1;
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter);
- memcached_return_t rc;
- const char *key= "foo";
- char *value;
- size_t value_length= 18000;
- char *string;
- size_t string_length;
- uint32_t flags;
- unsigned int x;
- size_t current_length;
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, true);
- value = (char*)malloc(value_length);
- test_true(value);
-
- for (x= 0; x < value_length; x++)
- value[x] = (char) (x % 127);
+ std::vector<char> value;
+ for (size_t x= 0; x < 18000; x++)
+ {
+ value.push_back((char) (x % 127));
+ }
- for (current_length= 0; current_length < value_length; current_length++)
+ for (size_t current_length= 0; current_length < value.size(); current_length++)
{
- rc= memcached_set(memc, key, strlen(key),
- value, current_length,
- (time_t)0, (uint32_t)0);
- test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED);
+ memcached_return_t rc= memcached_set(memc, test_literal_param("foo"),
+ &value[0], current_length,
+ (time_t)0, (uint32_t)0);
+ test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED);
- string= memcached_get(memc, key, strlen(key),
- &string_length, &flags, &rc);
+ size_t string_length;
+ uint32_t flags;
+ char *string= memcached_get(memc, test_literal_param("foo"),
+ &string_length, &flags, &rc);
test_compare(MEMCACHED_SUCCESS, rc);
- test_true(string_length == current_length);
- test_memcmp(string, value, string_length);
+ test_compare(string_length, current_length);
+ test_memcmp(string, &value[0], string_length);
free(string);
}
- free(value);
-
return TEST_SUCCESS;
}
*/
static test_return_t user_supplied_bug15(memcached_st *memc)
{
- uint32_t x;
- memcached_return_t rc;
- const char *key= "mykey";
- size_t length;
- uint32_t flags;
-
- for (x= 0; x < 2; x++)
+ for (uint32_t x= 0; x < 2; x++)
{
- rc= memcached_set(memc, key, strlen(key),
- NULL, 0,
- (time_t)0, (uint32_t)0);
+ memcached_return_t rc= memcached_set(memc, test_literal_param("mykey"),
+ NULL, 0,
+ (time_t)0, (uint32_t)0);
test_compare(MEMCACHED_SUCCESS, rc);
- char *value= memcached_get(memc, key, strlen(key),
+ size_t length;
+ uint32_t flags;
+ char *value= memcached_get(memc, test_literal_param("mykey"),
&length, &flags, &rc);
test_compare(MEMCACHED_SUCCESS, rc);
test_false(value);
- test_false(length);
- test_false(flags);
+ test_zero(length);
+ test_zero(flags);
- value= memcached_get(memc, key, strlen(key),
+ value= memcached_get(memc, test_literal_param("mykey"),
&length, &flags, &rc);
test_compare(MEMCACHED_SUCCESS, rc);
test_true(value == NULL);
- test_true(length == 0);
- test_true(flags == 0);
+ test_zero(length);
+ test_zero(flags);
}
return TEST_SUCCESS;
/* Check the return sizes on FLAGS to make sure it stores 32bit unsigned values correctly */
static test_return_t user_supplied_bug16(memcached_st *memc)
{
- memcached_return_t rc;
- const char *key= "mykey";
- char *value;
- size_t length;
- uint32_t flags;
-
- rc= memcached_set(memc, key, strlen(key),
- NULL, 0,
- (time_t)0, UINT32_MAX);
+ memcached_return_t rc= memcached_set(memc, test_literal_param("mykey"),
+ NULL, 0,
+ (time_t)0, UINT32_MAX);
test_compare(MEMCACHED_SUCCESS, rc);
- value= memcached_get(memc, key, strlen(key),
+ size_t length;
+ uint32_t flags;
+ char *value= memcached_get(memc, test_literal_param("mykey"),
&length, &flags, &rc);
test_compare(MEMCACHED_SUCCESS, rc);
test_true(value == NULL);
- test_true(length == 0);
- test_true(flags == UINT32_MAX);
+ test_zero(length);
+ test_compare(flags, UINT32_MAX);
return TEST_SUCCESS;
}
/* Check the validity of chinese key*/
static test_return_t user_supplied_bug17(memcached_st *memc)
{
- memcached_return_t rc;
const char *key= "豆瓣";
const char *value="我们在炎热抑郁的夏天无法停止豆瓣";
- char *value2;
- size_t length;
- uint32_t flags;
-
- rc= memcached_set(memc, key, strlen(key),
- value, strlen(value),
- (time_t)0, 0);
+ memcached_return_t rc= memcached_set(memc, key, strlen(key),
+ value, strlen(value),
+ (time_t)0, 0);
test_compare(MEMCACHED_SUCCESS, rc);
- value2= memcached_get(memc, key, strlen(key),
- &length, &flags, &rc);
+ size_t length;
+ uint32_t flags;
+ char *value2= memcached_get(memc, key, strlen(key),
+ &length, &flags, &rc);
test_true(length==strlen(value));
test_compare(MEMCACHED_SUCCESS, rc);
/* CAS test from Andei */
static test_return_t user_supplied_bug20(memcached_st *memc)
{
- memcached_return_t status;
- memcached_result_st *result, result_obj;
- const char *key = "abc";
- size_t key_len = strlen("abc");
- const char *value = "foobar";
- size_t value_len = strlen(value);
+ const char *key= "abc";
+ size_t key_len= strlen("abc");
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, 1);
+ test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, true));
- status = memcached_set(memc, key, key_len, value, value_len, (time_t)0, (uint32_t)0);
- test_true(status == MEMCACHED_SUCCESS);
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_set(memc,
+ test_literal_param("abc"),
+ test_literal_param("foobar"),
+ (time_t)0, (uint32_t)0));
- status = memcached_mget(memc, &key, &key_len, 1);
- test_true(status == MEMCACHED_SUCCESS);
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_mget(memc, &key, &key_len, 1));
- result= memcached_result_create(memc, &result_obj);
+ memcached_result_st result_obj;
+ memcached_result_st *result= memcached_result_create(memc, &result_obj);
test_true(result);
memcached_result_create(memc, &result_obj);
+ memcached_return_t status;
result= memcached_fetch_result(memc, &result_obj, &status);
test_true(result);
- test_true(status == MEMCACHED_SUCCESS);
+ test_compare(MEMCACHED_SUCCESS, status);
memcached_result_free(result);
test_true(memc_clone);
/* only binproto uses getq for mget */
- test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1));
+ test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, true));
/* empty the cache to ensure misses (hence non-responses) */
test_compare(MEMCACHED_SUCCESS, memcached_flush(memc_clone, 0));
test_rc= pre_binary(memc);
if (test_rc != TEST_SUCCESS)
+ {
return test_rc;
+ }
/* should work as of r580 */
test_compare(TEST_SUCCESS,
return TEST_SUCCESS;
}
-static test_return_t output_ketama_weighted_keys(memcached_st *trash)
+static test_return_t output_ketama_weighted_keys(memcached_st *)
{
- (void) trash;
-
- memcached_return_t rc;
memcached_st *memc= memcached_create(NULL);
test_true(memc);
- rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1);
- test_compare(MEMCACHED_SUCCESS, rc);
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, true));
uint64_t value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
- test_true(value == 1);
+ test_compare(value, uint64_t(1));
- rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5);
- test_compare(MEMCACHED_SUCCESS, rc);
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5));
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH);
test_true(value == MEMCACHED_HASH_MD5);
static test_return_t result_static(memcached_st *memc)
{
memcached_result_st result;
- memcached_result_st *result_ptr;
-
- result_ptr= memcached_result_create(memc, &result);
- test_true(result.options.is_allocated == false);
- test_true(memcached_is_initialized(&result) == true);
+ memcached_result_st *result_ptr= memcached_result_create(memc, &result);
+ test_false(result.options.is_allocated);
+ test_true(memcached_is_initialized(&result));
test_true(result_ptr);
test_true(result_ptr == &result);
memcached_result_free(&result);
- test_true(result.options.is_allocated == false);
- test_true(memcached_is_initialized(&result) == false);
+ test_false(result.options.is_allocated);
+ test_false(memcached_is_initialized(&result));
return TEST_SUCCESS;
}
static test_return_t result_alloc(memcached_st *memc)
{
- memcached_result_st *result_ptr;
-
- result_ptr= memcached_result_create(memc, NULL);
+ memcached_result_st *result_ptr= memcached_result_create(memc, NULL);
test_true(result_ptr);
- test_true(result_ptr->options.is_allocated == true);
- test_true(memcached_is_initialized(result_ptr) == true);
+ test_true(result_ptr->options.is_allocated);
+ test_true(memcached_is_initialized(result_ptr));
memcached_result_free(result_ptr);
return TEST_SUCCESS;
return TEST_SUCCESS;
}
-static test_return_t generate_pairs(memcached_st *memc)
+static test_return_t generate_pairs(memcached_st *)
{
- (void)memc;
global_pairs= pairs_generate(GLOBAL_COUNT, 400);
global_count= GLOBAL_COUNT;
}
static test_return_t generate_buffer_data(memcached_st *memc)
{
- size_t latch= 0;
-
- latch= 1;
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, latch);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, true);
generate_data(memc);
return TEST_SUCCESS;
unsigned int keys_returned;
test_compare(TEST_SUCCESS, fetch_all_results(memc, keys_returned, MEMCACHED_SUCCESS));
test_true(keys_returned > 0);
- test_compare_got(global_count, keys_returned, "Possible false, positive, memcached may have ejected key/value based on memory needs");
+ test_compare_warn_hint(global_count, keys_returned, "Possible false, positive, memcached may have ejected key/value based on memory needs");
}
return TEST_SUCCESS;
static test_return_t delete_buffer_generate(memcached_st *memc)
{
- uint64_t latch= 1;
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, latch);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, true);
for (size_t x= 0; x < global_count; x++)
{
test_compare(MEMCACHED_SUCCESS, rc);
uint64_t value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA);
- test_true(value == 1);
+ test_compare(value, uint64_t(1));
return TEST_SUCCESS;
}
test_compare(MEMCACHED_SUCCESS, rc);
uint64_t value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
- test_true(value == 1);
+ test_compare(value, uint64_t(1));
- rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5);
- test_compare(MEMCACHED_SUCCESS, rc);
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5));
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH);
- test_true(value == MEMCACHED_HASH_MD5);
+ test_compare(MEMCACHED_HASH_MD5, memcached_hash_t(value));
return TEST_SUCCESS;
}
memcached_hash_t hash;
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value);
if ((rc= pre_hsieh(memc)) != TEST_SUCCESS)
+ {
return rc;
+ }
value= (memcached_server_distribution_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION);
test_true(value == MEMCACHED_DISTRIBUTION_CONSISTENT);
test_true(if_successful == true);
if (instance->micro_version > 0)
+ {
if_successful= libmemcached_util_version_check(memc, instance->major_version, instance->minor_version, (uint8_t)(instance->micro_version -1));
+ }
else if (instance->minor_version > 0)
+ {
if_successful= libmemcached_util_version_check(memc, instance->major_version, (uint8_t)(instance->minor_version - 1), instance->micro_version);
+ }
else if (instance->major_version > 0)
+ {
if_successful= libmemcached_util_version_check(memc, (uint8_t)(instance->major_version -1), instance->minor_version, instance->micro_version);
+ }
test_true(if_successful == true);
if (instance->micro_version > 0)
+ {
if_successful= libmemcached_util_version_check(memc, instance->major_version, instance->minor_version, (uint8_t)(instance->micro_version +1));
+ }
else if (instance->minor_version > 0)
+ {
if_successful= libmemcached_util_version_check(memc, instance->major_version, (uint8_t)(instance->minor_version +1), instance->micro_version);
+ }
else if (instance->major_version > 0)
+ {
if_successful= libmemcached_util_version_check(memc, (uint8_t)(instance->major_version +1), instance->minor_version, instance->micro_version);
+ }
test_true(if_successful == false);
size_t len;
uint32_t flags;
memcached_return rc;
- char *value;
// See if memcached is reachable.
- value= memcached_get(memc, key, strlen(key), &len, &flags, &rc);
+ char *value= memcached_get(memc, key, strlen(key), &len, &flags, &rc);
test_false(value);
test_zero(len);
snprintf(buffer, sizeof(buffer), "-p %d", int(default_port()));
const char *args[]= { buffer, "--help", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "-p %d", int(default_port()));
const char *args[]= { buffer, " -a ", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "-p %d", int(default_port()));
const char *args[]= { buffer, " -b ", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
{
const char *args[]= { "--help", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "--concurrency=10", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "--concurrency=10", "--initial-load=1000", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "--concurrency=10", "--initial-load=1000", "--execute-number=10", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "--concurrency=10", "--initial-load=1000", "--execute-number=10", "--test=get", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "--concurrency=10", "--initial-load=1000", "--execute-number=10", "--test=set", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "--concurrency=10", "--initial-load=1000", "--execute-number=10", "--test=set", "--non-blocking", 0 };
- test_success(exec_cmdline(executable, args));
+ test_true(exec_cmdline(executable, args));
return TEST_SUCCESS;
}
#pragma once
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t memcached_increment_namespace(memcached_st *memc);
char *value= memcached_get(memc, test_literal_param("test"), &value_len, NULL, &rc);
test_false(value);
test_zero(value_len);
+#ifdef __APPLE__
+ test_compare_got(MEMCACHED_CONNECTION_FAILURE, rc, memcached_last_error_message(memc));
+#else
test_compare_got(MEMCACHED_TIMEOUT, rc, memcached_last_error_message(memc));
+#endif
memcached_free(memc);
}
extern "C" {
#endif
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t server_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t servers_bad_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t behavior_parser_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t parser_number_options_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t parser_distribution_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t parser_hash_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t parser_boolean_options_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t parser_key_prefix_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t libmemcached_check_configuration_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t memcached_create_with_options_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t memcached_create_with_options_with_filename(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t libmemcached_check_configuration_with_filename_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t random_statement_build_test(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t test_include_keyword(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t test_end_keyword(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t test_reset_keyword(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t test_error_keyword(memcached_st*);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t server_with_weight_test(memcached_st *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t test_hostname_port_weight(memcached_st *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t regression_bug_71231153_connect(memcached_st *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t regression_bug_71231153_poll(memcached_st *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t test_parse_socket(memcached_st *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t test_namespace_keyword(memcached_st*);
#ifdef __cplusplus
return TEST_SUCCESS;
}
-#ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-fpermissive"
-#endif
-
test_st error_tests[] ={
- { "error()", 0, error_test },
- { "error(std::string&)", 0, error_std_string_test },
- { "error(memcached_return_t&)", 0, error_memcached_return_t_test },
+ { "error()", false, reinterpret_cast<test_callback_fn*>(error_test) },
+ { "error(std::string&)", false, reinterpret_cast<test_callback_fn*>(error_std_string_test) },
+ { "error(memcached_return_t&)", false, reinterpret_cast<test_callback_fn*>(error_memcached_return_t_test) },
{0, 0, 0}
};
test_st tests[] ={
- { "basic", 0,
+ { "basic", false,
reinterpret_cast<test_callback_fn*>(basic_test) },
- { "basic_master_key", 0,
+ { "basic_master_key", false,
reinterpret_cast<test_callback_fn*>(basic_master_key_test) },
- { "increment_test", 0,
+ { "increment_test", false,
reinterpret_cast<test_callback_fn*>(increment_test) },
- { "mget", 1,
+ { "mget", true,
reinterpret_cast<test_callback_fn*>(mget_test) },
- { "basic_behavior", 0,
+ { "basic_behavior", false,
reinterpret_cast<test_callback_fn*>(basic_behavior) },
{0, 0, 0}
};
extern "C" {
#endif
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t memcached_pool_test(memcached_st *);
#ifdef __cplusplus
extern "C" {
#endif
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
memcached_return_t server_print_callback(const memcached_st *ptr,
const memcached_server_st *server,
void *context);
memcached_flush_buffers(memc_replicated);
// Confirm keys with replication read
- test_compare(TEST_SUCCESS, confirm_keys_exist(memc_replicated, keys, test_array_length(keys), true));
- test_compare(TEST_SUCCESS, confirm_keys_exist(memc_not_replicate, keys, test_array_length(keys), true));
+ test_compare(TEST_SUCCESS, confirm_keys_exist(memc_replicated, keys, test_array_length(keys), true, true));
+ test_compare(TEST_SUCCESS, confirm_keys_exist(memc_not_replicate, keys, test_array_length(keys), true, true));
/* Delete the items from all of the servers except 1, we use the non replicated memc so that we know we deleted the keys */
for (size_t x= 0; x < test_array_length(keys); ++x)
extern "C" {
#endif
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t replication_set_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t replication_get_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t replication_mget_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t replication_delete_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t replication_randomize_mget_test(memcached_st *memc);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t replication_randomize_mget_fail_test(memcached_st *memc);
#ifdef __cplusplus
extern "C" {
#endif
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t string_static_null(void *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t string_alloc_null(void *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t string_alloc_with_size(void *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t string_alloc_with_size_toobig(void *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t string_alloc_append(void *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t string_alloc_append_toobig(void *);
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t string_alloc_append_multiple(void *);
#ifdef __cplusplus
extern "C" {
#endif
-LIBTEST_INTERNAL_API
+LIBTEST_LOCAL
test_return_t virtual_back_map(memcached_st *);
#ifdef __cplusplus