selftests: ftrace: Do not failure if there is unsupported tests
Masami Hiramatsu
maintainerPATCH 1/2 selftests: ftrace: Do not failure if there is unsupported tests
Do not return failure exit code (1) for unsupported testcases, since it is expected for stable kernels.
Previously, ftracetest is expected to run only on current release for avoiding regressions. However, nowadays we run it on stable kernels. This means some test cases must return unsupported result. In such case, we should NOT exit ftracetest with error status for unsupported results so that kselftest (upper tests wrapper) shows it passed correctly.
Note that we continue to treat unresolved results as failure, if test writers would like to notice user that the test result should be reviewed, they can use exit_unresolved.
--- tools/testing/selftests/ftrace/ftracetest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/ftracetest +1 -1
@@ -187,7 +187,7 @@ eval_result() { # sigval $UNSUPPORTED) prlog " [UNSUPPORTED]" UNSUPPORTED_CASES="$UNSUPPORTED_CASES $CASENO" - return 1 # this is not a bug, but the result should be reported. + return 0 # this is not a bug. ;; $XFAIL) prlog " [XFAIL]"
Masami Hiramatsu
maintainerPATCH 2/2 selftests: ftrace: Add more verbosity for immediate log
Add 3-level verbosity for showing traced command log on console immediately. Since some test cases can cause kernel pacic if there is a probrem (like regression etc.), we can not know which command caused the problem without traced command log. This verbosity (-vvv) solves that because it shows the log on console immediately. User can get continuous command/error log.
Note that this is a kind of kernel debug mode, if you don't see any kernel related issue, you don't need this verbosity.
--- tools/testing/selftests/ftrace/ftracetest | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/ftracetest +6 -2
@@ -15,6 +15,7 @@ echo " -h|--help Show help message" echo " -k|--keep Keep passed test logs" echo " -v|--verbose Increase verbosity of test messages" echo " -vv Alias of -v -v (Show all results in stdout)" +echo " -vvv Alias of -v -v -v (Show all commands immediately)" echo " -d|--debug Debug mode (trace all shell commands)" echo " -l|--logdir <dir> Save logs on the <dir>" exit $1
@@ -56,9 +57,10 @@ parse_opts() { # opts KEEP_LOG=1 shift 1 ;; - --verbose|-v|-vv) + --verbose|-v|-vv|-vvv) VERBOSE=$((VERBOSE + 1)) [ $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1)) + [ $1 = '-vvv' ] && VERBOSE=$((VERBOSE + 2)) shift 1 ;; --debug|-d)
@@ -252,7 +254,9 @@ run_test() { # testfile testcase $1 echo "execute$INSTANCE: "$1 > $testlog SIG_RESULT=0 - if [ $VERBOSE -ge 2 ]; then + if [ $VERBOSE -ge 3 ]; then + __run_test $1 | tee -a $testlog 2>&1 + elif [ $VERBOSE -eq 2 ]; then __run_test $1 2>> $testlog | tee -a $testlog else __run_test $1 >> $testlog 2>&1
Steven Rostedt
maintainerRe: [PATCH 2/2] selftests: ftrace: Add more verbosity for immediate log
Quoted 42 lines · On Mon, 3 Jul 2017 14:26:40 +0900 Masami Hiramatsu <[email protected]> wrote:
Add 3-level verbosity for showing traced command log on console immediately. Since some test cases can cause kernel pacic if there is a probrem (like regression etc.), we can not know which command caused the problem without traced command log. This verbosity (-vvv) solves that because it shows the log on console immediately. User can get continuous command/error log.
Note that this is a kind of kernel debug mode, if you don't see any kernel related issue, you don't need this verbosity.
Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/ftracetest | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/testing/selftests/ftrace/ftracetest +3
-1@@ -15,6 +15,7 @@ echo " -h|--help Show help message" echo " -k|--keep Keep passed test logs" echo " -v|--verbose Increase verbosity of test messages" echo " -vv Alias of -v -v (Show all results in stdout)" +echo " -vvv Alias of -v -v -v (Show all commands immediately)" echo " -d|--debug Debug mode (trace all shell commands)" echo " -l|--logdir <dir> Save logs on the <dir>" exit $1@@ -56,9 +57,10 @@ parse_opts() { # opts KEEP_LOG=1 shift 1 ;; - --verbose|-v|-vv) + --verbose|-v|-vv|-vvv) VERBOSE=$((VERBOSE + 1)) [ $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1)) + [ $1 = '-vvv' ] && VERBOSE=$((VERBOSE + 2)) shift 1 ;; --debug|-d)
tools/testing/selftests/ftrace/ftracetest run_test() { # testfile · line 258
Quoted 6 lines
tools/testing/selftests/ftrace/ftracetest +2
-1@@ -252,7 +254,9 @@ run_test() { # testfile testcase $1 echo "execute$INSTANCE: "$1 > $testlog SIG_RESULT=0 - if [ $VERBOSE -ge 2 ]; then + if [ $VERBOSE -ge 3 ]; then + __run_test $1 | tee -a $testlog 2>&1
I have nothing against this patch, but I want to point out that the above is far from printing everything out immediately. The tee command buffers a bit. At least it has for me in the past. If the kernel does crash, one needs to still be a bit weary of where exactly the crash happened.
Perhaps we need an option to print not to a log, but just let the test print out directly?
-- Steve
Quoted 4 lines
tools/testing/selftests/ftrace/ftracetest +1
-0+ elif [ $VERBOSE -eq 2 ]; then __run_test $1 2>> $testlog | tee -a $testlog else __run_test $1 >> $testlog 2>&1
Masami Hiramatsu
maintainerRe: [PATCH 2/2] selftests: ftrace: Add more verbosity for immediate log
Quoted 49 lines · On Mon, 3 Jul 2017 09:19:36 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 46 lines · On Mon, 3 Jul 2017 14:26:40 +0900 Masami Hiramatsu <[email protected]> wrote:
Add 3-level verbosity for showing traced command log on console immediately. Since some test cases can cause kernel pacic if there is a probrem (like regression etc.), we can not know which command caused the problem without traced command log. This verbosity (-vvv) solves that because it shows the log on console immediately. User can get continuous command/error log.
Note that this is a kind of kernel debug mode, if you don't see any kernel related issue, you don't need this verbosity.
Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/ftracetest | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)tools/testing/selftests/ftrace/ftracetest +3
-2@@ -15,6 +15,7 @@ echo " -h|--help Show help message" echo " -k|--keep Keep passed test logs" echo " -v|--verbose Increase verbosity of test messages" echo " -vv Alias of -v -v (Show all results in stdout)" +echo " -vvv Alias of -v -v -v (Show all commands immediately)" echo " -d|--debug Debug mode (trace all shell commands)" echo " -l|--logdir <dir> Save logs on the <dir>" exit $1@@ -56,9 +57,10 @@ parse_opts() { # opts KEEP_LOG=1 shift 1 ;; - --verbose|-v|-vv) + --verbose|-v|-vv|-vvv) VERBOSE=$((VERBOSE + 1)) [ $1 = '-vv' ] && VERBOSE=$((VERBOSE + 1)) + [ $1 = '-vvv' ] && VERBOSE=$((VERBOSE + 2)) shift 1 ;; --debug|-d)@@ -252,7 +254,9 @@ run_test() { # testfile testcase $1 echo "execute$INSTANCE: "$1 > $testlog SIG_RESULT=0 - if [ $VERBOSE -ge 2 ]; then
Quoted 8 lines
tools/testing/selftests/ftrace/ftracetest run_test() { # testfile · line 258
Quoted 2 lines
tools/testing/selftests/ftrace/ftracetest +2
-0+ if [ $VERBOSE -ge 3 ]; then + __run_test $1 | tee -a $testlog 2>&1I have nothing against this patch, but I want to point out that the above is far from printing everything out immediately. The tee command buffers a bit. At least it has for me in the past. If the kernel does crash, one needs to still be a bit weary of where exactly the crash happened.
Indeed.
Quoted 2 lines
Perhaps we need an option to print not to a log, but just let the test print out directly?
OK, then I'd like to add "--logdir -" option instead of this. (if someone can correct console log, they may not need logfile)
Thank you,
Quoted 10 lines
-- Steve
Quoted 4 lines
tools/testing/selftests/ftrace/ftracetest +1
-0+ elif [ $VERBOSE -eq 2 ]; then __run_test $1 2>> $testlog | tee -a $testlog else __run_test $1 >> $testlog 2>&1
Signature · 1 line
Masami Hiramatsu <[email protected]>
Steven Rostedt
maintainerQuoted 9 lines · On Mon, 3 Jul 2017 14:25:36 +0900 Masami Hiramatsu <[email protected]> wrote:
Do not return failure exit code (1) for unsupported testcases, since it is expected for stable kernels.
Previously, ftracetest is expected to run only on current release for avoiding regressions. However, nowadays we run it on stable kernels. This means some test cases must return unsupported result. In such case, we should NOT exit ftracetest with error status for unsupported results so that kselftest (upper tests wrapper) shows it passed correctly.
I wonder if we should change kselftest instead. There are case where we want to report "unsupported" as a failure. For instance, I have tests where I enable everything, and if a test returns "unsupported" then it is a failure for me.
Can we add an option in kselftest, or to ftracetest that decides if unsupported is a failure or not? Otherwise I can not ack this patch.
-- Steve
Quoted 23 lines
Note that we continue to treat unresolved results as failure, if test writers would like to notice user that the test result should be reviewed, they can use
exit_unresolved.Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/ftracetest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/ftracetest +1
-1@@ -187,7 +187,7 @@ eval_result() { # sigval $UNSUPPORTED) prlog " [UNSUPPORTED]" UNSUPPORTED_CASES="$UNSUPPORTED_CASES $CASENO" - return 1 # this is not a bug, but the result should be reported. + return 0 # this is not a bug. ;; $XFAIL) prlog " [XFAIL]"
Masami Hiramatsu
maintainerQuoted 13 lines · On Mon, 3 Jul 2017 09:15:43 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 9 lines · On Mon, 3 Jul 2017 14:25:36 +0900 Masami Hiramatsu <[email protected]> wrote:
Do not return failure exit code (1) for unsupported testcases, since it is expected for stable kernels.
Previously, ftracetest is expected to run only on current release for avoiding regressions. However, nowadays we run it on stable kernels. This means some test cases must return unsupported result. In such case, we should NOT exit ftracetest with error status for unsupported results so that kselftest (upper tests wrapper) shows it passed correctly.
Quoted 4 lines
I wonder if we should change kselftest instead. There are case where we want to report "unsupported" as a failure. For instance, I have tests where I enable everything, and if a test returns "unsupported" then it is a failure for me.
OK, that's a possible usecase.
Quoted 3 lines
Can we add an option in kselftest, or to ftracetest that decides if unsupported is a failure or not? Otherwise I can not ack this patch.
I would rather like to add an option to ftracetest instead of kselftest, because whether the tested feature should be supported or not is hard to decide from testing framework. It should be checked by manual.
Thank you,
Quoted 28 lines
-- Steve
Quoted 23 lines
Note that we continue to treat unresolved results as failure, if test writers would like to notice user that the test result should be reviewed, they can use
exit_unresolved.Signed-off-by Masami Hiramatsu <[email protected]>--- tools/testing/selftests/ftrace/ftracetest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/ftrace/ftracetest +1
-1@@ -187,7 +187,7 @@ eval_result() { # sigval $UNSUPPORTED) prlog " [UNSUPPORTED]" UNSUPPORTED_CASES="$UNSUPPORTED_CASES $CASENO" - return 1 # this is not a bug, but the result should be reported. + return 0 # this is not a bug. ;; $XFAIL) prlog " [XFAIL]"
Signature · 1 line
Masami Hiramatsu <[email protected]>
Steven Rostedt
maintainerQuoted 9 lines · On Tue, 4 Jul 2017 00:52:32 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 4 lines
Can we add an option in kselftest, or to ftracetest that decides if unsupported is a failure or not? Otherwise I can not ack this patch.
I would rather like to add an option to ftracetest instead of kselftest, because whether the tested feature should be supported or not is hard to decide from testing framework. It should be checked by manual.
Can we do both? That is, add an option to have ftracetest not fail on "unsupported" but have it fail by default. We can have kselftest just pass in a parameter to ftracetest that has unsupported not fail?
But if that is too difficult, then I can live with modifying my test case to add the option.
-- Steve
Masami Hiramatsu
maintainerQuoted 7 lines · On Mon, 3 Jul 2017 11:59:06 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines · On Tue, 4 Jul 2017 00:52:32 +0900 Masami Hiramatsu <[email protected]> wrote:
Quoted 4 lines
Can we add an option in kselftest, or to ftracetest that decides if unsupported is a failure or not? Otherwise I can not ack this patch.
Quoted 8 lines
Quoted 4 lines
I would rather like to add an option to ftracetest instead of kselftest, because whether the tested feature should be supported or not is hard to decide from testing framework. It should be checked by manual.
Can we do both? That is, add an option to have ftracetest not fail on "unsupported" but have it fail by default. We can have kselftest just pass in a parameter to ftracetest that has unsupported not fail?
I rather like to treat unsupported as success (or XFAIL) by default and add "--fail-unsupported" option.
Thank you,
Quoted 4 lines
But if that is too difficult, then I can live with modifying my test case to add the option.
-- Steve
Signature · 1 line
Masami Hiramatsu <[email protected]>