Skip to contentSkip to conversation

ftracetest: Take the first debugfs mount found

PATCH In review Steven Rostedt 2 participants 2 messages Oct 31, 2014 – Nov 3, 2014

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

PATCH 1/1 ftracetest: Take the first debugfs mount found

Running ftracetests on a box that mounted debugfs in two locations made the ftracetests fail. This is because the tests uses a grep of debugfs from the /proc/mounts file to find the debugfs mount point, and then appends "/tracing" to that string to get the tracing directory.

If the debugfs directory is mounted twice, then that grep will return two answers and appending "/tracing" to a string with two lines will not work.

Use "head -1" to only take the first mount point found.

---
 tools/testing/selftests/ftrace/ftracetest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/ftracetest +1 -1
index a8f81c782856..515247601df4 100755
@@ -82,7 +82,7 @@ parse_opts() { # opts
 }
 
 # Parameters
-DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' '`
+DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1`
 TRACING_DIR=$DEBUGFS_DIR/tracing
 TOP_DIR=`absdir $0`
 TEST_DIR=$TOP_DIR/test.d
Signature · 1 line
1.8.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Steven Rostedt

Running ftracetests on a box that mounted debugfs in two locations made the ftracetests fail. This is because the tests uses a grep of debugfs from the /proc/mounts file to find the debugfs mount point, and then appends "/tracing" to that string to get the tracing directory.

Quoted 5 lines

If the debugfs directory is mounted twice, then that grep will return two answers and appending "/tracing" to a string with two lines will not work.

Use "head -1" to only take the first mount point found.

Indeed :)

Quoted 2 lines

Thank you!

Quoted 18 lines
---
 tools/testing/selftests/ftrace/ftracetest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/ftracetest +1 -1
index a8f81c782856..515247601df4 100755
@@ -82,7 +82,7 @@ parse_opts() { # opts
 }
 
 # Parameters
-DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' '`
+DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1`
 TRACING_DIR=$DEBUGFS_DIR/tracing
 TOP_DIR=`absdir $0`
 TEST_DIR=$TOP_DIR/test.d
Signature · 4 lines
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: [email protected]