Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f166bb1d
Commit
f166bb1d
authored
May 20, 2010
by
Pieter Noordhuis
Browse files
code to enable running tests with the vm enabled
parent
fab43727
Changes
3
Hide whitespace changes
Inline
Side-by-side
tests/assets/default.conf
View file @
f166bb1d
...
@@ -220,7 +220,7 @@ vm-enabled no
...
@@ -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
...
@@ -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
...
...
tests/support/server.tcl
View file @
f166bb1d
...
@@ -26,7 +26,7 @@ proc kill_server config {
...
@@ -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 {
...
@@ -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}} {
...
@@ -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
...
...
tests/test_helper.tcl
View file @
f166bb1d
...
@@ -49,7 +49,13 @@ proc s {args} {
...
@@ -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"
...
@@ -62,15 +68,25 @@ proc main {} {
...
@@ -62,15 +68,25 @@ proc main {} {
execute_tests
"unit/other"
execute_tests
"unit/other"
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment