From c790537b898e3f82ff08900b755701432b0b5d27 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 25 Apr 2024 12:43:18 +0100 Subject: [PATCH 1/2] test: use sd-analyze for kernel version check in TEST-62 --- test/units/testsuite-62.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/test/units/testsuite-62.sh b/test/units/testsuite-62.sh index 84c92247b81..1fbb3cb1c22 100755 --- a/test/units/testsuite-62.sh +++ b/test/units/testsuite-62.sh @@ -34,15 +34,7 @@ teardown() { systemd-analyze log-level info } -KERNEL_VERSION="$(uname -r)" -KERNEL_MAJOR="${KERNEL_VERSION%%.*}" -KERNEL_MINOR="${KERNEL_VERSION#"$KERNEL_MAJOR".}" -KERNEL_MINOR="${KERNEL_MINOR%%.*}" - -MAJOR_REQUIRED=5 -MINOR_REQUIRED=7 - -if [[ "$KERNEL_MAJOR" -lt $MAJOR_REQUIRED || ("$KERNEL_MAJOR" -eq $MAJOR_REQUIRED && "$KERNEL_MINOR" -lt $MINOR_REQUIRED) ]]; then +if systemd-analyze compare-versions "$(uname -r)" lt 5.7; then echo "kernel is not 5.7+" >>/skipped exit 77 fi From f9419fe610e542085dc6a3e81cf998c0fa66e00e Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 25 Apr 2024 11:57:09 +0100 Subject: [PATCH 2/2] test: skip testsuite-50.mountnfsd if kernel/polkit are too old Need full support of pidfd to work, so skip the test if it's not available --- test/TEST-50-DISSECT/test.sh | 1 + test/units/testsuite-50.mountnfsd.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/TEST-50-DISSECT/test.sh b/test/TEST-50-DISSECT/test.sh index b93697b73c7..a0cd677f075 100755 --- a/test/TEST-50-DISSECT/test.sh +++ b/test/TEST-50-DISSECT/test.sh @@ -36,6 +36,7 @@ test_append_files() { fi inst_binary mksquashfs inst_binary unsquashfs + inst_binary pkcheck install_verity_minimal } diff --git a/test/units/testsuite-50.mountnfsd.sh b/test/units/testsuite-50.mountnfsd.sh index fea6b7d50b7..59974e41e62 100755 --- a/test/units/testsuite-50.mountnfsd.sh +++ b/test/units/testsuite-50.mountnfsd.sh @@ -10,7 +10,9 @@ if [[ ! -f /usr/lib/systemd/system/systemd-mountfsd.socket ]] || \ [[ ! -f /usr/lib/systemd/system/systemd-nsresourced.socket ]] || \ ! command -v mksquashfs || \ ! grep -q bpf /sys/kernel/security/lsm || - ! find /usr/lib* -name libbpf.so.1 2>/dev/null | grep .; then + ! find /usr/lib* -name libbpf.so.1 2>/dev/null | grep . || \ + systemd-analyze compare-versions "$(uname -r)" lt 6.5 || \ + systemd-analyze compare-versions "$(pkcheck --version | awk '{print $3}')" lt 124; then echo "Skipping mountnfsd/nsresourced tests" exit 0 fi