Backport patch to fix tests

This patch fixes detection of kernel version, which should fix the
failing build-time tests on some arches.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
This commit is contained in:
Ondrej Mosnacek 2019-07-27 18:48:24 +02:00
parent 4cdceabb5d
commit 154ab8363d
2 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,65 @@
From 4529c9d0583654fcdc74de09b5de5edcf6959b04 Mon Sep 17 00:00:00 2001
From: Stephan Mueller <smueller@chronox.de>
Date: Mon, 27 May 2019 11:33:16 +0200
Subject: [PATCH] Enable testing on kernels >= 5.0
Signed-off-by: Stephan Mueller <smueller@chronox.de>
---
test/libtest.sh | 6 +++++-
test/test.sh | 11 ++++++++---
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/test/libtest.sh b/test/libtest.sh
index 93b2c93..5a1377b 100644
--- a/test/libtest.sh
+++ b/test/libtest.sh
@@ -128,7 +128,11 @@ check_min_kernelver() {
major=$1
minor=$2
- if [ $(uname -r | cut -d"." -f1) -ge $major ]; then
+ if [ $(uname -r | cut -d"." -f1) -gt $major ]; then
+ return 0
+ fi
+
+ if [ $(uname -r | cut -d"." -f1) -eq $major ]; then
if [ $(uname -r | cut -d"." -f2) -ge $minor ]; then
return 0
fi
diff --git a/test/test.sh b/test/test.sh
index 6320ad0..96136c5 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -907,8 +907,13 @@ kppfunc()
rfc4106_aad_iv() {
assoc=$1
iv=$2
+
# New name with 4.2
- if [ $(uname -r | cut -d"." -f1) -ge 4 ]; then
+ if [ $(uname -r | cut -d"." -f1) -gt 4 ]; then
+ assoc="${assoc}${iv}"
+ fi
+
+ if [ $(uname -r | cut -d"." -f1) -eq 4 ]; then
if [ $(uname -r | cut -d"." -f2) -ge 2 ]; then
assoc="${assoc}${iv}"
fi
@@ -1549,7 +1554,7 @@ else
echo_deact "AEAD tests of copied AAD deactivated"
fi
-if $(check_min_kernelver 4 99); then
+if $(check_min_kernelver 5 99); then
asymfunc 4
asymfunc 4 -s
asymfunc 4 -v
@@ -1572,7 +1577,7 @@ else
echo_deact "All asymmetric tests deactivated"
fi
-if $(check_min_kernelver 4 99); then
+if $(check_min_kernelver 5 99); then
kppfunc 13
kppfunc 13 X -m
kppfunc 13 -v

View File

@ -97,7 +97,7 @@ bin/kcapi-hasher -n fipshmac -d "$lib_path"/fipscheck \\\
Name: libkcapi
Version: %{vmajor}.%{vminor}.%{vpatch}
Release: 4%{?dist}
Release: 5%{?dist}
Summary: User space interface to the Linux Kernel Crypto API
License: BSD or GPLv2
@ -107,6 +107,7 @@ Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc
Patch0: %{giturl}/commit/52620ec798a5.patch#/000-Fix-build-with-gcc-8.2.x.patch
Patch1: 001-workaround-cppcheck-bug.patch
Patch2: %{giturl}/commit/4529c9d05836.patch#/002-Enable-testing-on-kernels-5.0.patch
BuildRequires: clang
BuildRequires: coreutils
@ -448,6 +449,9 @@ popd
%changelog
* Sat Jul 27 2019 Ondrej Mosnáček <omosnace@redhat.com> - 1.1.4-5
- Backport patch to fix tests
* Thu Jul 25 2019 Ondrej Mosnáček <omosnace@redhat.com> - 1.1.4-4
- Work around cppcheck issue
- Enable gating