Either pass no timeout argument, pass timeout+expires or omit timeout (uses default timeout, if any). This should not expose further kernel code to run at this time, but unlinke the existing (deterministic) element-update test case this script does have live traffic and different set types, including rhashtable which does async gc. Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- tests/shell/testcases/transactions/30s-stress | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/tests/shell/testcases/transactions/30s-stress b/tests/shell/testcases/transactions/30s-stress index e92b922660b8..69ceda71f490 100755 --- a/tests/shell/testcases/transactions/30s-stress +++ b/tests/shell/testcases/transactions/30s-stress @@ -290,8 +290,29 @@ available_flags() fi } -random_element_string="" +random_timeout() +{ + local timeout="" + local expires + local r=$((RANDOM%3)) + + case "$r" in + 0) + timeout=$((RANDOM%60)) + timeout="timeout ${timeout}s" + ;; + 1) + timeout=$((RANDOM%60)) + expires=$((timeout+1)) + expires=$((RANDOM%expires)) + timeout="timeout ${timeout}s expires ${expires}s" + ;; + esac + + echo -n "$timeout" +} +random_element_string="" # create a random element. Could cause any of the following: # 1. Invalid set/map # 2. Element already exists in set/map w. create @@ -354,17 +375,17 @@ random_elem() r=$((RANDOM%7)) case "$r" in 0) - random_element_string=" inet $table set_${cnt} { $element }" + random_element_string="inet $table set_${cnt} { $element }" ;; - 1) random_element_string="inet $table sett${cnt} { $element timeout $((RANDOM%60))s }" + 1) random_element_string="inet $table sett${cnt} { $element $(random_timeout) }" ;; 2) random_element_string="inet $table dmap_${cnt} { $element : $RANDOM }" ;; - 3) random_element_string="inet $table dmapt${cnt} { $element timeout $((RANDOM%60))s : $RANDOM }" + 3) random_element_string="inet $table dmapt${cnt} { $element $(random_timeout) : $RANDOM }" ;; 4) random_element_string="inet $table vmap_${cnt} { $element : `random_verdict $count` }" ;; - 5) random_element_string="inet $table vmapt${cnt} { $element timeout $((RANDOM%60))s : `random_verdict $count` }" + 5) random_element_string="inet $table vmapt${cnt} { $element $(random_timeout) : `random_verdict $count` }" ;; 6) random_element_string="inet $table setc${cnt} { $element }" ;; @@ -625,11 +646,11 @@ for table in $tables; do esac echo "add element inet $table set_${cnt} { $element }" >> "$tmp" - echo "add element inet $table sett${cnt} { $element timeout $((RANDOM%60))s }" >> "$tmp" + echo "add element inet $table sett${cnt} { $element $(random_timeout) }" >> "$tmp" echo "add element inet $table dmap_${cnt} { $element : $RANDOM }" >> "$tmp" - echo "add element inet $table dmapt${cnt} { $element timeout $((RANDOM%60))s : $RANDOM }" >> "$tmp" + echo "add element inet $table dmapt${cnt} { $element $(random_timeout) : $RANDOM }" >> "$tmp" echo "add element inet $table vmap_${cnt} { $element : `random_verdict $count` }" >> "$tmp" - echo "add element inet $table vmapt${cnt} { $element timeout $((RANDOM%60))s : `random_verdict $count` }" >> "$tmp" + echo "add element inet $table vmapt${cnt} { $element $(random_timeout) : `random_verdict $count` }" >> "$tmp" done done done -- 2.46.0