From fa08adc04429fc1e3cadcc32ede9bf83e158da72 Mon Sep 17 00:00:00 2001 From: Binbin Date: Sat, 13 Jul 2024 23:06:17 +0800 Subject: [PATCH] Minor fix for --loops option in normal testing framework Inputing a negative number equivalent to --loops, and inputing a number greater than or equal to 0 will cause the tests to be run one more time. Signed-off-by: Binbin --- tests/test_helper.tcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index a8df6c40a6..ae784271c9 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -475,7 +475,7 @@ proc signal_idle_client fd { send_data_packet $fd run [lindex $::all_tests $::next_test] lappend ::active_clients $fd incr ::next_test - if {$::loop && $::next_test == [llength $::all_tests]} { + if {$::loop > 1 && $::next_test == [llength $::all_tests]} { set ::next_test 0 incr ::loop -1 } @@ -703,6 +703,10 @@ for {set j 0} {$j < [llength $argv]} {incr j} { set ::loop 2147483647 } elseif {$opt eq {--loops}} { set ::loop $arg + if {$::loop <= 0} { + puts "Wrong argument: $opt, loops should be greater than 0" + exit 1 + } incr j } elseif {$opt eq {--timeout}} { set ::timeout $arg