Message ID | 20230501041415.49939-1-shinichiro.kawasaki@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [blktests] common/rc: fix kernel version parse failure | expand |
On 4/30/23 21:14, Shin'ichiro Kawasaki wrote: > When kernel version numbers have postfix letters, _have_fio_ver fail to > parse the version. For example, uname -r returns "6.3.0+", it handles > "0+" as a number and fails to parse. Fix it by dropping all letters > other than numbers or period. > > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> > --- > common/rc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/common/rc b/common/rc > index af4c0b1..525867c 100644 > --- a/common/rc > +++ b/common/rc > @@ -207,7 +207,7 @@ _have_kernel_option() { > _have_kver() { > local d=$1 e=$2 f=$3 > > - IFS='.' read -r a b c < <(uname -r | sed 's/-.*//') > + IFS='.' read -r a b c < <(uname -r | sed 's/-.*//' | sed 's/[^.0-9]//') > if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ]; > then > SKIP_REASONS+=("Kernel version too old") I was about to post the same fix as nvme queue count testcase if not running with postfix letters. Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck
On 4/30/23 21:14, Shin'ichiro Kawasaki wrote: > When kernel version numbers have postfix letters, _have_fio_ver fail to > parse the version. For example, uname -r returns "6.3.0+", it handles > "0+" as a number and fails to parse. Fix it by dropping all letters > other than numbers or period. > > Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> > --- > common/rc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/common/rc b/common/rc > index af4c0b1..525867c 100644 > --- a/common/rc > +++ b/common/rc > @@ -207,7 +207,7 @@ _have_kernel_option() { > _have_kver() { > local d=$1 e=$2 f=$3 > > - IFS='.' read -r a b c < <(uname -r | sed 's/-.*//') > + IFS='.' read -r a b c < <(uname -r | sed 's/-.*//' | sed 's/[^.0-9]//') > if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ]; > then > SKIP_REASONS+=("Kernel version too old") Please combine the two sed statements into a single sed statement, e.g. as follows: sed 's/-.*//;s/[^.0-9]//' Thanks, Bart.
On May 01, 2023 / 09:38, Bart Van Assche wrote: [...] > Please combine the two sed statements into a single sed statement, e.g. as > follows: > > sed 's/-.*//;s/[^.0-9]//' Thanks. I've applied the patch with the suggested change.
diff --git a/common/rc b/common/rc index af4c0b1..525867c 100644 --- a/common/rc +++ b/common/rc @@ -207,7 +207,7 @@ _have_kernel_option() { _have_kver() { local d=$1 e=$2 f=$3 - IFS='.' read -r a b c < <(uname -r | sed 's/-.*//') + IFS='.' read -r a b c < <(uname -r | sed 's/-.*//' | sed 's/[^.0-9]//') if [ $((a * 65536 + b * 256 + c)) -lt $((d * 65536 + e * 256 + f)) ]; then SKIP_REASONS+=("Kernel version too old")
When kernel version numbers have postfix letters, _have_fio_ver fail to parse the version. For example, uname -r returns "6.3.0+", it handles "0+" as a number and fails to parse. Fix it by dropping all letters other than numbers or period. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> --- common/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)