* [PATCH] ftrace/selftests: Add softlink to latest log directory
@ 2023-09-08 22:17 Steven Rostedt
2023-09-11 0:21 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2023-09-08 22:17 UTC (permalink / raw)
To: LKML, Linux Trace Kernel, linux-kselftest
Cc: Shuah Khan, Shuah Khan, Masami Hiramatsu, Mark Rutland
From: Steven Rostedt (Google) <rostedt@goodmis.org>
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>
---
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
index cb5f18c06593..7df8baa0f98f 100755
--- a/tools/testing/selftests/ftrace/ftracetest
+++ b/tools/testing/selftests/ftrace/ftracetest
@@ -124,6 +124,7 @@ parse_opts() { # opts
;;
--logdir|-l)
LOG_DIR=$2
+ LINK_PTR=
shift 2
;;
*.tc)
@@ -181,7 +182,10 @@ fi
TOP_DIR=`absdir $0`
TEST_DIR=$TOP_DIR/test.d
TEST_CASES=`find_testcases $TEST_DIR`
-LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
+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
KEEP_LOG=0
KTAP=0
DEBUG=0
@@ -207,6 +211,10 @@ else
LOG_FILE=$LOG_DIR/ftracetest.log
mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR"
date > $LOG_FILE
+ if [ "x-$LINK_PTR" != "x-" ]; then
+ unlink $LINK_PTR
+ ln -fs $LOG_DATE $LINK_PTR
+ fi
fi
# Define text colors
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] ftrace/selftests: Add softlink to latest log directory
2023-09-08 22:17 [PATCH] ftrace/selftests: Add softlink to latest log directory Steven Rostedt
@ 2023-09-11 0:21 ` Masami Hiramatsu
2023-09-11 18:07 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2023-09-11 0:21 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Linux Trace Kernel, linux-kselftest, Shuah Khan, Shuah Khan,
Masami Hiramatsu, Mark Rutland
On Fri, 8 Sep 2023 18:17:21 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt (Google) <rostedt@goodmis.org>
>
> 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!
>
Nice! I like this and this looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thank you!
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
>
> diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest
> index cb5f18c06593..7df8baa0f98f 100755
> --- a/tools/testing/selftests/ftrace/ftracetest
> +++ b/tools/testing/selftests/ftrace/ftracetest
> @@ -124,6 +124,7 @@ parse_opts() { # opts
> ;;
> --logdir|-l)
> LOG_DIR=$2
> + LINK_PTR=
> shift 2
> ;;
> *.tc)
> @@ -181,7 +182,10 @@ fi
> TOP_DIR=`absdir $0`
> TEST_DIR=$TOP_DIR/test.d
> TEST_CASES=`find_testcases $TEST_DIR`
> -LOG_DIR=$TOP_DIR/logs/`date +%Y%m%d-%H%M%S`/
> +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
> KEEP_LOG=0
> KTAP=0
> DEBUG=0
> @@ -207,6 +211,10 @@ else
> LOG_FILE=$LOG_DIR/ftracetest.log
> mkdir -p $LOG_DIR || errexit "Failed to make a log directory: $LOG_DIR"
> date > $LOG_FILE
> + if [ "x-$LINK_PTR" != "x-" ]; then
> + unlink $LINK_PTR
> + ln -fs $LOG_DATE $LINK_PTR
> + fi
> fi
>
> # Define text colors
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ftrace/selftests: Add softlink to latest log directory
2023-09-11 0:21 ` Masami Hiramatsu
@ 2023-09-11 18:07 ` Steven Rostedt
2023-09-11 20:41 ` Shuah Khan
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2023-09-11 18:07 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: LKML, Linux Trace Kernel, linux-kselftest, Shuah Khan, Shuah Khan,
Mark Rutland
On Mon, 11 Sep 2023 09:21:05 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> On Fri, 8 Sep 2023 18:17:21 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From: Steven Rostedt (Google) <rostedt@goodmis.org>
> >
> > 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!
> >
>
> Nice! I like this and this looks good to me.
>
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Thank you!
>
Should this go via Shuah's tree?
-- Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ftrace/selftests: Add softlink to latest log directory
2023-09-11 18:07 ` Steven Rostedt
@ 2023-09-11 20:41 ` Shuah Khan
0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2023-09-11 20:41 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu (Google)
Cc: LKML, Linux Trace Kernel, linux-kselftest, Shuah Khan,
Mark Rutland, Shuah Khan
On 9/11/23 12:07, Steven Rostedt wrote:
> On Mon, 11 Sep 2023 09:21:05 +0900
> Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
>
>> On Fri, 8 Sep 2023 18:17:21 -0400
>> Steven Rostedt <rostedt@goodmis.org> wrote:
>>
>>> From: Steven Rostedt (Google) <rostedt@goodmis.org>
>>>
>>> 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!
>>>
>>
>> Nice! I like this and this looks good to me.
>>
>> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>>
>> Thank you!
>>
>
> Should this go via Shuah's tree?
>
Looks like it is a self contained patch. I will take it.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-11 22:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-08 22:17 [PATCH] ftrace/selftests: Add softlink to latest log directory Steven Rostedt
2023-09-11 0:21 ` Masami Hiramatsu
2023-09-11 18:07 ` Steven Rostedt
2023-09-11 20:41 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).