summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-02-10 12:54:12 +0300
committerShuah Khan <skhan@linuxfoundation.org>2026-03-31 22:06:18 +0300
commite011853dd78f97898ae8e0b0b949603987e24c4b (patch)
tree5d9c4d15ef3375d7d151cc2e01cc42678cb418b7 /tools/testing
parent6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f (diff)
downloadlinux-e011853dd78f97898ae8e0b0b949603987e24c4b.tar.xz
selftests/tracing: Fix to make --logdir option work again
Since commit a0aa283c53a7 ("selftest/ftrace: Generalise ftracetest to use with RV") moved the default LOG_DIR setting after --logdir option parser, it overwrites the user given LOG_DIR. This fixes it to check the --logdir option parameter when setting new default LOG_DIR with a new TOP_DIR. Fixes: a0aa283c53a7 ("selftest/ftrace: Generalise ftracetest to use with RV") Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Tested-by: Gabriele Monaco <gmonaco@redhat.com> Link: https://lore.kernel.org/r/177071725191.2369897.14781037901532893911.stgit@mhiramat.tok.corp.google.com Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing')
-rwxr-xr-xtools/testing/selftests/ftrace/ftracetest18
1 files changed, 12 insertions, 6 deletions
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index 3230bd54dba8..0a56bf209f6c 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -130,8 +130,7 @@ parse_opts() { # opts
shift 1
;;
--logdir|-l)
- LOG_DIR=$2
- LINK_PTR=
+ USER_LOG_DIR=$2
shift 2
;;
--rv)
@@ -199,6 +198,7 @@ fi
TOP_DIR=`absdir $0`
TEST_DIR=$TOP_DIR/test.d
TEST_CASES=`find_testcases $TEST_DIR`
+USER_LOG_DIR=
KEEP_LOG=0
KTAP=0
DEBUG=0
@@ -210,12 +210,18 @@ RV_TEST=0
# Parse command-line options
parse_opts $*
+[ $DEBUG -ne 0 ] && set -x
+
+# TOP_DIR can be changed for rv. Setting log directory.
LOG_TOP_DIR=$TOP_DIR/logs
LOG_DATE=`date +%Y%m%d-%H%M%S`
-LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/
-LINK_PTR=$LOG_TOP_DIR/latest
-
-[ $DEBUG -ne 0 ] && set -x
+if [ -n "$USER_LOG_DIR" ]; then
+ LOG_DIR=$USER_LOG_DIR
+ LINK_PTR=
+else
+ LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/
+ LINK_PTR=$LOG_TOP_DIR/latest
+fi
if [ $RV_TEST -ne 0 ]; then
TRACING_DIR=$TRACING_DIR/rv