Merge lp://staging/~trond-norbye/libmemcached/bug_446766 into lp://staging/~tangent-org/libmemcached/trunk

Proposed by Trond Norbye
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~trond-norbye/libmemcached/bug_446766
Merge into: lp://staging/~tangent-org/libmemcached/trunk
Diff against target: 61 lines
1 file modified
tests/function.c (+13/-8)
To merge this branch: bzr merge lp://staging/~trond-norbye/libmemcached/bug_446766
Reviewer Review Type Date Requested Status
Libmemcached-developers Pending
Review via email: mp+13109@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Trond Norbye (trond-norbye) wrote :

The user_supplied_bug21 tried to run commands using the binary protocol without checking if the server supports the binary protocol. If the server doesn't support the binary protocol it will just spool up data until it encounters a '\n' in the command before it starts parsing the command.

This fix tests if the server support the binary protocol and terminates the test if the server doesn't support it.

Cheers,

Trond

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/function.c'
2--- tests/function.c 2009-10-08 21:09:00 +0000
3+++ tests/function.c 2009-10-09 07:10:21 +0000
4@@ -1645,7 +1645,7 @@
5 return TEST_SUCCESS;
6 }
7
8-static test_return fetch_all_results(memcached_st *memc)
9+static test_return fetch_all_results(memcached_st *memc)
10 {
11 memcached_return rc= MEMCACHED_SUCCESS;
12 char return_key[MEMCACHED_MAX_KEY];
13@@ -1654,7 +1654,7 @@
14 size_t return_value_length;
15 uint32_t flags;
16
17- while ((return_value= memcached_fetch(memc, return_key, &return_key_length,
18+ while ((return_value= memcached_fetch(memc, return_key, &return_key_length,
19 &return_value_length, &flags, &rc)))
20 {
21 assert(return_value);
22@@ -2544,7 +2544,12 @@
23 * http://lists.tangent.org/pipermail/libmemcached/2009-August/000918.html
24 */
25
26-void fail(int); /* sighandler_t function that always asserts false */
27+/* sighandler_t function that always asserts false */
28+static void fail(int unused __attribute__((unused)))
29+{
30+ assert(0);
31+}
32+
33
34 static test_return _user_supplied_bug21(memcached_st* memc, size_t key_count)
35 {
36@@ -2598,8 +2603,13 @@
37 return TEST_SUCCESS;
38 }
39
40+static memcached_return pre_binary(memcached_st *memc);
41+
42 static test_return user_supplied_bug21(memcached_st *memc)
43 {
44+ if (pre_binary(memc) != TEST_SUCCESS)
45+ return TEST_SUCCESS;
46+
47 test_return rc;
48
49 /* should work as of r580 */
50@@ -2613,11 +2623,6 @@
51 return TEST_SUCCESS;
52 }
53
54-void fail(int unused __attribute__((unused)))
55-{
56- assert(0);
57-}
58-
59 static test_return auto_eject_hosts(memcached_st *trash)
60 {
61 (void) trash;

Subscribers

People subscribed via source and target branches

to all changes: