[CRIU] [PATCH 1/6] zdtm: Make kernel version check more POSIX-like
Pavel Emelyanov
xemul at parallels.com
Tue Aug 12 03:29:03 PDT 2014
On 08/07/2014 02:02 AM, Christopher Covington wrote:
> 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>
Andrey, please, review this patch.
> ---
> 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
> }
>
More information about the CRIU
mailing list