Skip to content

Commit 7dc1e12

Browse files
rostedtshuahkh
authored andcommitted
ftrace/selftests: Add softlink to latest log directory
When I'm debugging something with the ftrace selftests and need to look at the logs, it becomes tedious that I need to do the following: ls -ltr logs [ copy the last directory ] ls logs/<paste-last-dir> to see where the logs are. Instead, do the common practice of having a "latest" softlink to the last run selftest. This way after running the selftest I only need to do: ls logs/latest/ and it will always give me the directory of the last run selftest logs! Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent a06023a commit 7dc1e12

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tools/testing/selftests/ftrace/ftracetest

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ parse_opts() { # opts
124124
;;
125125
--logdir|-l)
126126
LOG_DIR=$2
127+
LINK_PTR=
127128
shift 2
128129
;;
129130
*.tc)
@@ -181,7 +182,10 @@ fi
181182
TOP_DIR=`absdir $0`
182183
TEST_DIR=$TOP_DIR/test.d
183184
TEST_CASES=`find_testcases $TEST_DIR`
184-
LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
185+
LOG_TOP_DIR=$TOP_DIR/logs
186+
LOG_DATE=`date +%Y%m%d-%H%M%S`
187+
LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/
188+
LINK_PTR=$LOG_TOP_DIR/latest
185189
KEEP_LOG=0
186190
KTAP=0
187191
DEBUG=0
@@ -207,6 +211,10 @@ else
207211
LOG_FILE=$LOG_DIR/ftracetest.log
208212
mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR"
209213
date > $LOG_FILE
214+
if [ "x-$LINK_PTR" != "x-" ]; then
215+
unlink $LINK_PTR
216+
ln -fs $LOG_DATE $LINK_PTR
217+
fi
210218
fi
211219

212220
# Define text colors

0 commit comments

Comments
 (0)