Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regex support in --only, --skipfile and --skiptest #10741

Merged
merged 4 commits into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/instances.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ proc parse_options {} {
dict set ::global_config $val $val2
incr j 2
} elseif {$opt eq "--help"} {
puts "--single <pattern> Only runs tests specified by pattern."
puts "--single <pattern> Only runs tests specified by pattern. Regexp must start with '/'."
valentinogeron marked this conversation as resolved.
Show resolved Hide resolved
puts "--dont-clean Keep log files on exit."
puts "--pause-on-error Pause for manual inspection on error."
puts "--fail Simulate a test failure."
Expand Down 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
Original file line number Diff line number Diff line change
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 -- [string range $el 1 end] $value]) || [string equal $el $value])} {
valentinogeron marked this conversation as resolved.
Show resolved Hide resolved
return $n
}
incr n
Expand Down
6 changes: 3 additions & 3 deletions tests/test_helper.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,15 @@ 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. Regexp must start with '/'."
oranagra marked this conversation as resolved.
Show resolved Hide resolved
"--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)."
"--timeout <sec> Test timeout in seconds (default 20 min)."
"--force-failure Force the execution of a test that always fails."
"--config <k> <v> Extra config file argument."
"--skipfile <file> Name of a file containing test names or regexp patterns that should be skipped (one per line)."
"--skiptest <test> Test name or regexp pattern to skip. This option can be repeated."
"--skipfile <file> Name of a file containing test names or regexp patterns that should be skipped (one per line). Regexp must start with '/'."
"--skiptest <test> Test name or regexp pattern to skip. This option can be repeated. Regexp must start with '/'."
"--tags <tags> Run only tests having specified tags or not having '-' prefixed tags."
"--dont-clean Don't delete redis log files after the run."
"--no-latency Skip latency measurements and validation by some tests."
Expand Down