libkcapi/002-Enable-testing-on-kernels-5.0.patch
Ondrej Mosnacek 154ab8363d 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>
2019-07-27 18:50:26 +02:00

66 lines
1.7 KiB
Diff

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