Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added src/.DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions src/sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ void sdsupdatelen(sds s) {
sdssetlen(s, reallen);
}

int codecovTest1(int a, int b){
return a+b;
}

int codecovTest2(int a,int b){
return a*b;
}

int codecovTest3(int a,int b){
return a-b;
}

/* Modify an sds string in-place to make it empty (zero length).
* However all the existing buffer is not discarded but set as free space
* so that next append operations will not require allocations up to the
Expand Down
72 changes: 0 additions & 72 deletions tests/unit/scripting.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1210,78 +1210,6 @@ start_server {tags {"scripting"}} {
run_script {for i=1,100000 do redis.call('ping') end return 'ok'} 0
r ping
} {PONG}

test {Timedout scripts and unblocked command} {
# make sure a command that's allowed during BUSY doesn't trigger an unblocked command

# enable AOF to also expose an assertion if the bug would happen
r flushall
r config set appendonly yes

# create clients, and set one to block waiting for key 'x'
set rd [redis_deferring_client]
set rd2 [redis_deferring_client]
set r3 [redis_client]
$rd2 blpop x 0
wait_for_blocked_clients_count 1

# hack: allow the script to use client list command so that we can control when it aborts
r DEBUG set-disable-deny-scripts 1
r config set lua-time-limit 10
run_script_on_connection $rd {
local clients
redis.call('lpush',KEYS[1],'y');
while true do
clients = redis.call('client','list')
if string.find(clients, 'abortscript') ~= nil then break end
end
redis.call('lpush',KEYS[1],'z');
return clients
} 1 x

# wait for the script to be busy
after 200
catch {r ping} e
assert_match {BUSY*} $e

# run cause the script to abort, and run a command that could have processed
# unblocked clients (due to a bug)
$r3 hello 2 setname abortscript

# make sure the script completed before the pop was processed
assert_equal [$rd2 read] {x z}
assert_match {*abortscript*} [$rd read]

$rd close
$rd2 close
$r3 close
r DEBUG set-disable-deny-scripts 0
} {OK} {external:skip needs:debug}

test {Timedout scripts that modified data can't be killed by SCRIPT KILL} {
set rd [redis_deferring_client]
r config set lua-time-limit 10
run_script_on_connection $rd {redis.call('set',KEYS[1],'y'); while true do end} 1 x
after 200
catch {r ping} e
assert_match {BUSY*} $e
catch {kill_script} e
assert_match {UNKILLABLE*} $e
catch {r ping} e
assert_match {BUSY*} $e
} {} {external:skip}

# Note: keep this test at the end of this server stanza because it
# kills the server.
test {SHUTDOWN NOSAVE can kill a timedout script anyway} {
# The server should be still unresponding to normal commands.
catch {r ping} e
assert_match {BUSY*} $e
catch {r shutdown nosave}
# Make sure the server was killed
catch {set rd [redis_deferring_client]} e
assert_match {*connection refused*} $e
} {} {external:skip}
}

start_server {tags {"scripting repl needs:debug external:skip"}} {
Expand Down
11 changes: 0 additions & 11 deletions tests/unit/type/hash.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -637,17 +637,6 @@ start_server {tags {"hash"}} {
lappend rv [string match "ERR *not*float*" $err]
} {1}

test {HSTRLEN against the small hash} {
set err {}
foreach k [array names smallhash *] {
if {[string length $smallhash($k)] ne [r hstrlen smallhash $k]} {
set err "[string length $smallhash($k)] != [r hstrlen smallhash $k]"
break
}
}
set _ $err
} {}

test {HSTRLEN against the big hash} {
set err {}
foreach k [array names bighash *] {
Expand Down
Loading