Add --large-memory flag for REDIS_TEST to enable tests that consume more than 100mb (#9784)
This is a preparation step in order to add a new test in quicklist.c see #9776
This commit is contained in:
parent
aba70df48f
commit
e725d737fb
@ -127,10 +127,10 @@ uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l) {
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
int crc64Test(int argc, char *argv[], int accurate) {
|
int crc64Test(int argc, char *argv[], int flags) {
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
crc64_init();
|
crc64_init();
|
||||||
printf("[calcula]: e9c6d914c4b8d9ca == %016" PRIx64 "\n",
|
printf("[calcula]: e9c6d914c4b8d9ca == %016" PRIx64 "\n",
|
||||||
(uint64_t)_crc64(0, "123456789", 9));
|
(uint64_t)_crc64(0, "123456789", 9));
|
||||||
|
@ -7,7 +7,7 @@ void crc64_init(void);
|
|||||||
uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
|
uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int crc64Test(int argc, char *argv[], int accurate);
|
int crc64Test(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1183,6 +1183,7 @@ void dictGetStats(char *buf, size_t bufsize, dict *d) {
|
|||||||
/* ------------------------------- Benchmark ---------------------------------*/
|
/* ------------------------------- Benchmark ---------------------------------*/
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
|
#include "testhelp.h"
|
||||||
|
|
||||||
#define UNUSED(V) ((void) V)
|
#define UNUSED(V) ((void) V)
|
||||||
|
|
||||||
@ -1235,11 +1236,12 @@ dictType BenchmarkDictType = {
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* ./redis-server test dict [<count> | --accurate] */
|
/* ./redis-server test dict [<count> | --accurate] */
|
||||||
int dictTest(int argc, char **argv, int accurate) {
|
int dictTest(int argc, char **argv, int flags) {
|
||||||
long j;
|
long j;
|
||||||
long long start, elapsed;
|
long long start, elapsed;
|
||||||
dict *dict = dictCreate(&BenchmarkDictType);
|
dict *dict = dictCreate(&BenchmarkDictType);
|
||||||
long count = 0;
|
long count = 0;
|
||||||
|
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||||
|
|
||||||
if (argc == 4) {
|
if (argc == 4) {
|
||||||
if (accurate) {
|
if (accurate) {
|
||||||
|
@ -206,7 +206,7 @@ uint64_t dictGetHash(dict *d, const void *key);
|
|||||||
dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t hash);
|
dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t hash);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int dictTest(int argc, char *argv[], int accurate);
|
int dictTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __DICT_H */
|
#endif /* __DICT_H */
|
||||||
|
@ -105,12 +105,12 @@ uint64_t intrev64(uint64_t v) {
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
int endianconvTest(int argc, char *argv[], int accurate) {
|
int endianconvTest(int argc, char *argv[], int flags) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
|
|
||||||
sprintf(buf,"ciaoroma");
|
sprintf(buf,"ciaoroma");
|
||||||
memrev16(buf);
|
memrev16(buf);
|
||||||
|
@ -72,7 +72,7 @@ uint64_t intrev64(uint64_t v);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int endianconvTest(int argc, char *argv[], int accurate);
|
int endianconvTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -393,7 +393,7 @@ static void checkConsistency(intset *is) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
int intsetTest(int argc, char **argv, int accurate) {
|
int intsetTest(int argc, char **argv, int flags) {
|
||||||
uint8_t success;
|
uint8_t success;
|
||||||
int i;
|
int i;
|
||||||
intset *is;
|
intset *is;
|
||||||
@ -401,7 +401,7 @@ int intsetTest(int argc, char **argv, int accurate) {
|
|||||||
|
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
|
|
||||||
printf("Value encodings: "); {
|
printf("Value encodings: "); {
|
||||||
assert(_intsetValueEncoding(-32768) == INTSET_ENC_INT16);
|
assert(_intsetValueEncoding(-32768) == INTSET_ENC_INT16);
|
||||||
|
@ -49,7 +49,7 @@ size_t intsetBlobLen(intset *is);
|
|||||||
int intsetValidateIntegrity(const unsigned char *is, size_t size, int deep);
|
int intsetValidateIntegrity(const unsigned char *is, size_t size, int deep);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int intsetTest(int argc, char *argv[], int accurate);
|
int intsetTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __INTSET_H
|
#endif // __INTSET_H
|
||||||
|
@ -1375,6 +1375,7 @@ unsigned int lpRandomPairsUnique(unsigned char *lp, unsigned int count, listpack
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "adlist.h"
|
#include "adlist.h"
|
||||||
#include "sds.h"
|
#include "sds.h"
|
||||||
|
#include "testhelp.h"
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
#define TEST(name) printf("test — %s\n", name);
|
#define TEST(name) printf("test — %s\n", name);
|
||||||
@ -1499,15 +1500,15 @@ static int lpValidation(unsigned char *p, unsigned int head_count, void *userdat
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int listpackTest(int argc, char *argv[], int accurate) {
|
int listpackTest(int argc, char *argv[], int flags) {
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
unsigned char *lp, *p, *vstr;
|
unsigned char *lp, *p, *vstr;
|
||||||
int64_t vlen;
|
int64_t vlen;
|
||||||
unsigned char intbuf[LP_INTBUF_SIZE];
|
unsigned char intbuf[LP_INTBUF_SIZE];
|
||||||
|
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||||
|
|
||||||
TEST("Create int list") {
|
TEST("Create int list") {
|
||||||
lp = createIntList();
|
lp = createIntList();
|
||||||
|
@ -90,7 +90,7 @@ unsigned int lpRandomPairsUnique(unsigned char *lp, unsigned int count, listpack
|
|||||||
int lpSafeToAdd(unsigned char* lp, size_t add);
|
int lpSafeToAdd(unsigned char* lp, size_t add);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int listpackTest(int argc, char *argv[], int accurate);
|
int listpackTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1720,6 +1720,7 @@ void quicklistBookmarksClear(quicklist *ql) {
|
|||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include "testhelp.h"
|
||||||
|
|
||||||
#define yell(str, ...) printf("ERROR! " str "\n\n", __VA_ARGS__)
|
#define yell(str, ...) printf("ERROR! " str "\n\n", __VA_ARGS__)
|
||||||
|
|
||||||
@ -1902,11 +1903,11 @@ static char *genstr(char *prefix, int i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* main test, but callable from other files */
|
/* main test, but callable from other files */
|
||||||
int quicklistTest(int argc, char *argv[], int accurate) {
|
int quicklistTest(int argc, char *argv[], int flags) {
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
|
||||||
|
|
||||||
|
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||||
unsigned int err = 0;
|
unsigned int err = 0;
|
||||||
int optimize_start =
|
int optimize_start =
|
||||||
-(int)(sizeof(optimization_level) / sizeof(*optimization_level));
|
-(int)(sizeof(optimization_level) / sizeof(*optimization_level));
|
||||||
|
@ -205,7 +205,7 @@ void quicklistBookmarksClear(quicklist *ql);
|
|||||||
int quicklistisSetPackedThreshold(size_t sz);
|
int quicklistisSetPackedThreshold(size_t sz);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int quicklistTest(int argc, char *argv[], int accurate);
|
int quicklistTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Directions for iterators */
|
/* Directions for iterators */
|
||||||
|
@ -1314,10 +1314,10 @@ static sds sdsTestTemplateCallback(sds varname, void *arg) {
|
|||||||
else return NULL;
|
else return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sdsTest(int argc, char **argv, int accurate) {
|
int sdsTest(int argc, char **argv, int flags) {
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
|
|
||||||
{
|
{
|
||||||
sds x = sdsnew("foo"), y;
|
sds x = sdsnew("foo"), y;
|
||||||
@ -1559,7 +1559,6 @@ int sdsTest(int argc, char **argv, int accurate) {
|
|||||||
test_cond("sdsrezie() crop alloc", sdsalloc(x) == 4);
|
test_cond("sdsrezie() crop alloc", sdsalloc(x) == 4);
|
||||||
sdsfree(x);
|
sdsfree(x);
|
||||||
}
|
}
|
||||||
test_report();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -280,7 +280,7 @@ void *sds_realloc(void *ptr, size_t size);
|
|||||||
void sds_free(void *ptr);
|
void sds_free(void *ptr);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int sdsTest(int argc, char *argv[], int accurate);
|
int sdsTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
22
src/server.c
22
src/server.c
@ -7807,7 +7807,15 @@ int iAmMaster(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
typedef int redisTestProc(int argc, char **argv, int accurate);
|
#include "testhelp.h"
|
||||||
|
|
||||||
|
int __failed_tests = 0;
|
||||||
|
int __test_num = 0;
|
||||||
|
|
||||||
|
/* The flags are the following:
|
||||||
|
* --accurate: Runs tests with more iterations.
|
||||||
|
* --large-memory: Enables tests that consume more than 100mb. */
|
||||||
|
typedef int redisTestProc(int argc, char **argv, int flags);
|
||||||
struct redisTest {
|
struct redisTest {
|
||||||
char *name;
|
char *name;
|
||||||
redisTestProc *proc;
|
redisTestProc *proc;
|
||||||
@ -7844,17 +7852,17 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
if (argc >= 3 && !strcasecmp(argv[1], "test")) {
|
if (argc >= 3 && !strcasecmp(argv[1], "test")) {
|
||||||
int accurate = 0;
|
int flags = 0;
|
||||||
for (j = 3; j < argc; j++) {
|
for (j = 3; j < argc; j++) {
|
||||||
if (!strcasecmp(argv[j], "--accurate")) {
|
char *arg = argv[j];
|
||||||
accurate = 1;
|
if (!strcasecmp(arg, "--accurate")) flags |= REDIS_TEST_ACCURATE;
|
||||||
}
|
else if (!strcasecmp(arg, "--large-memory")) flags |= REDIS_TEST_LARGE_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(argv[2], "all")) {
|
if (!strcasecmp(argv[2], "all")) {
|
||||||
int numtests = sizeof(redisTests)/sizeof(struct redisTest);
|
int numtests = sizeof(redisTests)/sizeof(struct redisTest);
|
||||||
for (j = 0; j < numtests; j++) {
|
for (j = 0; j < numtests; j++) {
|
||||||
redisTests[j].failed = (redisTests[j].proc(argc,argv,accurate) != 0);
|
redisTests[j].failed = (redisTests[j].proc(argc,argv,flags) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Report tests result */
|
/* Report tests result */
|
||||||
@ -7875,7 +7883,7 @@ int main(int argc, char **argv) {
|
|||||||
} else {
|
} else {
|
||||||
redisTestProc *proc = getTestProcByName(argv[2]);
|
redisTestProc *proc = getTestProcByName(argv[2]);
|
||||||
if (!proc) return -1; /* test not found */
|
if (!proc) return -1; /* test not found */
|
||||||
return proc(argc,argv,accurate);
|
return proc(argc,argv,flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -201,7 +201,7 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
|||||||
#define BUFSIZE 4096
|
#define BUFSIZE 4096
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
int sha1Test(int argc, char **argv, int accurate)
|
int sha1Test(int argc, char **argv, int flags)
|
||||||
{
|
{
|
||||||
SHA1_CTX ctx;
|
SHA1_CTX ctx;
|
||||||
unsigned char hash[20], buf[BUFSIZE];
|
unsigned char hash[20], buf[BUFSIZE];
|
||||||
@ -209,7 +209,7 @@ int sha1Test(int argc, char **argv, int accurate)
|
|||||||
|
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
|
|
||||||
for(i=0;i<BUFSIZE;i++)
|
for(i=0;i<BUFSIZE;i++)
|
||||||
buf[i] = i;
|
buf[i] = i;
|
||||||
|
@ -19,6 +19,6 @@ void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len);
|
|||||||
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
|
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int sha1Test(int argc, char **argv, int accurate);
|
int sha1Test(int argc, char **argv, int flags);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,8 +39,12 @@
|
|||||||
#ifndef __TESTHELP_H
|
#ifndef __TESTHELP_H
|
||||||
#define __TESTHELP_H
|
#define __TESTHELP_H
|
||||||
|
|
||||||
int __failed_tests = 0;
|
#define REDIS_TEST_ACCURATE (1<<0)
|
||||||
int __test_num = 0;
|
#define REDIS_TEST_LARGE_MEMORY (1<<1)
|
||||||
|
|
||||||
|
extern int __failed_tests;
|
||||||
|
extern int __test_num;
|
||||||
|
|
||||||
#define test_cond(descr,_c) do { \
|
#define test_cond(descr,_c) do { \
|
||||||
__test_num++; printf("%d - %s: ", __test_num, descr); \
|
__test_num++; printf("%d - %s: ", __test_num, descr); \
|
||||||
if(_c) printf("PASSED\n"); else {printf("FAILED\n"); __failed_tests++;} \
|
if(_c) printf("PASSED\n"); else {printf("FAILED\n"); __failed_tests++;} \
|
||||||
|
@ -959,10 +959,10 @@ static void test_ll2string(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
int utilTest(int argc, char **argv, int accurate) {
|
int utilTest(int argc, char **argv, int flags) {
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
|
|
||||||
test_string2ll();
|
test_string2ll();
|
||||||
test_string2l();
|
test_string2l();
|
||||||
|
@ -67,7 +67,7 @@ long getTimeZone(void);
|
|||||||
int pathIsBaseName(char *path);
|
int pathIsBaseName(char *path);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int utilTest(int argc, char **argv, int accurate);
|
int utilTest(int argc, char **argv, int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1688,6 +1688,7 @@ unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, zip
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "adlist.h"
|
#include "adlist.h"
|
||||||
#include "sds.h"
|
#include "sds.h"
|
||||||
|
#include "testhelp.h"
|
||||||
|
|
||||||
#define debug(f, ...) { if (DEBUG) printf(f, __VA_ARGS__); }
|
#define debug(f, ...) { if (DEBUG) printf(f, __VA_ARGS__); }
|
||||||
|
|
||||||
@ -1842,8 +1843,9 @@ static size_t strEntryBytesLarge(size_t slen) {
|
|||||||
return slen + zipStorePrevEntryLength(NULL, ZIP_BIG_PREVLEN) + zipStoreEntryEncoding(NULL, 0, slen);
|
return slen + zipStorePrevEntryLength(NULL, ZIP_BIG_PREVLEN) + zipStoreEntryEncoding(NULL, 0, slen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ./redis-server test ziplist <randomseed> --accurate */
|
/* ./redis-server test ziplist <randomseed> */
|
||||||
int ziplistTest(int argc, char **argv, int accurate) {
|
int ziplistTest(int argc, char **argv, int flags) {
|
||||||
|
int accurate = (flags & REDIS_TEST_ACCURATE);
|
||||||
unsigned char *zl, *p;
|
unsigned char *zl, *p;
|
||||||
unsigned char *entry;
|
unsigned char *entry;
|
||||||
unsigned int elen;
|
unsigned int elen;
|
||||||
|
@ -68,7 +68,7 @@ unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, zip
|
|||||||
int ziplistSafeToAdd(unsigned char* zl, size_t add);
|
int ziplistSafeToAdd(unsigned char* zl, size_t add);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int ziplistTest(int argc, char *argv[], int accurate);
|
int ziplistTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _ZIPLIST_H */
|
#endif /* _ZIPLIST_H */
|
||||||
|
@ -476,12 +476,12 @@ static void zipmapRepr(unsigned char *p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define UNUSED(x) (void)(x)
|
#define UNUSED(x) (void)(x)
|
||||||
int zipmapTest(int argc, char *argv[], int accurate) {
|
int zipmapTest(int argc, char *argv[], int flags) {
|
||||||
unsigned char *zm;
|
unsigned char *zm;
|
||||||
|
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
|
|
||||||
zm = zipmapNew();
|
zm = zipmapNew();
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void zipmapRepr(unsigned char *p);
|
|||||||
int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep);
|
int zipmapValidateIntegrity(unsigned char *zm, size_t size, int deep);
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int zipmapTest(int argc, char *argv[], int accurate);
|
int zipmapTest(int argc, char *argv[], int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -712,12 +712,12 @@ size_t zmalloc_get_memory_size(void) {
|
|||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
#define UNUSED(x) ((void)(x))
|
#define UNUSED(x) ((void)(x))
|
||||||
int zmalloc_test(int argc, char **argv, int accurate) {
|
int zmalloc_test(int argc, char **argv, int flags) {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
UNUSED(argc);
|
UNUSED(argc);
|
||||||
UNUSED(argv);
|
UNUSED(argv);
|
||||||
UNUSED(accurate);
|
UNUSED(flags);
|
||||||
printf("Malloc prefix size: %d\n", (int) PREFIX_SIZE);
|
printf("Malloc prefix size: %d\n", (int) PREFIX_SIZE);
|
||||||
printf("Initial used memory: %zu\n", zmalloc_used_memory());
|
printf("Initial used memory: %zu\n", zmalloc_used_memory());
|
||||||
ptr = zmalloc(123);
|
ptr = zmalloc(123);
|
||||||
|
@ -136,7 +136,7 @@ size_t zmalloc_usable_size(void *ptr);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REDIS_TEST
|
#ifdef REDIS_TEST
|
||||||
int zmalloc_test(int argc, char **argv, int accurate);
|
int zmalloc_test(int argc, char **argv, int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ZMALLOC_H */
|
#endif /* __ZMALLOC_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user