Merge branch 'unstable' of github.com:/antirez/redis into unstable
This commit is contained in:
commit
446f24e66d
@ -66,7 +66,7 @@ typedef struct list {
|
||||
#define listSetMatchMethod(l,m) ((l)->match = (m))
|
||||
|
||||
#define listGetDupMethod(l) ((l)->dup)
|
||||
#define listGetFree(l) ((l)->free)
|
||||
#define listGetFreeMethod(l) ((l)->free)
|
||||
#define listGetMatchMethod(l) ((l)->match)
|
||||
|
||||
/* Prototypes */
|
||||
|
@ -1766,7 +1766,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
|
||||
server.aof_selected_db = -1; /* Make sure SELECT is re-issued */
|
||||
aofUpdateCurrentSize();
|
||||
server.aof_rewrite_base_size = server.aof_current_size;
|
||||
server.aof_current_size = server.aof_current_size;
|
||||
server.aof_fsync_offset = server.aof_current_size;
|
||||
|
||||
/* Clear regular AOF buffer since its contents was just written to
|
||||
* the new AOF from the background rewrite buffer. */
|
||||
|
@ -3121,7 +3121,9 @@ fmterr:
|
||||
* On success a RedisModuleCallReply object is returned, otherwise
|
||||
* NULL is returned and errno is set to the following values:
|
||||
*
|
||||
* EINVAL: command non existing, wrong arity, wrong format specifier.
|
||||
* EBADF: wrong format specifier.
|
||||
* EINVAL: wrong command arity.
|
||||
* ENOENT: command does not exist.
|
||||
* EPERM: operation in Cluster instance with key in non local slot.
|
||||
*
|
||||
* This API is documented here: https://redis.io/topics/modules-intro
|
||||
@ -3153,7 +3155,7 @@ RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const ch
|
||||
/* We handle the above format error only when the client is setup so that
|
||||
* we can free it normally. */
|
||||
if (argv == NULL) {
|
||||
errno = EINVAL;
|
||||
errno = EBADF;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -3165,7 +3167,7 @@ RedisModuleCallReply *RM_Call(RedisModuleCtx *ctx, const char *cmdname, const ch
|
||||
*/
|
||||
cmd = lookupCommand(c->argv[0]->ptr);
|
||||
if (!cmd) {
|
||||
errno = EINVAL;
|
||||
errno = ENOENT;
|
||||
goto cleanup;
|
||||
}
|
||||
c->cmd = c->lastcmd = cmd;
|
||||
|
@ -18,8 +18,11 @@ void *testrdb_type_load(RedisModuleIO *rdb, int encver) {
|
||||
RedisModuleString *str = RedisModule_LoadString(rdb);
|
||||
float f = RedisModule_LoadFloat(rdb);
|
||||
long double ld = RedisModule_LoadLongDouble(rdb);
|
||||
if (RedisModule_IsIOError(rdb))
|
||||
if (RedisModule_IsIOError(rdb)) {
|
||||
RedisModuleCtx *ctx = RedisModule_GetContextFromIO(rdb);
|
||||
RedisModule_FreeString(ctx, str);
|
||||
return NULL;
|
||||
}
|
||||
/* Using the values only after checking for io errors. */
|
||||
assert(count==1);
|
||||
assert(encver==1);
|
||||
|
@ -11,28 +11,55 @@ proc fail {msg} {
|
||||
|
||||
proc assert {condition} {
|
||||
if {![uplevel 1 [list expr $condition]]} {
|
||||
error "assertion:Expected condition '$condition' to be true ([uplevel 1 [list subst -nocommands $condition]])"
|
||||
set context "(context: [info frame -1])"
|
||||
error "assertion:Expected [uplevel 1 [list subst -nocommands $condition]] $context"
|
||||
}
|
||||
}
|
||||
|
||||
proc assert_no_match {pattern value} {
|
||||
if {[string match $pattern $value]} {
|
||||
error "assertion:Expected '$value' to not match '$pattern'"
|
||||
set context "(context: [info frame -1])"
|
||||
error "assertion:Expected '$value' to not match '$pattern' $context"
|
||||
}
|
||||
}
|
||||
|
||||
proc assert_match {pattern value} {
|
||||
if {![string match $pattern $value]} {
|
||||
error "assertion:Expected '$value' to match '$pattern'"
|
||||
set context "(context: [info frame -1])"
|
||||
error "assertion:Expected '$value' to match '$pattern' $context"
|
||||
}
|
||||
}
|
||||
|
||||
proc assert_equal {expected value {detail ""}} {
|
||||
proc assert_equal {value expected {detail ""}} {
|
||||
if {$expected ne $value} {
|
||||
if {$detail ne ""} {
|
||||
set detail " (detail: $detail)"
|
||||
set detail "(detail: $detail)"
|
||||
} else {
|
||||
set detail "(context: [info frame -1])"
|
||||
}
|
||||
error "assertion:Expected '$value' to be equal to '$expected'$detail"
|
||||
error "assertion:Expected '$value' to be equal to '$expected' $detail"
|
||||
}
|
||||
}
|
||||
|
||||
proc assert_lessthan {value expected {detail ""}} {
|
||||
if {!($value < $expected)} {
|
||||
if {$detail ne ""} {
|
||||
set detail "(detail: $detail)"
|
||||
} else {
|
||||
set detail "(context: [info frame -1])"
|
||||
}
|
||||
error "assertion:Expected '$value' to be lessthan to '$expected' $detail"
|
||||
}
|
||||
}
|
||||
|
||||
proc assert_range {value min max {detail ""}} {
|
||||
if {!($value <= $max && $value >= $min)} {
|
||||
if {$detail ne ""} {
|
||||
set detail "(detail: $detail)"
|
||||
} else {
|
||||
set detail "(context: [info frame -1])"
|
||||
}
|
||||
error "assertion:Expected '$value' to be between to '$min' and '$max' $detail"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user