8d86bd
From 434b4b64d17e16ed23f90c99c26dbd0e4ce6cd88 Mon Sep 17 00:00:00 2001
8d86bd
From: Lennart Poettering <lennart@poettering.net>
8d86bd
Date: Wed, 24 Nov 2021 15:58:50 +0100
8d86bd
Subject: [PATCH] test: make test-execute pass on Linux 5.15
8d86bd
8d86bd
Linux 5.15 broke kernel API:
8d86bd
8d86bd
https://github.com/torvalds/linux/commit/e70344c05995a190a56bbd1a23dc2218bcc8c924
8d86bd
8d86bd
Previously setting IOPRIO_CLASS_NONE for a process would then report
8d86bd
IOPRIO_CLASS_NONE back. But since 5.15 it reports IOPRIO_CLASS_BE
8d86bd
instead. Since IOPRIO_CLASS_NONE is an alias for a special setting of
8d86bd
IOPRIO_CLASS_BE this makes some sense, but it's also a kernel API
8d86bd
breakage that our testsuite trips up on.
8d86bd
8d86bd
(I made some minimal effort to inform the kernel people about this API
8d86bd
breakage during the 5.15 rc phase, but noone was interested.)
8d86bd
8d86bd
Either way let's hadle this gracefully in our test suite and accept
8d86bd
"best-effort" too when "none" was set.
8d86bd
8d86bd
(This is only triggable if the tests are run on 5.15 with full privs)
8d86bd
8d86bd
(cherry picked from commit d9b8771108cf2955efc3852b477391017d2c599a)
8d86bd
8d86bd
Related: #2087152
8d86bd
---
8d86bd
 test/test-execute/exec-ioschedulingclass-none.service | 3 ++-
8d86bd
 1 file changed, 2 insertions(+), 1 deletion(-)
8d86bd
8d86bd
diff --git a/test/test-execute/exec-ioschedulingclass-none.service b/test/test-execute/exec-ioschedulingclass-none.service
8d86bd
index b6af122a1e..8f917d345d 100644
8d86bd
--- a/test/test-execute/exec-ioschedulingclass-none.service
8d86bd
+++ b/test/test-execute/exec-ioschedulingclass-none.service
8d86bd
@@ -2,6 +2,7 @@
8d86bd
 Description=Test for IOSchedulingClass=none
8d86bd
 
8d86bd
 [Service]
8d86bd
-ExecStart=/bin/sh -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "none"'
8d86bd
+# Old kernels might report "none" here, new kernels "best-effort".
8d86bd
+ExecStart=/bin/sh -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "none" -o "$${c%%:*}" = "best-effort"'
8d86bd
 Type=oneshot
8d86bd
 IOSchedulingClass=none