提交 9e14ef60 编写于 作者: M Masami Hiramatsu 提交者: Shuah Khan

kselftest: ftrace: Fix to compare a zero-filled hex value

Fix to compare a zero-filled hexadecimal value with a part of
string of long hexadecimal value.

In check_types(), the last part of testcase compares with
the hex value formatted by "%x" with a part of a string of
long hex value (trimmed by tail -c and head -c). However,
if that part of long hex value contains zero (e.g. "05" of
"a3082059"), printf generated value (e.g. "5") is diffrent
string, and the test case failed.

To fix this, pass "%02x" instead of "%x" to printf.
Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
上级 7ba31340
...@@ -26,7 +26,7 @@ check_types() { ...@@ -26,7 +26,7 @@ check_types() {
test $X2 = $X3 test $X2 = $X3
test 0x$X3 = $3 test 0x$X3 = $3
B4=`printf "%x" $4` B4=`printf "%02x" $4`
B3=`echo -n $X3 | tail -c 3 | head -c 2` B3=`echo -n $X3 | tail -c 3 | head -c 2`
test $B3 = $B4 test $B3 = $B4
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册