]>
Commit | Line | Data |
---|---|---|
98578b57 PN |
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 | |
3 | # more information. | |
4 | ||
5 | set tcl_precision 17 | |
ab72b483 | 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 | |
98578b57 PN |
11 | |
12 | set ::host 127.0.0.1 | |
47bebf15 | 13 | set ::port 16379 |
98578b57 | 14 | set ::traceleaks 0 |
c4669d25 | 15 | set ::valgrind 0 |
98578b57 PN |
16 | |
17 | proc execute_tests name { | |
18 | set cur $::testnum | |
ab72b483 | 19 | source "tests/$name.tcl" |
98578b57 PN |
20 | } |
21 | ||
1c4114be PN |
22 | # Setup a list to hold a stack of server configs. When calls to start_server |
23 | # are nested, use "srv 0 pid" to get the pid of the inner server. To access | |
24 | # outer servers, use "srv -1 pid" etcetera. | |
25 | set ::servers {} | |
26 | proc srv {level property} { | |
27 | set srv [lindex $::servers end+$level] | |
28 | dict get $srv $property | |
29 | } | |
30 | ||
31 | # Provide easy access to the client for the inner server. It's possible to | |
32 | # prepend the argument list with a negative level to access clients for | |
33 | # servers running in outer blocks. | |
98578b57 | 34 | proc r {args} { |
1c4114be PN |
35 | set level 0 |
36 | if {[string is integer [lindex $args 0]]} { | |
37 | set level [lindex $args 0] | |
38 | set args [lrange $args 1 end] | |
39 | } | |
40 | [srv $level "client"] {*}$args | |
41 | } | |
42 | ||
43 | # Provide easy access to INFO properties. Same semantic as "proc r". | |
44 | proc s {args} { | |
45 | set level 0 | |
46 | if {[string is integer [lindex $args 0]]} { | |
47 | set level [lindex $args 0] | |
48 | set args [lrange $args 1 end] | |
49 | } | |
50 | status [srv $level "client"] [lindex $args 0] | |
98578b57 PN |
51 | } |
52 | ||
f166bb1d | 53 | proc cleanup {} { |
c4669d25 | 54 | catch {exec rm -rf {*}[glob tests/tmp/redis.conf.*]} |
55 | catch {exec rm -rf {*}[glob tests/tmp/server.*]} | |
f166bb1d PN |
56 | } |
57 | ||
98578b57 | 58 | proc main {} { |
f166bb1d | 59 | cleanup |
98578b57 PN |
60 | execute_tests "unit/auth" |
61 | execute_tests "unit/protocol" | |
62 | execute_tests "unit/basic" | |
63 | execute_tests "unit/type/list" | |
64 | execute_tests "unit/type/set" | |
65 | execute_tests "unit/type/zset" | |
66 | execute_tests "unit/type/hash" | |
67 | execute_tests "unit/sort" | |
68 | execute_tests "unit/expire" | |
69 | execute_tests "unit/other" | |
c20c189d | 70 | execute_tests "unit/cas" |
85ecc65e | 71 | execute_tests "integration/replication" |
53cbf66c | 72 | execute_tests "integration/aof" |
f166bb1d PN |
73 | |
74 | # run tests with VM enabled | |
75 | set ::global_overrides [list [list vm-enabled yes]] | |
76 | execute_tests "unit/protocol" | |
77 | execute_tests "unit/basic" | |
78 | execute_tests "unit/type/list" | |
79 | execute_tests "unit/type/set" | |
80 | execute_tests "unit/type/zset" | |
81 | execute_tests "unit/type/hash" | |
82 | execute_tests "unit/sort" | |
83 | execute_tests "unit/expire" | |
84 | execute_tests "unit/other" | |
c20c189d | 85 | execute_tests "unit/cas" |
98578b57 PN |
86 | |
87 | puts "\n[expr $::passed+$::failed] tests, $::passed passed, $::failed failed" | |
88 | if {$::failed > 0} { | |
89 | puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n" | |
90 | } | |
f166bb1d PN |
91 | |
92 | cleanup | |
98578b57 PN |
93 | } |
94 | ||
95 | main |