[LTP] [PATCH] tst_kvercmp.sh: strip '+' when $(EXTRAVERSION) is blank

Zhao Gongyi via ltp
2022-06-06T11:39:08Z

$(EXTRAVERSION) defines an even tinier sublevel for pre-patches
or additional patches. It is usually some non-numeric string
such as "-pre4", and is often blank. When $(EXTRAVERSION) is blank,
there may be a extra '+' which shoud be stripped.

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
testcases/open_posix_testsuite/scripts/tst_kvercmp.sh | 1 +
1 file changed, 1 insertion(+)

diff --git a/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
index 69466bb12..ce1d13c72 100755
--- a/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
+++ b/testcases/open_posix_testsuite/scripts/tst_kvercmp.sh
@@ -10,6 +10,7 @@ r1=$(echo ${ker_ver} | awk -F. '{print $1}')
r2=$(echo ${ker_ver} | awk -F. '{print $2}')
r3=$(echo ${ker_ver} | awk -F. '{print $3}')
r3=${r3%%-*}
+r3=${r3%%+*}

test_ver=$(($1 * 65536 + $2 * 256 + $3))
curr_ver=$((${r1} * 65536 + ${r2} * 256 + ${r3}))
--
2.17.1