Skip to content

Commit e011853

Browse files
mhiramatshuahkh
authored andcommitted
selftests/tracing: Fix to make --logdir option work again
Since commit a0aa283 ("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: a0aa283 ("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>
1 parent 6de23f8 commit e011853

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

tools/testing/selftests/ftrace/ftracetest

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ parse_opts() { # opts
130130
shift 1
131131
;;
132132
--logdir|-l)
133-
LOG_DIR=$2
134-
LINK_PTR=
133+
USER_LOG_DIR=$2
135134
shift 2
136135
;;
137136
--rv)
@@ -199,6 +198,7 @@ fi
199198
TOP_DIR=`absdir $0`
200199
TEST_DIR=$TOP_DIR/test.d
201200
TEST_CASES=`find_testcases $TEST_DIR`
201+
USER_LOG_DIR=
202202
KEEP_LOG=0
203203
KTAP=0
204204
DEBUG=0
@@ -210,12 +210,18 @@ RV_TEST=0
210210
# Parse command-line options
211211
parse_opts $*
212212

213+
[ $DEBUG -ne 0 ] && set -x
214+
215+
# TOP_DIR can be changed for rv. Setting log directory.
213216
LOG_TOP_DIR=$TOP_DIR/logs
214217
LOG_DATE=`date +%Y%m%d-%H%M%S`
215-
LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/
216-
LINK_PTR=$LOG_TOP_DIR/latest
217-
218-
[ $DEBUG -ne 0 ] && set -x
218+
if [ -n "$USER_LOG_DIR" ]; then
219+
LOG_DIR=$USER_LOG_DIR
220+
LINK_PTR=
221+
else
222+
LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/
223+
LINK_PTR=$LOG_TOP_DIR/latest
224+
fi
219225

220226
if [ $RV_TEST -ne 0 ]; then
221227
TRACING_DIR=$TRACING_DIR/rv

0 commit comments

Comments
 (0)