check: add support for --start-after
PATCH 1/1 check: add support for --start-after
Often times one is running a new test baseline we want to continue to start testing where we left off if the last test was a crash. To do this the first thing that occurred to me was to use the check.time file as an expunge file but that doesn't work so well if you crashed as the file turns out empty.
So instead add super simple argument --start-after which let's you skip all tests until the test infrastructure has "seen" the test you want to skip. This does obviously work best if you are not using a random order, but that is rather implied.
--- check | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
check +17 -0
@@ -18,6 +18,8 @@ showme=false have_test_arg=false randomize=false exact_order=false +start_after=false +start_after_test="" export here=`pwd` xfile="" subdir_xfile=""
@@ -80,6 +82,7 @@ check options -b brief test summary -R fmt[,fmt] generate report in formats specified. Supported formats: xunit, xunit-quiet --large-fs optimise scratch device for large filesystems + --start-after only start testing after the test specified -s section run only specified section from config file -S section exclude the specified section from the config file -L <n> loop tests <n> times following a failure, measuring aggregate pass/fail metrics
@@ -313,6 +316,11 @@ while [ $# -gt 0 ]; do <(sed "s/#.*$//" $xfile) fi ;; + --start-after) + start_after=true + start_after_test="$2" + shift + ;; -s) RUN_SECTION="$RUN_SECTION $2"; shift ;; -S) EXCLUDE_SECTION="$EXCLUDE_SECTION $2"; shift ;; -l) diff="diff" ;;
@@ -591,6 +599,15 @@ _expunge_test() { local TEST_ID="$1" + if $start_after; then + if [[ "$start_after_test" == ${TEST_ID}* ]]; then + start_after=false + fi + echo " [skipped]" + return 0 + + fi + for f in "${exclude_tests[@]}"; do # $f may contain traling spaces and comments local id_regex="^${TEST_ID}\b"
Signature · 1 line
2.39.2
Quoted 11 lines · Luis Chamberlain
Often times one is running a new test baseline we want to continue to start testing where we left off if the last test was a crash. To do this the first thing that occurred to me was to use the check.time file as an expunge file but that doesn't work so well if you crashed as the file turns out empty.
So instead add super simple argument --start-after which let's you skip all tests until the test infrastructure has "seen" the test you want to skip. This does obviously work best if you are not using a random order, but that is rather implied.
Please consider adding an example in the usage() function.
'./check --start-after btrfs/010 -g btrfs/quick' didn't work because '010' isn't part of 'btrfs/quick'.
Since the tests are sorted before running, why not skip all tests that come before the 'start_after_test'?
Thanks, Anand
Quoted 19 lines
check +9
-0@@ -591,6 +599,15 @@ _expunge_test() { local TEST_ID="$1" + if $start_after; then + if [[ "$start_after_test" == ${TEST_ID}* ]]; then + start_after=false + fi + echo " [skipped]" + return 0 + + fi +for f in "${exclude_tests[@]}"; do # $f may contain traling spaces and comments local id_regex="^${TEST_ID}\b"
Quoted 30 lines · Luis Chamberlain
Often times one is running a new test baseline we want to continue to start testing where we left off if the last test was a crash. To do this the first thing that occurred to me was to use the check.time file as an expunge file but that doesn't work so well if you crashed as the file turns out empty.
So instead add super simple argument --start-after which let's you skip all tests until the test infrastructure has "seen" the test you want to skip. This does obviously work best if you are not using a random order, but that is rather implied.
Signed-off-by Luis Chamberlain <[email protected]>--- check | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)check +2
-0@@ -18,6 +18,8 @@ showme=false have_test_arg=false randomize=false exact_order=false +start_after=false +start_after_test="" export here=`pwd` xfile="" subdir_xfile=""
check check options · line 85
Quoted 4 lines
check +1
-0@@ -80,6 +82,7 @@ check options -b brief test summary -R fmt[,fmt] generate report in formats specified. Supported formats: xunit, xunit-quiet --large-fs optimise scratch device for large filesystems + --start-after only start testing after the test specified
This option conflicts with "-r" option.
check while [ $# -gt 0 ]; do · line 321
Quoted 10 lines
check +3
-0-s section run only specified section from config file -S section exclude the specified section from the config file -L <n> loop tests <n> times following a failure, measuring aggregate pass/fail metrics@@ -313,6 +316,11 @@ while [ $# -gt 0 ]; do <(sed "s/#.*$//" $xfile) fi ;; + --start-after) + start_after=true + start_after_test="$2"
Do we really need two variables at here?
Quoted 7 lines
check +2
-0+ shift + ;; -s) RUN_SECTION="$RUN_SECTION $2"; shift ;; -S) EXCLUDE_SECTION="$EXCLUDE_SECTION $2"; shift ;; -l) diff="diff" ;;@@ -591,6 +599,15 @@ _expunge_test() {
check _expunge_test() · line 609
Quoted 10 lines
check +8
-0local TEST_ID="$1" + if $start_after; then + if [[ "$start_after_test" == ${TEST_ID}* ]]; then + start_after=false + fi + echo " [skipped]" + return 0 + + fi
I can't understand how you use the --start-after. I though you'd like to remove all cases before the "start-after" from the running list. But when I saw here, I'm a little confused.
Thanks,
Zorro
Quoted 7 lines
check +1
-0+ for f in "${exclude_tests[@]}"; do # $f may contain traling spaces and comments local id_regex="^${TEST_ID}\b"Signature · 1 line
2.39.2
Sorry for some reason I missed this.
Quoted 29 lines · Zorro Lang
Quoted 28 lines · Luis Chamberlain
Often times one is running a new test baseline we want to continue to start testing where we left off if the last test was a crash. To do this the first thing that occurred to me was to use the check.time file as an expunge file but that doesn't work so well if you crashed as the file turns out empty.
So instead add super simple argument --start-after which let's you skip all tests until the test infrastructure has "seen" the test you want to skip. This does obviously work best if you are not using a random order, but that is rather implied.
Signed-off-by Luis Chamberlain <[email protected]>--- check | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)check +2
-0@@ -18,6 +18,8 @@ showme=false have_test_arg=false randomize=false exact_order=false +start_after=false +start_after_test="" export here=`pwd` xfile=""
Quoted 8 lines
check check options · line 85
Quoted 6 lines
check +1
-0subdir_xfile=""@@ -80,6 +82,7 @@ check options -b brief test summary -R fmt[,fmt] generate report in formats specified. Supported formats: xunit, xunit-quiet --large-fs optimise scratch device for large filesystems + --start-after only start testing after the test specifiedThis option conflicts with "-r" option.
I will add a check.
Quoted 4 lines
Quoted 4 lines
check +0
-0-s section run only specified section from config file -S section exclude the specified section from the config file -L <n> loop tests <n> times following a failure, measuring aggregate pass/fail metrics@@ -313,6 +316,11 @@ while [ $# -gt 0 ]; do
Quoted 8 lines
check while [ $# -gt 0 ]; do · line 321
Quoted 6 lines
check +3
-0<(sed "s/#.*$//" $xfile) fi ;; + --start-after) + start_after=true + start_after_test="$2"Do we really need two variables at here?
We can stick with one but we just need to use:
if [[ "$start_after_test != "" ]]
Quoted 10 lines
Quoted 10 lines
check +2
-0+ shift + ;; -s) RUN_SECTION="$RUN_SECTION $2"; shift ;; -S) EXCLUDE_SECTION="$EXCLUDE_SECTION $2"; shift ;; -l) diff="diff" ;;@@ -591,6 +599,15 @@ _expunge_test() { local TEST_ID="$1"
Quoted 12 lines
check _expunge_test() · line 609
Quoted 8 lines
check +8
-0+ if $start_after; then + if [[ "$start_after_test" == ${TEST_ID}* ]]; then + start_after=false + fi + echo " [skipped]" + return 0 + + fiI can't understand how you use the --start-after. I though you'd like to remove all cases before the "start-after" from the running list. But when I saw here, I'm a little confused.
I hope the demo in the 2nd version of the patch helps. I'll send a v3.
Luis