syscalls/ioprio: Add test cases for I/O priority
PATCH v5 1/1 syscalls/ioprio: Add test cases for I/O priority
The ioprio_get/ioprio_set syscalls are used primarily by the userspace tool "ionice" to set priority of a process, user or process group toward the I/O (block layer) scheduler.
This adds a simple iprio_get test and two more verbose tests for ioprio_set.
---
ChangeLog v4->v5:
- Drop unnecessary MOD % operation around increades/decreased prio levels, as these are already tested to be valid.
- Fix up erroneous comment in the header of ioprio_set02.c
- Explain why we first set priority 4 before testing the illegal priority 8 in ioprio_set03.c with a verbose comment.
ChangeLog v3->v4:
- Rename syscall wrappers ioprio_get() and ioprio_set() to sys_ioprio_get() and sys_ioprio_set() to match the glibc convention.
- Issue tst_brk(TBROK ... if we can't even get the inital priority in the first prio set test.
- Add a define for the number of priorities and use arithmetic MOD to wrap priorities around from what they are at test start. Also use this define in prio test loops.
- Also report failed priority level in IDLE scheduling class priority test.
- Use TPASS|TTERRNO to print successful failure with the right error numbers on negative tests.
- Use TINFO on prints that more serve as information than as result of any test.
ChangeLog v2->v3:
- Add testcases to runtest/syscalls
- Add an info blurb to each test file
- Move syscall wrappers into ioprio.h
- Add helper to check that class is in range and use that consistently in the test cases
- Check the new priorities for validity when we bump the prio +1 and -2.
- Factor prio/class check function into the header as well and use the same in both setting tests
- Don't get the current prio before looping over all 8 prios in ioprio_set02
- Break out the negative tests from ioprio_set02 to ioprio_set03
- Also check that the negative tests return EINVAL
- Diet down includes
- Use tst_syscall()
- Drop .min_kver since we use tst_syscall() to determine if the syscall is there
- Fixed relevant checkpatch warnings, left 80 col warnings as these are non-compulsory
ChangeLog v1->v2:
- Use the new test fixture "tst_test.h"
- Fix up legalese in the Makefile to a simple SPDX tag.
- Test from v2.6.13 when the syscall was introduced
--- runtest/syscalls | 5 + testcases/kernel/syscalls/ioprio/.gitignore | 4 + testcases/kernel/syscalls/ioprio/Makefile | 6 ++ testcases/kernel/syscalls/ioprio/ioprio.h | 94 +++++++++++++++++++ .../kernel/syscalls/ioprio/ioprio_get01.c | 47 ++++++++++ .../kernel/syscalls/ioprio/ioprio_set01.c | 63 +++++++++++++ .../kernel/syscalls/ioprio/ioprio_set02.c | 67 +++++++++++++ .../kernel/syscalls/ioprio/ioprio_set03.c | 61 ++++++++++++ 8 files changed, 347 insertions(+) create mode 100644 testcases/kernel/syscalls/ioprio/.gitignore create mode 100644 testcases/kernel/syscalls/ioprio/Makefile create mode 100644 testcases/kernel/syscalls/ioprio/ioprio.h create mode 100644 testcases/kernel/syscalls/ioprio/ioprio_get01.c create mode 100644 testcases/kernel/syscalls/ioprio/ioprio_set01.c create mode 100644 testcases/kernel/syscalls/ioprio/ioprio_set02.c create mode 100644 testcases/kernel/syscalls/ioprio/ioprio_set03.c
runtest/syscalls +5 -0
@@ -542,6 +542,11 @@ ioperm02 ioperm02 iopl01 iopl01 iopl02 iopl02 +ioprio_get01 ioprio_get01 +ioprio_set01 ioprio_set01 +ioprio_set02 ioprio_set02 +ioprio_set03 ioprio_set03 + io_cancel01 io_cancel01 io_destroy01 io_destroy01 io_getevents01 io_getevents01
testcases/kernel/syscalls/ioprio/.gitignore new file +4 -0
@@ -0,0 +1,4 @@ +ioprio_get01 +ioprio_set01 +ioprio_set02 +ioprio_set03
testcases/kernel/syscalls/ioprio/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ioprio/ioprio.h new file +94 -0
94 lines not on this page · raw message
testcases/kernel/syscalls/ioprio/ioprio_get01.c new file +47 -0
47 lines not on this page · raw message
testcases/kernel/syscalls/ioprio/ioprio_set01.c new file +63 -0
63 lines not on this page · raw message
testcases/kernel/syscalls/ioprio/ioprio_set02.c new file +67 -0
67 lines not on this page · raw message
testcases/kernel/syscalls/ioprio/ioprio_set03.c new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v5 1/1 syscalls/ioprio: Add test cases for I/O priority
Hi!
Pushed with a minor change, thanks.
Quoted 6 lines
testcases/kernel/syscalls/ioprio/ioprio_set02.c new file +0
-0
testcases/kernel/syscalls/ioprio/ioprio_set02.c line 10
Quoted 10 lines
testcases/kernel/syscalls/ioprio/ioprio_set02.c new file +10
-0@@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2019 Linus Walleij <[email protected]> +* +* Description: +* Extended ioprio_set() test. +* Tests to set all 8 priority levels for best effort priority, then +* switches to test all 8 priority levels for idle priority. Also test +* some non-working priorities to make sure they don't work. +*/
I've removed the "Also test some non-working..." sentence here since we moved these tests into ioprio_set03.c.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v5 1/1 syscalls/ioprio: Add test cases for I/O priority
Quoted 1 line · Cyril Hrubis
Pushed with a minor change, thanks.
Thanks a lot Cyril! :)
It's my first LTP test so I hope I get better at writing them over time.
Yours,
Linus Walleij