tests/mem_functions.cc
/* Test case provided by Cal Haldenbrand */
Test case provided by Cal Haldenbrand
Test case provided by Cal Haldenbrand
static test_return_t user_supplied_bug2(memcached_st *memc)
{
  unsigned int setter= 1;
  test_compare(MEMCACHED_SUCCESS,
               memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter));
  test_compare(MEMCACHED_SUCCESS,
               memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter));
#ifdef NOT_YET
  setter = 20 * 1024576;
  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, setter);
  setter = 20 * 1024576;
  memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, setter);
  getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE);
  getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE);
  for (x= 0, errors= 0; total < 20 * 1024576 ; x++)
#endif
  size_t total_value_length= 0;
  for (uint32_t x= 0, errors= 0; total_value_length < 24576 ; x++)
  {
    uint32_t flags= 0;
    size_t val_len= 0;
    char key[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1];
    int key_length= snprintf(key, sizeof(key), "%u", x);
    memcached_return_t rc;
    char *getval= memcached_get(memc, key, key_length, &val_len, &flags, &rc);
    if (memcached_failed(rc))
    {
      if (rc == MEMCACHED_NOTFOUND)
      {
        errors++;
      }
      else
      {
        test_true(rc);
      }
      continue;
    }
    test_compare(uint32_t(HALDENBRAND_FLAG_KEY), flags);
    total_value_length+= val_len;
    errors= 0;
    free(getval);
  }
  return TEST_SUCCESS;
}
static test_return_t user_supplied_bug2 ( memcached_st * memc ) { unsigned int setter = 1 ; test_compare ( MEMCACHED_SUCCESS , memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_NO_BLOCK , setter ) ) ; test_compare ( MEMCACHED_SUCCESS , memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_TCP_NODELAY , setter ) ) ; #ifdef NOT_YET setter = 20 * 1024576 ; memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE , setter ) ; setter = 20 * 1024576 ; memcached_behavior_set ( memc , MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE , setter ) ; getter = memcached_behavior_get ( memc , MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE ) ; getter = memcached_behavior_get ( memc , MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE ) ; for ( x = 0 , errors = 0 ; total < 20 * 1024576 ; x ++ ) #endif size_t total_value_length = 0 ; for ( uint32_t x = 0 , errors = 0 ; total_value_length < 24576 ; x ++ ) { uint32_t flags = 0 ; size_t val_len = 0 ; char key [ MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH + 1 ] ; int key_length = snprintf ( key , sizeof ( key ) , " " , x ) ; memcached_return_t rc ; char * getval = memcached_get ( memc , key , key_length , & val_len , & flags , & rc ) ; if ( memcached_failed ( rc ) ) { if ( rc == MEMCACHED_NOTFOUND ) { errors ++ ; } else { test_true ( rc ) ; } continue ; } test_compare ( uint32_t ( HALDENBRAND_FLAG_KEY ) , flags ) ; total_value_length += val_len ; errors = 0 ; free ( getval ) ; } return TEST_SUCCESS ; }
Test case provided by Cal Haldenbrand
Test case provided by Cal Haldenbrand