projects
/
awesomized
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
b0ef8cb
)
Adding additional tests for namespace.
author
Brian Aker
<brian@tangent.org>
Thu, 7 Jul 2011 22:10:26 +0000
(15:10 -0700)
committer
Brian Aker
<brian@tangent.org>
Thu, 7 Jul 2011 22:10:26 +0000
(15:10 -0700)
libmemcached/namespace.cc
patch
|
blob
|
history
libmemcached/namespace.h
patch
|
blob
|
history
libmemcached/options/parser.cc
patch
|
blob
|
history
libmemcached/options/parser.yy
patch
|
blob
|
history
libtest/test.cc
patch
|
blob
|
history
tests/mem_functions.cc
patch
|
blob
|
history
tests/parser.cc
patch
|
blob
|
history
tests/parser.h
patch
|
blob
|
history
diff --git
a/libmemcached/namespace.cc
b/libmemcached/namespace.cc
index 372af2a927b88f55f1aec9da6681d8703551e270..5cefae56f47981427885265cb0dc93c6bd06f597 100644
(file)
--- a/
libmemcached/namespace.cc
+++ b/
libmemcached/namespace.cc
@@
-83,3
+83,11
@@
memcached_return_t memcached_set_namespace(memcached_st *self, const char *key,
return MEMCACHED_SUCCESS;
}
return MEMCACHED_SUCCESS;
}
+
+const char * memcached_get_namespace(memcached_st *self)
+{
+ if (not self->_namespace)
+ return NULL;
+
+ return memcached_array_string(self->_namespace);
+}
diff --git
a/libmemcached/namespace.h
b/libmemcached/namespace.h
index 60cddd6513993c788d7b4705da83f75c3ffcf8e2..015c024dcf48517daf59103d59d501d24d67f488 100644
(file)
--- a/
libmemcached/namespace.h
+++ b/
libmemcached/namespace.h
@@
-44,6
+44,9
@@
extern "C" {
LIBMEMCACHED_LOCAL
memcached_return_t memcached_set_namespace(memcached_st *self, const char *str, size_t length);
LIBMEMCACHED_LOCAL
memcached_return_t memcached_set_namespace(memcached_st *self, const char *str, size_t length);
+LIBMEMCACHED_API
+ const char * memcached_get_namespace(memcached_st *self);
+
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif
diff --git
a/libmemcached/options/parser.cc
b/libmemcached/options/parser.cc
index 096a31119b374a3fdf2140331c0d433208b3b506..839444ba74edca58894b9a6d8b154c4e3ff89592 100644
(file)
--- a/
libmemcached/options/parser.cc
+++ b/
libmemcached/options/parser.cc
@@
-529,7
+529,7
@@
static const yytype_uint16 yyrline[] =
305, 309, 313, 317, 321, 325, 329, 333, 340, 344,
348, 352, 356, 360, 364, 368, 372, 376, 380, 384,
391, 392, 397, 398, 403, 407, 411, 415, 419, 423,
305, 309, 313, 317, 321, 325, 329, 333, 340, 344,
348, 352, 356, 360, 364, 368, 372, 376, 380, 384,
391, 392, 397, 398, 403, 407, 411, 415, 419, 423,
- 427, 431, 435, 442, 446, 45
7, 461, 465
+ 427, 431, 435, 442, 446, 45
3, 457, 461
};
#endif
};
#endif
@@
-2078,17
+2078,13
@@
yyreduce:
#line 447 "libmemcached/options/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
#line 447 "libmemcached/options/parser.yy"
{
(yyval.string)= (yyvsp[(1) - (1)].string);
- #if 0
- (yyval.string).c_str= (yyvsp[(1) - (1)].string).c_str +1; // +1 to move use passed the initial quote
- (yyval.string).size= (yyvsp[(1) - (1)].string).size -2; // -2 removes the begin and end quote
- #endif
;}
break;
case 65:
/* Line 1464 of yacc.c */
;}
break;
case 65:
/* Line 1464 of yacc.c */
-#line 45
8
"libmemcached/options/parser.yy"
+#line 45
4
"libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_CONSISTENT;
;}
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_CONSISTENT;
;}
@@
-2097,7
+2093,7
@@
yyreduce:
case 66:
/* Line 1464 of yacc.c */
case 66:
/* Line 1464 of yacc.c */
-#line 4
62
"libmemcached/options/parser.yy"
+#line 4
58
"libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_MODULA;
;}
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_MODULA;
;}
@@
-2106,7
+2102,7
@@
yyreduce:
case 67:
/* Line 1464 of yacc.c */
case 67:
/* Line 1464 of yacc.c */
-#line 46
6
"libmemcached/options/parser.yy"
+#line 46
2
"libmemcached/options/parser.yy"
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_RANDOM;
;}
{
(yyval.distribution)= MEMCACHED_DISTRIBUTION_RANDOM;
;}
@@
-2115,7
+2111,7
@@
yyreduce:
/* Line 1464 of yacc.c */
/* Line 1464 of yacc.c */
-#line 211
9
"libmemcached/options/parser.cc"
+#line 211
5
"libmemcached/options/parser.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@
-2327,7
+2323,7
@@
yyreturn:
/* Line 1684 of yacc.c */
/* Line 1684 of yacc.c */
-#line 4
71
"libmemcached/options/parser.yy"
+#line 4
67
"libmemcached/options/parser.yy"
void Context::start()
void Context::start()
diff --git
a/libmemcached/options/parser.yy
b/libmemcached/options/parser.yy
index 81415226e82e002e49b947de5645abd11df9b3f9..f9d1f1e2a5d72cd1dd978b2612e0ba9224db68a3 100644
(file)
--- a/
libmemcached/options/parser.yy
+++ b/
libmemcached/options/parser.yy
@@
-446,10
+446,6
@@
string:
| QUOTED_STRING
{
$$= $1;
| QUOTED_STRING
{
$$= $1;
- #if 0
- $$.c_str= $1.c_str +1; // +1 to move use passed the initial quote
- $$.size= $1.size -2; // -2 removes the begin and end quote
- #endif
}
;
}
;
diff --git
a/libtest/test.cc
b/libtest/test.cc
index 8beef356610b788bf4b5fc8bf825c7bb9ea8c6ed..a8b91094aed0de4b2d252476849972b65dfa0e9a 100644
(file)
--- a/
libtest/test.cc
+++ b/
libtest/test.cc
@@
-390,8
+390,6
@@
int main(int argc, char *argv[])
Error << "Failed while running on_error()";
break;
}
Error << "Failed while running on_error()";
break;
}
-
- Logn();
}
if (next->post and world->runner->post)
}
if (next->post and world->runner->post)
@@
-406,6
+404,7
@@
int main(int argc, char *argv[])
cleanup:
world->shutdown(creators_ptr);
cleanup:
world->shutdown(creators_ptr);
+ Logn();
}
if (not is_shutdown())
}
if (not is_shutdown())
diff --git
a/tests/mem_functions.cc
b/tests/mem_functions.cc
index f70dbba432db281a3b457c3326f72b584fc7e8be..5476f8bdfd04ea4ad3cac4b1bf184d32e4ca4e23 100644
(file)
--- a/
tests/mem_functions.cc
+++ b/
tests/mem_functions.cc
@@
-6466,6
+6466,7
@@
test_st parser_tests[] ={
{"server with weights", 0, (test_callback_fn*)server_with_weight_test },
{"parsing servername, port, and weight", 0, (test_callback_fn*)test_hostname_port_weight },
{"--socket=", 0, (test_callback_fn*)test_parse_socket },
{"server with weights", 0, (test_callback_fn*)server_with_weight_test },
{"parsing servername, port, and weight", 0, (test_callback_fn*)test_hostname_port_weight },
{"--socket=", 0, (test_callback_fn*)test_parse_socket },
+ {"--namespace=", 0, (test_callback_fn*)test_namespace_keyword },
{0, 0, (test_callback_fn*)0}
};
{0, 0, (test_callback_fn*)0}
};
diff --git
a/tests/parser.cc
b/tests/parser.cc
index f1020ff45f6471f15412218bf4e9295687a16b2f..c53c0512538c108afda7a9d947bd68f2ea037c44 100644
(file)
--- a/
tests/parser.cc
+++ b/
tests/parser.cc
@@
-98,16
+98,11
@@
static test_return_t __check_host(memcached_st *memc, const scanner_string_st &h
}
// Check and make sure the prefix_key is what we expect it to be
}
// Check and make sure the prefix_key is what we expect it to be
-static test_return_t __check_
prefix_key(memcached_st *memc, const scanner_string_st &hostname
)
+static test_return_t __check_
namespace(memcached_st *memc, const scanner_string_st &arg
)
{
{
- memcached_server_instance_st instance=
- memcached_server_instance_by_position(memc, 0);
-
- test_true(instance);
-
- const char *first_hostname = memcached_server_name(instance);
- test_true(first_hostname);
- test_strcmp(first_hostname, hostname.c_str);
+ const char *_namespace = memcached_get_namespace(memc);
+ test_true(_namespace);
+ test_strcmp(_namespace, arg.c_str);
return TEST_SUCCESS;
}
return TEST_SUCCESS;
}
@@
-206,10
+201,10
@@
scanner_variable_t test_boolean_options[]= {
{ NIL, scanner_string_null, scanner_string_null, NULL}
};
{ NIL, scanner_string_null, scanner_string_null, NULL}
};
-scanner_variable_t
prefix_key
_strings[]= {
- { ARRAY, make_scanner_string("--NAMESPACE=foo"), make_scanner_string("foo"), __check_
prefix_key
},
- { ARRAY, make_scanner_string("--NAMESPACE=\"foo\""), make_scanner_string("foo"), __check_
prefix_key
},
- { ARRAY, make_scanner_string("--NAMESPACE=\"This_is_a_very_long_key\""), make_scanner_string("This_is_a_very_long_key"), __check_
prefix_key
},
+scanner_variable_t
namespace
_strings[]= {
+ { ARRAY, make_scanner_string("--NAMESPACE=foo"), make_scanner_string("foo"), __check_
namespace
},
+ { ARRAY, make_scanner_string("--NAMESPACE=\"foo\""), make_scanner_string("foo"), __check_
namespace
},
+ { ARRAY, make_scanner_string("--NAMESPACE=\"This_is_a_very_long_key\""), make_scanner_string("This_is_a_very_long_key"), __check_
namespace
},
{ NIL, scanner_string_null, scanner_string_null, NULL}
};
{ NIL, scanner_string_null, scanner_string_null, NULL}
};
@@
-322,6
+317,11
@@
test_return_t parser_key_prefix_test(memcached_st*)
return _test_option(distribution_strings);
}
return _test_option(distribution_strings);
}
+test_return_t test_namespace_keyword(memcached_st*)
+{
+ return _test_option(namespace_strings);
+}
+
#define SUPPORT_EXAMPLE_CNF "support/example.cnf"
test_return_t memcached_create_with_options_with_filename(memcached_st*)
#define SUPPORT_EXAMPLE_CNF "support/example.cnf"
test_return_t memcached_create_with_options_with_filename(memcached_st*)
@@
-443,7
+443,7
@@
test_return_t random_statement_build_test(memcached_st*)
for (scanner_variable_t *ptr= test_boolean_options; ptr->type != NIL; ptr++)
option_list.push_back(&ptr->option);
for (scanner_variable_t *ptr= test_boolean_options; ptr->type != NIL; ptr++)
option_list.push_back(&ptr->option);
- for (scanner_variable_t *ptr=
prefix_key
_strings; ptr->type != NIL; ptr++)
+ for (scanner_variable_t *ptr=
namespace
_strings; ptr->type != NIL; ptr++)
option_list.push_back(&ptr->option);
for (scanner_variable_t *ptr= distribution_strings; ptr->type != NIL; ptr++)
option_list.push_back(&ptr->option);
for (scanner_variable_t *ptr= distribution_strings; ptr->type != NIL; ptr++)
diff --git
a/tests/parser.h
b/tests/parser.h
index 11b5368fe1ffa0b779e0a1fe438bca2426d22934..05272ee6b18852935f6371694574ebbd4a3cfa8c 100644
(file)
--- a/
tests/parser.h
+++ b/
tests/parser.h
@@
-107,6
+107,9
@@
test_return_t regression_bug_71231153_poll(memcached_st *);
LIBTEST_INTERNAL_API
test_return_t test_parse_socket(memcached_st *);
LIBTEST_INTERNAL_API
test_return_t test_parse_socket(memcached_st *);
+LIBTEST_INTERNAL_API
+test_return_t test_namespace_keyword(memcached_st*);
+
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif