From 7a30be123794ffb339a3a73e094d255a065b6a60 Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Tue, 31 Jul 2018 17:28:30 +0200
Subject: [PATCH] Minor improvements to PR #5187.

---
 tests/integration/psync2.tcl | 10 +++++++---
 tests/test_helper.tcl        |  9 ++++++---
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/tests/integration/psync2.tcl b/tests/integration/psync2.tcl
index 3d9e5527a..b76f36363 100644
--- a/tests/integration/psync2.tcl
+++ b/tests/integration/psync2.tcl
@@ -33,9 +33,8 @@ start_server {} {
 
     set cycle 1
     while {([clock seconds]-$start_time) < $duration} {
-        test "PSYNC2: --- CYCLE $cycle ---" {
-            incr cycle
-        }
+        test "PSYNC2: --- CYCLE $cycle ---" {}
+        incr cycle
 
         # Create a random replication layout.
         # Start with switching master (this simulates a failover).
@@ -139,6 +138,11 @@ start_server {} {
             }
             assert {$sum == 4}
         }
+
+        # Limit anyway the maximum number of cycles. This is useful when the
+        # test is skipped via --only option of the test suite. In that case
+        # we don't want to see many seconds of this test being just skipped.
+        if {$cycle > 50} break
     }
 
     test "PSYNC2: Bring the master back again for next test" {
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl
index ba3dce71c..5d8b149de 100644
--- a/tests/test_helper.tcl
+++ b/tests/test_helper.tcl
@@ -429,7 +429,7 @@ proc print_help_screen {} {
         "--single <unit>    Just execute the specified unit (see next option). this option can be repeated."
         "--list-tests       List all the available test units."
         "--only <test>      Just execute the specified test by test name. this option can be repeated."
-        "--skiptill <unit>  Skip all units until (and including) the specified one."
+        "--skip-till <unit> Skip all units until (and including) the specified one."
         "--clients <num>    Number of test clients (default 16)."
         "--timeout <sec>    Test timeout in seconds (default 10 min)."
         "--force-failure    Force the execution of a test that always fails."
@@ -458,8 +458,7 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
         set arg2 [lindex $argv [expr $j+2]]
         lappend ::global_overrides $arg
         lappend ::global_overrides $arg2
-        incr j
-        incr j
+        incr j 2
     } elseif {$opt eq {--skipfile}} {
         incr j
         set fp [open $arg r]
@@ -524,6 +523,8 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
     }
 }
 
+# If --skil-till option was given, we populate the list of single tests
+# to run with everything *after* the specified unit.
 if {$::skip_till != ""} {
     set skipping 1
     foreach t $::all_tests {
@@ -540,6 +541,8 @@ if {$::skip_till != ""} {
     }
 }
 
+# Override the list of tests with the specific tests we want to run
+# in case there was some filter, that is --single or --skip-till options.
 if {[llength $::single_tests] > 0} {
     set ::all_tests $::single_tests
 }