Merge branch 'test_vm' of git://github.com/pietern/redis

This commit is contained in:
antirez 2010-05-20 13:59:59 +02:00
commit 6185fd3532
3 changed files with 27 additions and 14 deletions

View File

@ -220,7 +220,7 @@ vm-enabled no
# *** WARNING *** if you are using a shared hosting the default of putting # *** WARNING *** if you are using a shared hosting the default of putting
# the swap file under /tmp is not secure. Create a dir with access granted # the swap file under /tmp is not secure. Create a dir with access granted
# only to Redis user and configure Redis to create the swap file there. # only to Redis user and configure Redis to create the swap file there.
vm-swap-file /tmp/redis.swap vm-swap-file redis.swap
# vm-max-memory configures the VM to use at max the specified amount of # vm-max-memory configures the VM to use at max the specified amount of
# RAM. Everything that deos not fit will be swapped on disk *if* possible, that # RAM. Everything that deos not fit will be swapped on disk *if* possible, that
@ -249,12 +249,8 @@ vm-page-size 32
# #
# The total swap size is vm-page-size * vm-pages # The total swap size is vm-page-size * vm-pages
# #
# With the default of 32-bytes memory pages and 134217728 pages Redis will # 32M swap should be enough for testing.
# use a 4 GB swap file, that will use 16 MB of RAM for the page table. vm-pages 1048576
#
# It's better to use the smallest acceptable value for your application,
# but the default is large in order to work in most conditions.
vm-pages 134217728
# Max number of VM I/O threads running at the same time. # Max number of VM I/O threads running at the same time.
# This threads are used to read/write data from/to swap file, since they # This threads are used to read/write data from/to swap file, since they

View File

@ -26,7 +26,7 @@ proc kill_server config {
if {[incr wait 10] % 1000 == 0} { if {[incr wait 10] % 1000 == 0} {
puts "Waiting for process $pid to exit..." puts "Waiting for process $pid to exit..."
} }
exec kill $pid catch {exec kill $pid}
after 10 after 10
} }
} }
@ -40,6 +40,7 @@ proc is_alive config {
} }
} }
set ::global_overrides {}
proc start_server {filename overrides {code undefined}} { proc start_server {filename overrides {code undefined}} {
set data [split [exec cat "tests/assets/$filename"] "\n"] set data [split [exec cat "tests/assets/$filename"] "\n"]
set config {} set config {}
@ -58,8 +59,8 @@ proc start_server {filename overrides {code undefined}} {
# start every server on a different port # start every server on a different port
dict set config port [incr ::port] dict set config port [incr ::port]
# apply overrides from arguments # apply overrides from global space and arguments
foreach override $overrides { foreach override [concat $::global_overrides $overrides] {
set directive [lrange $override 0 0] set directive [lrange $override 0 0]
set arguments [lrange $override 1 end] set arguments [lrange $override 1 end]
dict set config $directive $arguments dict set config $directive $arguments

View File

@ -49,7 +49,13 @@ proc s {args} {
status [srv $level "client"] [lindex $args 0] status [srv $level "client"] [lindex $args 0]
} }
proc cleanup {} {
exec rm -rf {*}[glob tests/tmp/redis.conf.*]
exec rm -rf {*}[glob tests/tmp/server.*]
}
proc main {} { proc main {} {
cleanup
execute_tests "unit/auth" execute_tests "unit/auth"
execute_tests "unit/protocol" execute_tests "unit/protocol"
execute_tests "unit/basic" execute_tests "unit/basic"
@ -63,14 +69,24 @@ proc main {} {
execute_tests "integration/replication" execute_tests "integration/replication"
execute_tests "integration/aof" execute_tests "integration/aof"
# run tests with VM enabled
set ::global_overrides [list [list vm-enabled yes]]
execute_tests "unit/protocol"
execute_tests "unit/basic"
execute_tests "unit/type/list"
execute_tests "unit/type/set"
execute_tests "unit/type/zset"
execute_tests "unit/type/hash"
execute_tests "unit/sort"
execute_tests "unit/expire"
execute_tests "unit/other"
puts "\n[expr $::passed+$::failed] tests, $::passed passed, $::failed failed" puts "\n[expr $::passed+$::failed] tests, $::passed passed, $::failed failed"
if {$::failed > 0} { if {$::failed > 0} {
puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n" puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n"
} }
# clean up tmp cleanup
exec rm -rf {*}[glob tests/tmp/redis.conf.*]
exec rm -rf {*}[glob tests/tmp/server.*]
} }
main main