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