]>
git.saurik.com Git - redis.git/blob - tests/test_helper.tcl
1 # Redis test suite. Copyright (C) 2009 Salvatore Sanfilippo antirez@gmail.com
2 # This softare is released under the BSD License. See the COPYING file for
6 source tests
/support
/redis.tcl
7 source tests
/support
/server.tcl
8 source tests
/support
/tmpfile.tcl
9 source tests
/support
/test.tcl
10 source tests
/support
/util.tcl
18 set ::external 0; # If "1" this means, we are running against external instance
20 proc execute_tests name
{
21 source "tests/$name.tcl"
24 # Setup a list to hold a stack of server configs. When calls to start_server
25 # are nested, use "srv 0 pid" to get the pid of the inner server. To access
26 # outer servers, use "srv -1 pid" etcetera.
28 proc srv
{level property
} {
29 set srv
[lindex $::servers end
+$level]
30 dict get
$srv $property
33 # Provide easy access to the client for the inner server. It's possible to
34 # prepend the argument list with a negative level to access clients for
35 # servers running in outer blocks.
38 if {[string is integer
[lindex $args 0]]} {
39 set level
[lindex $args 0]
40 set args
[lrange $args 1 end
]
42 [srv
$level "client"] {*}$args
45 proc redis_deferring_client
{args
} {
47 if {[llength $args] > 0 && [string is integer
[lindex $args 0]]} {
48 set level
[lindex $args 0]
49 set args
[lrange $args 1 end
]
52 # create client that defers reading reply
53 set client
[redis
[srv
$level "host"] [srv
$level "port"] 1]
55 # select the right db and read the response (OK)
61 # Provide easy access to INFO properties. Same semantic as "proc r".
64 if {[string is integer
[lindex $args 0]]} {
65 set level
[lindex $args 0]
66 set args
[lrange $args 1 end
]
68 status
[srv
$level "client"] [lindex $args 0]
72 catch {exec rm
-rf {*}[glob tests
/tmp
/redis.conf.
*]}
73 catch {exec rm
-rf {*}[glob tests
/tmp
/server.
*]}
78 execute_tests
"unit/auth"
79 execute_tests
"unit/protocol"
80 execute_tests
"unit/basic"
81 execute_tests
"unit/type/list"
82 execute_tests
"unit/type/set"
83 execute_tests
"unit/type/zset"
84 execute_tests
"unit/type/hash"
85 execute_tests
"unit/sort"
86 execute_tests
"unit/expire"
87 execute_tests
"unit/other"
88 execute_tests
"unit/cas"
89 execute_tests
"integration/replication"
90 execute_tests
"integration/aof"
91 execute_tests
"unit/pubsub"
93 # run tests with VM enabled
94 set ::global_overrides {vm-enabled yes
}
95 execute_tests
"unit/protocol"
96 execute_tests
"unit/basic"
97 execute_tests
"unit/type/list"
98 execute_tests
"unit/type/set"
99 execute_tests
"unit/type/zset"
100 execute_tests
"unit/type/hash"
101 execute_tests
"unit/sort"
102 execute_tests
"unit/expire"
103 execute_tests
"unit/other"
104 execute_tests
"unit/cas"
107 puts "\n[expr $::passed+$::failed] tests, $::passed passed, $::failed failed"
109 puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n"
115 for {set j
0} {$j < [llength $argv]} {incr j
} {
116 set opt
[lindex $argv $j]
117 set arg
[lindex $argv [expr $j+1]]
118 if {$opt eq
{--tags}} {
120 if {[string index
$tag 0] eq
"-"} {
121 lappend ::denytags [string range
$tag 1 end
]
123 lappend ::allowtags $tag
127 } elseif
{$opt eq
{--host}} {
131 } elseif
{$opt eq
{--port}} {
135 puts "Wrong argument: $opt"
140 if {[catch { main
} err
]} {
141 if {[string length
$err] > 0} {
142 # only display error when not generated by the test suite
143 if {$err ne
"exception"} {