Skip to content

Commit 338d40c

Browse files
committed
Merge tag 'linux_kselftest-fixes-6.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest fix from Shuah Khan: "Fixes dynevent_limitations.tc test failure on dash by detecting and handling bash and dash differences in evaluating \\" * tag 'linux_kselftest-fixes-6.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/ftrace: Differentiate bash and dash in dynevent_limitations.tc
2 parents 7e74f75 + 07be53c commit 338d40c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tools/testing/selftests/ftrace/test.d/dynevent/dynevent_limitations.tc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,32 @@
77
MAX_ARGS=128
88
EXCEED_ARGS=$((MAX_ARGS + 1))
99

10+
# bash and dash evaluate variables differently.
11+
# dash will evaluate '\\' every time it is read whereas bash does not.
12+
#
13+
# TEST_STRING="$TEST_STRING \\$i"
14+
# echo $TEST_STRING
15+
#
16+
# With i=123
17+
# On bash, that will print "\123"
18+
# but on dash, that will print the escape sequence of \123 as the \ will
19+
# be interpreted again in the echo.
20+
#
21+
# Set a variable "bs" to save a double backslash, then echo that
22+
# to "ts" to see if $ts changed or not. If it changed, it's dash,
23+
# if not, it's bash, and then bs can equal a single backslash.
24+
bs='\\'
25+
ts=`echo $bs`
26+
if [ "$ts" = '\\' ]; then
27+
# this is bash
28+
bs='\'
29+
fi
30+
1031
check_max_args() { # event_header
1132
TEST_STRING=$1
1233
# Acceptable
1334
for i in `seq 1 $MAX_ARGS`; do
14-
TEST_STRING="$TEST_STRING \\$i"
35+
TEST_STRING="$TEST_STRING $bs$i"
1536
done
1637
echo "$TEST_STRING" >> dynamic_events
1738
echo > dynamic_events

0 commit comments

Comments
 (0)