summaryrefslogtreecommitdiff
path: root/tests/instances.tcl
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-03-30 14:29:01 +0200
committerantirez <antirez@gmail.com>2015-03-30 14:29:01 +0200
commit65090401b713a074b5261342e3079754377b6bbf (patch)
treed3b1647189e0d6b4c3f1e13e59567f3834925aca /tests/instances.tcl
parent7f330b16f93d9feed0113e928a1b96f182b73e45 (diff)
downloadredis-65090401b713a074b5261342e3079754377b6bbf.tar.gz
Sentinel / Cluster test: exit with non-zero error code on failures.
Diffstat (limited to 'tests/instances.tcl')
-rw-r--r--tests/instances.tcl14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/instances.tcl b/tests/instances.tcl
index 353d9b2d2..370d5e3aa 100644
--- a/tests/instances.tcl
+++ b/tests/instances.tcl
@@ -19,6 +19,7 @@ set ::verbose 0
set ::valgrind 0
set ::pause_on_error 0
set ::simulate_error 0
+set ::failed 0
set ::sentinel_instances {}
set ::redis_instances {}
set ::sentinel_base_port 20000
@@ -231,6 +232,7 @@ proc test {descr code} {
flush stdout
if {[catch {set retval [uplevel 1 $code]} error]} {
+ incr ::failed
if {[string match "assertion:*" $error]} {
set msg [string range $error 10 end]
puts [colorstr red $msg]
@@ -246,6 +248,7 @@ proc test {descr code} {
}
}
+# Execute all the units inside the 'tests' directory.
proc run_tests {} {
set tests [lsort [glob ../tests/*]]
foreach test $tests {
@@ -258,6 +261,17 @@ proc run_tests {} {
}
}
+# Print a message and exists with 0 / 1 according to zero or more failures.
+proc end_tests {} {
+ if {$::failed == 0} {
+ puts "GOOD! No errors."
+ exit 0
+ } else {
+ puts "WARNING $::failed tests faield."
+ exit 1
+ }
+}
+
# The "S" command is used to interact with the N-th Sentinel.
# The general form is:
#