[CRIU] [PATCH 1/6] zdtm: Make kernel version check more POSIX-like

Christopher Covington cov at codeaurora.org
Wed Aug 6 15:02:09 PDT 2014


Arrays and "&&" in test are not supported by Busybox v1.19.4. The
`set` command can put field-separated arguments into the positional
parameters, which is relatively equivalent to using an array.

Signed-off-by: Christopher Covington <cov at codeaurora.org>
---
 test/zdtm.sh | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 1c7bfef..19f74da 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -257,9 +257,6 @@ check_criu()
 
 check_mainstream()
 {
-	local -a ver_arr
-	local ver_str=`uname -r`
-
 	zdtm_sep "CRIU CHECK"
 
 	$CRIU check && return 0
@@ -273,12 +270,12 @@ git://git.kernel.org/pub/scm/linux/kernel/git/gorcunov/linux-cr.git
 ===================================================================
 EOF
 
-	ver_arr=(`echo ${ver_str//./ }`)
+	set -- `uname -r | sed 's/\./ /g'`
 
-	[ "${ver_arr[0]}" -gt 3 ] && return 0
-	[[ "${ver_arr[0]}" -eq 3 && "${ver_arr[1]}" -ge 11 ]] && return 0
+	[ $1 -gt 3 ] && return 0
+	[ $1 -eq 3 -a $2 -ge 11 ] && return 0
 
-	echo "A version of kernel should be greater or equal to 3.11" >&2
+	echo "Kernel version should be greater than or equal to 3.11" >&2
 
 	return 1
 }
-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.



More information about the CRIU mailing list