Skip to content

Commit

Permalink
ftracetest: Fix instance test to use proper shell command for pids
Browse files Browse the repository at this point in the history
The ftracetest instance test used parsing of the "jobs" output to find the
pid of the subshell that is executed previously. But this is not portable to
all major shells that may run these tests. The proper way to get the pid of
the subshell is the shell command "$!". This will return the pid of the
previously executed command. Use that instead, otherwise the test does not
work in all environments.

Link: http://lkml.kernel.org/r/[email protected]

Reported-by: Michael Ellerman <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
rostedt committed Feb 19, 2016
1 parent b33c8ff commit 9a154c8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tools/testing/selftests/ftrace/test.d/instances/instance.tc
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,23 @@ instance_slam() {
}

instance_slam &
x=`jobs -l`
p1=`echo $x | cut -d' ' -f2`
p1=$!
echo $p1

instance_slam &
x=`jobs -l | tail -1`
p2=`echo $x | cut -d' ' -f2`
p2=$!
echo $p2

instance_slam &
x=`jobs -l | tail -1`
p3=`echo $x | cut -d' ' -f2`
p3=$!
echo $p3

instance_slam &
x=`jobs -l | tail -1`
p4=`echo $x | cut -d' ' -f2`
p4=$!
echo $p4

instance_slam &
x=`jobs -l | tail -1`
p5=`echo $x | cut -d' ' -f2`
p5=$!
echo $p5

ls -lR >/dev/null
Expand Down

0 comments on commit 9a154c8

Please sign in to comment.