Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Steven Rostedt (Google) and committed by
Shuah Khan
7dc1e125 a06023a8

+9 -1
+9 -1
tools/testing/selftests/ftrace/ftracetest
··· 124 124 ;; 125 125 --logdir|-l) 126 126 LOG_DIR=$2 127 + LINK_PTR= 127 128 shift 2 128 129 ;; 129 130 *.tc) ··· 182 181 TOP_DIR=`absdir $0` 183 182 TEST_DIR=$TOP_DIR/test.d 184 183 TEST_CASES=`find_testcases $TEST_DIR` 185 - LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/ 184 + LOG_TOP_DIR=$TOP_DIR/logs 185 + LOG_DATE=`date +%Y%m%d-%H%M%S` 186 + LOG_DIR=$LOG_TOP_DIR/$LOG_DATE/ 187 + LINK_PTR=$LOG_TOP_DIR/latest 186 188 KEEP_LOG=0 187 189 KTAP=0 188 190 DEBUG=0 ··· 211 207 LOG_FILE=$LOG_DIR/ftracetest.log 212 208 mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR" 213 209 date > $LOG_FILE 210 + if [ "x-$LINK_PTR" != "x-" ]; then 211 + unlink $LINK_PTR 212 + ln -fs $LOG_DATE $LINK_PTR 213 + fi 214 214 fi 215 215 216 216 # Define text colors