Skip to content

Commit f0a6ece

Browse files
mhiramatshuahkh
authored andcommitted
selftests/ftrace: Fix eventfs ownership testcase to find mount point
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: ee9793b ("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> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent b4bcdff commit f0a6ece

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ original_group=`stat -c "%g" .`
66
original_owner=`stat -c "%u" .`
77

88
mount_point=`stat -c '%m' .`
9+
10+
# If stat -c '%m' does not work (e.g. busybox) or failed, try to use the
11+
# current working directory (which should be a tracefs) as the mount point.
12+
if [ ! -d "$mount_point" ]; then
13+
if mount | grep -qw $PWD ; then
14+
mount_point=$PWD
15+
else
16+
# If PWD doesn't work, that is an environmental problem.
17+
exit_unresolved
18+
fi
19+
fi
20+
921
mount_options=`mount | grep "$mount_point" | sed -e 's/.*(\(.*\)).*/\1/'`
1022

1123
# find another owner and group that is not the original

0 commit comments

Comments
 (0)