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

This commit is contained in:
yoav-steinberg 2021-08-10 14:28:24 +03:00 committed by GitHub
parent 8ab33c18e4
commit 19bc83716c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -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 {}}} { proc test {name code {okpattern undefined} {tags {}}} {
# abort if test name in skiptests # abort if test name in skiptests
if {[lsearch $::skiptests $name] >= 0} { if {[lsearch $::skiptests $name] >= 0} {
@ -124,7 +135,7 @@ proc test {name code {okpattern undefined} {tags {}}} {
} }
# abort if only_tests was set but test name is not included # 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 incr ::num_skipped
send_data_packet $::test_server_fd skip $name send_data_packet $::test_server_fd skip $name
return return

View File

@ -562,7 +562,7 @@ proc print_help_screen {} {
"--single <unit> Just execute the specified unit (see next option). This option can be repeated." "--single <unit> Just execute the specified unit (see next option). This option can be repeated."
"--verbose Increases verbosity." "--verbose Increases verbosity."
"--list-tests List all the available test units." "--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." "--skip-till <unit> Skip all units until (and including) the specified one."
"--skipunit <unit> Skip one unit." "--skipunit <unit> Skip one unit."
"--clients <num> Number of test clients (default 16)." "--clients <num> Number of test clients (default 16)."