Add --cluster option to runtest to run only cluster tests (#1052)

Currently cluster tests in unit/cluster are run as part of
the ./runtest. Sometims we change the cluster code and only
want to run cluster tests. This PR added a --cluster option
to runtest so that we can run only cluster tests.

Signed-off-by: Binbin <binloveplay1314@qq.com>
This commit is contained in:
Binbin 2024-09-26 10:31:57 +08:00 committed by GitHub
parent 983bb5110d
commit bf8183d065
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,7 @@ source tests/support/util.tcl
set dir [pwd]
set ::all_tests []
set ::cluster_all_test []
set ::module_api_all_tests []
set test_dirs {
@ -32,6 +33,11 @@ foreach test_dir $test_dirs {
}
}
set cluster_test_dir unit/cluster
foreach file [glob -nocomplain $dir/tests/$cluster_test_dir/*.tcl] {
lappend ::cluster_all_tests $cluster_test_dir/[file root [file tail $file]]
}
set moduleapi_test_dir unit/moduleapi
foreach file [glob -nocomplain $dir/tests/$moduleapi_test_dir/*.tcl] {
lappend ::module_api_all_tests $moduleapi_test_dir/[file root [file tail $file]]
@ -557,6 +563,7 @@ proc send_data_packet {fd status data {elapsed 0}} {
proc print_help_screen {} {
puts [join {
"--cluster Run the cluster tests, by default cluster tests run along with all tests."
"--moduleapi Run the module API tests, this option should only be used in runtest-moduleapi which will build the test module."
"--valgrind Run the test over valgrind."
"--durable suppress test crashes and keep running"
@ -614,6 +621,8 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
}
}
incr j
} elseif {$opt eq {--cluster}} {
set ::all_tests $::cluster_all_tests
} elseif {$opt eq {--moduleapi}} {
set ::all_tests $::module_api_all_tests
} elseif {$opt eq {--config}} {