Skip to content

Commit

Permalink
Fix regex support in --only, --skipfile and --skiptest
Browse files Browse the repository at this point in the history
The regex support was added in:
 * redis#9352
 * redis#9555
 * redis#10212

These commits break backword compatiblity with older versions.

This fix keeps the testsuite infra compatible with old versions by
default. If you want regex the string must start with `/`
  • Loading branch information
valentinogeron committed May 18, 2022
1 parent f62d52a commit 6eed110
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/instances.tcl
Expand Up @@ -441,7 +441,7 @@ proc run_tests {} {
file delete $::leaked_fds_file
}

if {[llength $::run_matching] != 0 && [search_pattern_list $test $::run_matching true] == -1} {
if {[llength $::run_matching] != 0 && [search_pattern_list $test $::run_matching] == -1} {
continue
}
if {[file isdirectory $test]} continue
Expand Down
6 changes: 3 additions & 3 deletions tests/support/test.tcl
Expand Up @@ -126,11 +126,11 @@ proc wait_for_condition {maxtries delay e _else_ elsescript} {
}
}

# try to match a value to a list of patterns that is either regex, or plain sub-string
proc search_pattern_list {value pattern_list {substr false}} {
# try to match a value to a list of patterns that are either regex (starts with "/") or plain string.
proc search_pattern_list {value pattern_list} {
set n 0
foreach el $pattern_list {
if {[string length $el] > 0 && ((!$substr && [regexp -- $el $value]) || ($substr && [string match $el $value]))} {
if {[string length $el] > 0 && (([string match /* $el] && [regexp -- $el /$value]) || [string equal $el $value])} {
return $n
}
incr n
Expand Down
2 changes: 1 addition & 1 deletion tests/test_helper.tcl
Expand Up @@ -588,7 +588,7 @@ proc print_help_screen {} {
"--single <unit> Just execute the specified unit (see next option). This option can be repeated."
"--verbose Increases verbosity."
"--list-tests List all the available test units."
"--only <test> Just execute tests that match <test> regexp. This option can be repeated."
"--only <test> Just execute the specified test by test name or tests that match <test> regexp. This option can be repeated."
"--skip-till <unit> Skip all units until (and including) the specified one."
"--skipunit <unit> Skip one unit."
"--clients <num> Number of test clients (default 16)."
Expand Down

0 comments on commit 6eed110

Please sign in to comment.