+ * We removed the MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE added in 0.35. Instead use
+ memcached_behavior_set_distribution().
+
0.35 Mon Nov 9 11:18:33 PST 2009
* Added support for by_key operations for inc/dec methods.
* Added mget test to memslap.
#include <sys/socket.h>
#include <netinet/tcp.h>
+static bool set_flag(uint64_t data)
+{
+ // Wordy :)
+ return data ? true : false;
+}
+
+static memcached_return_t set_hash(memcached_hash_t *store, memcached_hash_t type)
+{
+#ifndef HAVE_HSIEH_HASH
+ if (type == MEMCACHED_HASH_HSIEH)
+ return MEMCACHED_FAILURE;
+#endif
+ if (type < MEMCACHED_HASH_MAX)
+ {
+ *store= type;
+ }
+ else
+ {
+ return MEMCACHED_FAILURE;
+ }
+
+ return MEMCACHED_SUCCESS;
+}
/*
This function is used to modify the behavior of running client.
break;
case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL:
if (data)
- ptr->flags.verify_key= false;
-
- ptr->flags.binary_protocol= data ? true : false;
+ {
+ ptr->flags.verify_key= false;
+ }
+ ptr->flags.binary_protocol= set_flag(data);
break;
case MEMCACHED_BEHAVIOR_SUPPORT_CAS:
- ptr->flags.support_cas= data ? true: false;
+ ptr->flags.support_cas= set_flag(data);
break;
case MEMCACHED_BEHAVIOR_NO_BLOCK:
- ptr->flags.no_block= data ? true: false;
+ ptr->flags.no_block= set_flag(data);
memcached_quit(ptr);
break;
case MEMCACHED_BEHAVIOR_BUFFER_REQUESTS:
- ptr->flags.buffer_requests= data ? true : false;
+ ptr->flags.buffer_requests= set_flag(data);
memcached_quit(ptr);
break;
case MEMCACHED_BEHAVIOR_USE_UDP:
if (ptr->number_of_hosts)
+ {
return MEMCACHED_FAILURE;
- ptr->flags.use_udp= data ? true : false;
-
+ }
+ ptr->flags.use_udp= set_flag(data);
if (data)
- ptr->flags.no_reply= data ? true : false;
+ {
+ ptr->flags.no_reply= set_flag(data);
+ }
break;
-
case MEMCACHED_BEHAVIOR_TCP_NODELAY:
- ptr->flags.tcp_nodelay= data ? true : false;
+ ptr->flags.tcp_nodelay= set_flag(data);
memcached_quit(ptr);
break;
case MEMCACHED_BEHAVIOR_DISTRIBUTION:
- {
- ptr->distribution= (memcached_server_distribution_t)(data);
- if (ptr->distribution == MEMCACHED_DISTRIBUTION_RANDOM)
- {
- srandom((uint32_t) time(NULL));
- }
- run_distribution(ptr);
- break;
- }
+ return memcached_behavior_set_distribution(ptr, (memcached_server_distribution_t)data);
case MEMCACHED_BEHAVIOR_KETAMA:
{
if (data)
{
- ptr->hash= MEMCACHED_HASH_MD5;
- ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA;
+ (void)memcached_behavior_set_key_hash(ptr, MEMCACHED_HASH_MD5);
+ (void)memcached_behavior_set_distribution_hash(ptr, MEMCACHED_HASH_MD5);
+ (void)memcached_behavior_set_distribution(ptr, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA);
}
else
{
- ptr->hash= 0;
- ptr->distribution= 0;
+ (void)memcached_behavior_set_key_hash(ptr, MEMCACHED_HASH_DEFAULT);
+ (void)memcached_behavior_set_distribution_hash(ptr, MEMCACHED_HASH_DEFAULT);
+ (void)memcached_behavior_set_distribution(ptr, MEMCACHED_DISTRIBUTION_MODULA);
}
- run_distribution(ptr);
+
break;
}
case MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED:
{
- ptr->hash= MEMCACHED_HASH_MD5;
- ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA;
- ptr->flags.ketama_weighted= data ? true : false;
- run_distribution(ptr);
- break;
- }
- case MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE:
- switch (data)
- {
- case MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED:
- ptr->hash= MEMCACHED_HASH_MD5;
- ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA;
- break;
- case MEMCACHED_KETAMA_COMPAT_SPY:
- ptr->hash= MEMCACHED_HASH_MD5;
- ptr->distribution= MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY;
- break;
- default:
- return MEMCACHED_FAILURE;
+ (void)memcached_behavior_set_key_hash(ptr, MEMCACHED_HASH_MD5);
+ (void)memcached_behavior_set_distribution_hash(ptr, MEMCACHED_HASH_MD5);
+ ptr->flags.ketama_weighted= set_flag(data);
+ /**
+ @note We try to keep the same distribution going. This should be deprecated and rewritten.
+ */
+ return memcached_behavior_set_distribution(ptr, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA);
}
- run_distribution(ptr);
- break;
case MEMCACHED_BEHAVIOR_HASH:
-#ifndef HAVE_HSIEH_HASH
- if ((memcached_hash_t)(data) == MEMCACHED_HASH_HSIEH)
- return MEMCACHED_FAILURE;
-#endif
- ptr->hash= (memcached_hash_t)(data);
- break;
+ return memcached_behavior_set_key_hash(ptr, (memcached_hash_t)(data));
case MEMCACHED_BEHAVIOR_KETAMA_HASH:
- ptr->hash_continuum= (memcached_hash_t)(data);
- run_distribution(ptr);
- break;
+ return memcached_behavior_set_distribution_hash(ptr, (memcached_hash_t)(data));
case MEMCACHED_BEHAVIOR_CACHE_LOOKUPS:
- ptr->flags.use_cache_lookups= data ? true : false;
+ ptr->flags.use_cache_lookups= set_flag(data);
memcached_quit(ptr);
break;
case MEMCACHED_BEHAVIOR_VERIFY_KEY:
if (ptr->flags.binary_protocol)
- break;
- ptr->flags.verify_key= data ? true : false;
+ return MEMCACHED_FAILURE;
+ ptr->flags.verify_key= set_flag(data);
break;
case MEMCACHED_BEHAVIOR_SORT_HOSTS:
{
- ptr->flags.use_sort_hosts= data ? true : false;
+ ptr->flags.use_sort_hosts= set_flag(data);
run_distribution(ptr);
break;
case MEMCACHED_BEHAVIOR_USER_DATA:
return MEMCACHED_FAILURE;
case MEMCACHED_BEHAVIOR_HASH_WITH_PREFIX_KEY:
- ptr->flags.hash_with_prefix_key= data ? true : false;
+ ptr->flags.hash_with_prefix_key= set_flag(data);
break;
case MEMCACHED_BEHAVIOR_NOREPLY:
- ptr->flags.no_reply= data ? true : false;
+ ptr->flags.no_reply= set_flag(data);
break;
case MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS:
- ptr->flags.auto_eject_hosts= data ? true : false;
+ ptr->flags.auto_eject_hosts= set_flag(data);
break;
case MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ:
srandom((uint32_t) time(NULL));
- ptr->flags.randomize_replica_read= data ? true : false;
+ ptr->flags.randomize_replica_read= set_flag(data);
break;
+ case MEMCACHED_BEHAVIOR_MAX:
default:
/* Shouldn't get here */
- WATCHPOINT_ASSERT(flag);
+ WATCHPOINT_ASSERT(0);
+ return MEMCACHED_FAILURE;
break;
}
return ptr->distribution;
case MEMCACHED_BEHAVIOR_KETAMA:
return (ptr->distribution == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) ? (uint64_t) 1 : 0;
- case MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE:
- switch (ptr->distribution)
- {
- case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA:
- return MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED;
- case MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY:
- return MEMCACHED_KETAMA_COMPAT_SPY;
- case MEMCACHED_DISTRIBUTION_MODULA:
- case MEMCACHED_DISTRIBUTION_CONSISTENT:
- case MEMCACHED_DISTRIBUTION_RANDOM:
- default:
- return (uint64_t)-1;
- }
- /* NOTREACHED */
case MEMCACHED_BEHAVIOR_HASH:
return ptr->hash;
case MEMCACHED_BEHAVIOR_KETAMA_HASH:
- return ptr->hash_continuum;
+ return ptr->distribution_hash;
case MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT:
return ptr->server_failure_limit;
case MEMCACHED_BEHAVIOR_SORT_HOSTS:
int sock_size;
socklen_t sock_length= sizeof(int);
- /* REFACTOR */
+ /**
+ @note REFACTOR
+ */
/* We just try the first host, and if it is down we return zero */
if ((memcached_connect(&ptr->hosts[0])) != MEMCACHED_SUCCESS)
return 0;
return ptr->flags.auto_eject_hosts;
case MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ:
return ptr->flags.randomize_replica_read;
+ case MEMCACHED_BEHAVIOR_MAX:
default:
- WATCHPOINT_ASSERT(flag);
- break;
+ WATCHPOINT_ASSERT(0); /* Programming mistake if it gets this far */
+ return 0;
+ }
+
+ /* NOTREACHED */
+}
+
+
+memcached_return_t memcached_behavior_set_distribution(memcached_st *ptr, memcached_server_distribution_t type)
+{
+ if (type < MEMCACHED_DISTRIBUTION_CONSISTENT_MAX)
+ {
+ ptr->distribution= type;
+ run_distribution(ptr);
}
+ else
+ {
+ return MEMCACHED_FAILURE;
+ }
+
+ return MEMCACHED_SUCCESS;
+}
+
+
+memcached_server_distribution_t memcached_behavior_get_distribution(memcached_st *ptr)
+{
+ return ptr->distribution;
+}
- WATCHPOINT_ASSERT(0); /* Programming mistake if it gets this far */
- return 0;
+memcached_return_t memcached_behavior_set_key_hash(memcached_st *ptr, memcached_hash_t type)
+{
+ return set_hash(&ptr->hash, type);
+}
+
+memcached_hash_t memcached_behavior_get_key_hash(memcached_st *ptr)
+{
+ return ptr->hash;
+}
+
+memcached_return_t memcached_behavior_set_distribution_hash(memcached_st *ptr, memcached_hash_t type)
+{
+ return set_hash(&ptr->distribution_hash, type);
+}
+
+memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr)
+{
+ return ptr->distribution_hash;
}
LIBMEMCACHED_API
uint64_t memcached_behavior_get(memcached_st *ptr, const memcached_behavior_t flag);
+LIBMEMCACHED_API
+memcached_return_t memcached_behavior_set_distribution(memcached_st *ptr, memcached_server_distribution_t type);
+
+LIBMEMCACHED_API
+memcached_server_distribution_t memcached_behavior_get_distribution(memcached_st *ptr);
+
+LIBMEMCACHED_API
+memcached_return_t memcached_behavior_set_key_hash(memcached_st *ptr, memcached_hash_t type);
+
+LIBMEMCACHED_API
+memcached_hash_t memcached_behavior_get_key_hash(memcached_st *ptr);
+
+LIBMEMCACHED_API
+memcached_return_t memcached_behavior_set_distribution_hash(memcached_st *ptr, memcached_hash_t type);
+
+LIBMEMCACHED_API
+memcached_hash_t memcached_behavior_get_distribution_hash(memcached_st *ptr);
+
#ifdef __cplusplus
}
ptr->delete_trigger= func;
break;
}
+ case MEMCACHED_CALLBACK_MAX:
default:
return MEMCACHED_FAILURE;
}
*error= ptr->delete_trigger ? MEMCACHED_SUCCESS : MEMCACHED_FAILURE;
return *(void **)&ptr->delete_trigger;
}
+ case MEMCACHED_CALLBACK_MAX:
default:
WATCHPOINT_ASSERT(0);
*error= MEMCACHED_FAILURE;
if (curr_time.tv_sec < ptr->next_retry)
{
if (memcached_behavior_get(ptr->root, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS))
+ {
run_distribution(ptr->root);
+ }
ptr->root->last_disconnected_server = ptr;
return MEMCACHED_SERVER_MARKED_DEAD;
case MEMCACHED_CONNECTION_UNIX_SOCKET:
rc= unix_socket_connect(ptr);
break;
+ case MEMCACHED_CONNECTION_MAX:
default:
WATCHPOINT_ASSERT(0);
}
MEMCACHED_DISTRIBUTION_CONSISTENT,
MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA,
MEMCACHED_DISTRIBUTION_RANDOM,
- MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY
+ MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY,
+ MEMCACHED_DISTRIBUTION_CONSISTENT_MAX
} memcached_server_distribution_t;
typedef enum {
MEMCACHED_BEHAVIOR_USE_UDP,
MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS,
MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS,
- MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE,
- MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ
+ MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ,
+ MEMCACHED_BEHAVIOR_MAX
} memcached_behavior_t;
-#define MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED 0
-#define MEMCACHED_KETAMA_COMPAT_SPY 1
-
typedef enum {
MEMCACHED_CALLBACK_PREFIX_KEY = 0,
MEMCACHED_CALLBACK_USER_DATA = 1,
MEMCACHED_CALLBACK_FREE_FUNCTION = 6,
#endif
MEMCACHED_CALLBACK_GET_FAILURE = 7,
- MEMCACHED_CALLBACK_DELETE_TRIGGER = 8
+ MEMCACHED_CALLBACK_DELETE_TRIGGER = 8,
+ MEMCACHED_CALLBACK_MAX
} memcached_callback_t;
typedef enum {
MEMCACHED_HASH_FNV1A_32,
MEMCACHED_HASH_HSIEH,
MEMCACHED_HASH_MURMUR,
- MEMCACHED_HASH_JENKINS
+ MEMCACHED_HASH_JENKINS,
+ MEMCACHED_HASH_MAX
} memcached_hash_t;
typedef enum {
MEMCACHED_CONNECTION_UNKNOWN,
MEMCACHED_CONNECTION_TCP,
MEMCACHED_CONNECTION_UDP,
- MEMCACHED_CONNECTION_UNIX_SOCKET
+ MEMCACHED_CONNECTION_UNIX_SOCKET,
+ MEMCACHED_CONNECTION_MAX
} memcached_connection_t;
#endif /* __MEMCACHED_CONSTANTS_H__ */
}
case MEMCACHED_HASH_JENKINS:
{
- hash=jenkins_hash(key, key_length, 13);
+ hash= jenkins_hash(key, key_length, 13);
break;
}
+ case MEMCACHED_HASH_MAX:
default:
{
- WATCHPOINT_ASSERT(hash_algorithm);
+ WATCHPOINT_ASSERT(0);
break;
}
}
+
return hash;
}
return hash % ptr->number_of_hosts;
case MEMCACHED_DISTRIBUTION_RANDOM:
return (uint32_t) random() % ptr->number_of_hosts;
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX:
default:
WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */
return hash % ptr->number_of_hosts;
}
-
/* NOTREACHED */
}
WATCHPOINT_ASSERT(hash);
- if (memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS) && ptr->next_distribution_rebuild) {
+ if (memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS) && ptr->next_distribution_rebuild)
+ {
struct timeval now;
if (gettimeofday(&now, NULL) == 0 &&
now.tv_sec > ptr->next_distribution_rebuild)
+ {
run_distribution(ptr);
+ }
}
return dispatch_host(ptr, hash);
sort_hosts(ptr);
break;
case MEMCACHED_DISTRIBUTION_RANDOM:
+ srandom((uint32_t) time(NULL));
break;
+ case MEMCACHED_DISTRIBUTION_CONSISTENT_MAX:
default:
WATCHPOINT_ASSERT(0); /* We have added a distribution without extending the logic */
}
}
else
{
- value= memcached_generate_hash_value(sort_host, sort_host_length, ptr->hash_continuum);
+ value= memcached_generate_hash_value(sort_host, sort_host_length, ptr->distribution_hash);
ptr->continuum[continuum_index].index= host_index;
ptr->continuum[continuum_index++].value= value;
}
}
else
{
- value= memcached_generate_hash_value(sort_host, sort_host_length, ptr->hash_continuum);
+ value= memcached_generate_hash_value(sort_host, sort_host_length, ptr->distribution_hash);
ptr->continuum[continuum_index].index= host_index;
ptr->continuum[continuum_index++].value= value;
}
new_clone->retry_timeout= source->retry_timeout;
new_clone->distribution= source->distribution;
new_clone->hash= source->hash;
- new_clone->hash_continuum= source->hash_continuum;
+ new_clone->distribution_hash= source->distribution_hash;
new_clone->user_data= source->user_data;
new_clone->snd_timeout= source->snd_timeout;
}
rc= run_distribution(new_clone);
+
if (rc != MEMCACHED_SUCCESS)
{
memcached_free(new_clone);
return new_clone;
}
+
void *memcached_get_user_data(memcached_st *ptr)
{
return ptr->user_data;
{
void *ret= ptr->user_data;
ptr->user_data= data;
+
return ret;
}
void *user_data;
time_t next_distribution_rebuild;
size_t prefix_key_length;
- memcached_hash_t hash_continuum;
+ memcached_hash_t distribution_hash;
memcached_result_st result;
memcached_continuum_item_st *continuum;
memcached_clone_fn on_clone;
}
test_truth(memc_clone->get_key_failure == memc->get_key_failure);
test_truth(memc_clone->hash == memc->hash);
- test_truth(memc_clone->hash_continuum == memc->hash_continuum);
+ test_truth(memc_clone->distribution_hash == memc->distribution_hash);
test_truth(memc_clone->io_bytes_watermark == memc->io_bytes_watermark);
test_truth(memc_clone->io_msg_watermark == memc->io_msg_watermark);
test_truth(memc_clone->io_key_prefetch == memc->io_key_prefetch);
unsigned int set= 1;
size_t max_keylen= 0xffff;
+ // Just skip if we are in binary mode.
+ if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
+ return TEST_SKIPPED;
+
memc_clone= memcached_clone(NULL, memc);
test_truth(memc_clone);
{
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
char *hostname = memc->hosts[server_idx].hostname;
- test_truth(strcmp(hostname, ketama_test_cases[x].server) == 0);
+ test_strcmp(hostname, ketama_test_cases[x].server);
}
memcached_server_list_free(server_pool);
test_truth(value == MEMCACHED_HASH_MD5);
- test_truth(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE,
- MEMCACHED_KETAMA_COMPAT_SPY) == MEMCACHED_SUCCESS);
+ test_truth(memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY) == MEMCACHED_SUCCESS);
memcached_server_st *server_pool;
server_pool = memcached_servers_parse("10.0.1.1:11211,10.0.1.2:11211,10.0.1.3:11211,10.0.1.4:11211,10.0.1.5:11211,10.0.1.6:11211,10.0.1.7:11211,10.0.1.8:11211,192.168.1.1:11211,192.168.100.1:11211");
(void)trash;
memc= memcached_create(NULL);
- assert(memc);
+ test_truth(memc);
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1);
- assert(rc == MEMCACHED_SUCCESS);
+ test_truth(rc == MEMCACHED_SUCCESS);
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
- assert(value == 1);
+ test_truth(value == 1);
- assert(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE,
- MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED) == MEMCACHED_SUCCESS);
+ test_truth(memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) == MEMCACHED_SUCCESS);
+ test_truth(memcached_behavior_get_distribution(memc) == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA);
- assert(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE) ==
- MEMCACHED_KETAMA_COMPAT_LIBMEMCACHED);
server_pool = memcached_servers_parse("10.0.1.1:11211 600,10.0.1.2:11211 300,10.0.1.3:11211 200,10.0.1.4:11211 350,10.0.1.5:11211 1000,10.0.1.6:11211 800,10.0.1.7:11211 950,10.0.1.8:11211 100");
memcached_server_push(memc, server_pool);
(void)trash;
memc= memcached_create(NULL);
- assert(memc);
+ test_truth(memc);
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1);
- assert(rc == MEMCACHED_SUCCESS);
+ test_truth(rc == MEMCACHED_SUCCESS);
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
- assert(value == 1);
-
- assert(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE,
- MEMCACHED_KETAMA_COMPAT_SPY) == MEMCACHED_SUCCESS);
+ test_truth(value == 1);
- assert(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE) ==
- MEMCACHED_KETAMA_COMPAT_SPY);
+ test_truth(memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY) == MEMCACHED_SUCCESS);
+ test_truth(memcached_behavior_get_distribution(memc) == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY);
server_pool = memcached_servers_parse("10.0.1.1:11211 600,10.0.1.2:11211 300,10.0.1.3:11211 200,10.0.1.4:11211 350,10.0.1.5:11211 1000,10.0.1.6:11211 800,10.0.1.7:11211 950,10.0.1.8:11211 100");
memcached_server_push(memc, server_pool);
do \
{ \
if (! (A)) { \
- fprintf(stderr, "Assertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\
+ fprintf(stderr, "\nAssertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\
create_core(); \
return TEST_FAILURE; \
} \
do \
{ \
if ((A)) { \
- fprintf(stderr, "Assertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\
+ fprintf(stderr, "\nAssertion failed in %s:%d: %s\n", __FILE__, __LINE__, #A);\
create_core(); \
return TEST_FAILURE; \
} \
{ \
if (strcmp((A), (B))) \
{ \
- fprintf(stderr, "%d", __LINE__); \
+ fprintf(stderr, "\n%s:%d: %s -> %s\n", __FILE__, __LINE__, (A), (B)); \
create_core(); \
return TEST_FAILURE; \
} \