* [PATCH] selftests/ftrace: Fix eventfs ownership testcase to find mount point
@ 2024-09-04 15:30 Masami Hiramatsu (Google)
2024-09-04 16:20 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu (Google) @ 2024-09-04 15:30 UTC (permalink / raw)
To: Shuah Khan, Steven Rostedt
Cc: Masami Hiramatsu, linux-kernel, linux-trace-kernel,
linux-kselftest
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Fix eventfs ownership testcase to find mount point if stat -c "%m" failed.
This can happen on the system based on busybox. In this case, this will
try to use the current working directory, which should be a tracefs top
directory (and eventfs is mounted as a part of tracefs.)
If it does not work, the test is skipped as UNRESOLVED because of
the environmental problem.
Fixes: ee9793be08b1 ("tracing/selftests: Add ownership modification tests for eventfs")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
.../ftrace/test.d/00basic/test_ownership.tc | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
index c45094d1e1d2..803efd7b56c7 100644
--- a/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
+++ b/tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc
@@ -6,6 +6,18 @@ original_group=`stat -c "%g" .`
original_owner=`stat -c "%u" .`
mount_point=`stat -c '%m' .`
+
+# If stat -c '%m' does not work (e.g. busybox) or failed, try to use the
+# current working directory (which should be a tracefs) as the mount point.
+if [ ! -d "$mount_point" ]; then
+ if mount | grep -qw $PWD ; then
+ mount_point=$PWD
+ else
+ # If PWD doesn't work, that is an environmental problem.
+ exit_unresolved
+ fi
+fi
+
mount_options=`mount | grep "$mount_point" | sed -e 's/.*(\(.*\)).*/\1/'`
# find another owner and group that is not the original
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] selftests/ftrace: Fix eventfs ownership testcase to find mount point
2024-09-04 15:30 [PATCH] selftests/ftrace: Fix eventfs ownership testcase to find mount point Masami Hiramatsu (Google)
@ 2024-09-04 16:20 ` Steven Rostedt
2024-09-04 21:09 ` Shuah Khan
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2024-09-04 16:20 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Shuah Khan, linux-kernel, linux-trace-kernel, linux-kselftest
On Thu, 5 Sep 2024 00:30:21 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Fix eventfs ownership testcase to find mount point if stat -c "%m" failed.
> This can happen on the system based on busybox. In this case, this will
> try to use the current working directory, which should be a tracefs top
> directory (and eventfs is mounted as a part of tracefs.)
> If it does not work, the test is skipped as UNRESOLVED because of
> the environmental problem.
>
> Fixes: ee9793be08b1 ("tracing/selftests: Add ownership modification tests for eventfs")
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-- Steve
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] selftests/ftrace: Fix eventfs ownership testcase to find mount point
2024-09-04 16:20 ` Steven Rostedt
@ 2024-09-04 21:09 ` Shuah Khan
0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2024-09-04 21:09 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu (Google)
Cc: Shuah Khan, linux-kernel, linux-trace-kernel, linux-kselftest,
Shuah Khan
On 9/4/24 10:20, Steven Rostedt wrote:
> On Thu, 5 Sep 2024 00:30:21 +0900
> "Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
>
>> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>>
>> Fix eventfs ownership testcase to find mount point if stat -c "%m" failed.
>> This can happen on the system based on busybox. In this case, this will
>> try to use the current working directory, which should be a tracefs top
>> directory (and eventfs is mounted as a part of tracefs.)
>> If it does not work, the test is skipped as UNRESOLVED because of
>> the environmental problem.
>>
>> Fixes: ee9793be08b1 ("tracing/selftests: Add ownership modification tests for eventfs")
>> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
> -- Steve
Thank you. Applied to linux-kselftest next for Linux 6.12-rc1
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-04 21:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 15:30 [PATCH] selftests/ftrace: Fix eventfs ownership testcase to find mount point Masami Hiramatsu (Google)
2024-09-04 16:20 ` Steven Rostedt
2024-09-04 21:09 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox