~brianaker/libmemcached/rpm-mkdir-fix

« back to all changes in this revision

Viewing changes to tests/libmemcached_world_socket.h

  • Committer: Continuous Integration
  • Date: 2012-04-22 08:15:51 UTC
  • mfrom: (999.2.1 workspace)
  • Revision ID: ci@tangent.org-20120422081551-91smln8nbgx0xk4l
jenkins-promote-staging-trunk-libmemcached-12

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
#include <cassert>
43
43
 
44
 
/* The structure we use for the test system */
45
 
struct libmemcached_test_container_st
46
 
{
47
 
  libtest::server_startup_st& construct;
48
 
  memcached_st *parent;
49
 
  memcached_st *memc;
50
 
 
51
 
  libmemcached_test_container_st(libtest::server_startup_st &construct_arg) :
52
 
    construct(construct_arg),
53
 
    parent(NULL),
54
 
    memc(NULL)
55
 
  { }
56
 
};
 
44
#include "tests/libmemcached_test_container.h"
57
45
 
58
46
static void *world_create(libtest::server_startup_st& servers, test_return_t& error)
59
47
{
80
68
  return global_container;
81
69
}
82
70
 
83
 
static test_return_t world_container_startup(libmemcached_test_container_st *container)
84
 
{
85
 
  char buffer[BUFSIZ];
86
 
 
87
 
  test_compare_got(MEMCACHED_SUCCESS,
88
 
                   libmemcached_check_configuration(container->construct.option_string().c_str(), container->construct.option_string().size(),
89
 
                                                    buffer, sizeof(buffer)),
90
 
                   container->construct.option_string().c_str());
91
 
 
92
 
  test_null(container->parent);
93
 
  container->parent= memcached(container->construct.option_string().c_str(), container->construct.option_string().size());
94
 
  test_true(container->parent);
95
 
  test_compare(MEMCACHED_SUCCESS, memcached_version(container->parent));
96
 
 
97
 
  if (container->construct.sasl())
98
 
  {
99
 
    if (memcached_failed(memcached_behavior_set(container->parent, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1)))
100
 
    {
101
 
      memcached_free(container->parent);
102
 
      return TEST_FAILURE;
103
 
    }
104
 
 
105
 
    if (memcached_failed(memcached_set_sasl_auth_data(container->parent, container->construct.username().c_str(), container->construct.password().c_str())))
106
 
    {
107
 
      memcached_free(container->parent);
108
 
      return TEST_FAILURE;
109
 
    }
110
 
  }
111
 
 
112
 
  return TEST_SUCCESS;
113
 
}
114
 
 
115
 
static test_return_t world_container_shutdown(libmemcached_test_container_st *container)
116
 
{
117
 
  memcached_free(container->parent);
118
 
  container->parent= NULL;
119
 
 
120
 
  return TEST_SUCCESS;
121
 
}
122
 
 
123
 
static test_return_t world_test_startup(libmemcached_test_container_st *container)
124
 
{
125
 
  test_true(container);
126
 
  test_null(container->memc);
127
 
  test_true(container->parent);
128
 
  container->memc= memcached_clone(NULL, container->parent);
129
 
  test_true(container->memc);
130
 
 
131
 
  return TEST_SUCCESS;
132
 
}
133
 
 
134
 
test_return_t world_flush(libmemcached_test_container_st *container);
135
 
test_return_t world_flush(libmemcached_test_container_st *container)
136
 
{
137
 
  test_true(container->memc);
138
 
  memcached_flush(container->memc, 0);
139
 
  memcached_quit(container->memc);
140
 
 
141
 
  return TEST_SUCCESS;
142
 
}
143
 
 
144
 
static test_return_t world_on_error(test_return_t , libmemcached_test_container_st *container)
145
 
{
146
 
  test_true(container->memc);
147
 
  memcached_free(container->memc);
148
 
  container->memc= NULL;
149
 
 
150
 
  return TEST_SUCCESS;
151
 
}
152
 
 
153
71
static bool world_destroy(void *object)
154
72
{
155
73
  libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;