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

support regex in "--only" in runtest #9352

Merged
merged 1 commit into from Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion tests/support/test.tcl
Expand Up @@ -115,6 +115,17 @@ proc wait_for_condition {maxtries delay e _else_ elsescript} {
}
}

proc search_pattern_list {value pattern_list} {
set n 0
foreach el $pattern_list {
if {[regexp -- $el $value]} {
return $n
}
incr n
}
return -1
}

proc test {name code {okpattern undefined} {tags {}}} {
# abort if test name in skiptests
if {[lsearch $::skiptests $name] >= 0} {
Expand All @@ -124,7 +135,7 @@ proc test {name code {okpattern undefined} {tags {}}} {
}

# abort if only_tests was set but test name is not included
if {[llength $::only_tests] > 0 && [lsearch $::only_tests $name] < 0} {
if {[llength $::only_tests] > 0 && [search_pattern_list $name $::only_tests] < 0} {
incr ::num_skipped
send_data_packet $::test_server_fd skip $name
return
Expand Down
2 changes: 1 addition & 1 deletion tests/test_helper.tcl
Expand Up @@ -562,7 +562,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 the specified test by test name. This option can be repeated."
"--only <test> Just execute 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