code to enable running tests with the vm enabled

This commit is contained in:
Pieter Noordhuis 2010-05-20 13:58:58 +02:00
parent fab43727b4
commit f166bb1d50
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
# 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.
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
# 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
#
# With the default of 32-bytes memory pages and 134217728 pages Redis will
# use a 4 GB swap file, that will use 16 MB of RAM for the page table.
#
# 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
# 32M swap should be enough for testing.
vm-pages 1048576
# 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

View File

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

View File

@ -49,7 +49,13 @@ proc s {args} {
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 {} {
cleanup
execute_tests "unit/auth"
execute_tests "unit/protocol"
execute_tests "unit/basic"
@ -62,15 +68,25 @@ proc main {} {
execute_tests "unit/other"
execute_tests "integration/replication"
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"
if {$::failed > 0} {
puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n"
}
# clean up tmp
exec rm -rf {*}[glob tests/tmp/redis.conf.*]
exec rm -rf {*}[glob tests/tmp/server.*]
cleanup
}
main