tests/mem_functions.cc
/* We are testing with aggressive timeout to get failures */
We are testing with aggressive timeout to get failures
We are testing with aggressive timeout to get failures
static test_return_t user_supplied_bug10(memcached_st *memc)
{
  size_t value_length= 512;
  unsigned int set= 1;
  memcached_st *mclone= memcached_clone(NULL, memc);
  memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_NO_BLOCK, set);
  memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_TCP_NODELAY, set);
  memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, uint64_t(0));
  char *value= (char*)malloc(value_length * sizeof(char));
  for (unsigned int x= 0; x < value_length; x++)
  {
    value[x]= (char) (x % 127);
  }
  for (unsigned int x= 1; x <= 100000; ++x)
  {
    memcached_return_t rc= memcached_set(mclone,
                                         test_literal_param("foo"),
                                         value, value_length, 0, 0);
    test_true_got((rc == MEMCACHED_SUCCESS or rc == MEMCACHED_WRITE_FAILURE or rc == MEMCACHED_BUFFERED or rc == MEMCACHED_TIMEOUT or rc == MEMCACHED_CONNECTION_FAILURE
                  or rc == MEMCACHED_SERVER_TEMPORARILY_DISABLED),
                  memcached_strerror(NULL, rc));
    if (rc == MEMCACHED_WRITE_FAILURE or rc == MEMCACHED_TIMEOUT)
    {
      x--;
    }
  }
  free(value);
  memcached_free(mclone);
  return TEST_SUCCESS;
}
static test_return_t user_supplied_bug10 ( memcached_st * memc ) { size_t value_length = 512 ; unsigned int set = 1 ; memcached_st * mclone = memcached_clone ( NULL , memc ) ; memcached_behavior_set ( mclone , MEMCACHED_BEHAVIOR_NO_BLOCK , set ) ; memcached_behavior_set ( mclone , MEMCACHED_BEHAVIOR_TCP_NODELAY , set ) ; memcached_behavior_set ( mclone , MEMCACHED_BEHAVIOR_POLL_TIMEOUT , uint64_t ( 0 ) ) ; char * value = ( char * ) malloc ( value_length * sizeof ( char ) ) ; for ( unsigned int x = 0 ; x < value_length ; x ++ ) { value [ x ] = ( char ) ( x % 127 ) ; } for ( unsigned int x = 1 ; x <= 100000 ; ++ x ) { memcached_return_t rc = memcached_set ( mclone , test_literal_param ( " " ) , value , value_length , 0 , 0 ) ; test_true_got ( ( rc == MEMCACHED_SUCCESS or rc == MEMCACHED_WRITE_FAILURE or rc == MEMCACHED_BUFFERED or rc == MEMCACHED_TIMEOUT or rc == MEMCACHED_CONNECTION_FAILURE or rc == MEMCACHED_SERVER_TEMPORARILY_DISABLED ) , memcached_strerror ( NULL , rc ) ) ; if ( rc == MEMCACHED_WRITE_FAILURE or rc == MEMCACHED_TIMEOUT ) { x -- ; } } free ( value ) ; memcached_free ( mclone ) ; return TEST_SUCCESS ; }
We are testing with aggressive timeout to get failures
We are testing with aggressive timeout to get failures