Skip to contentSkip to conversation

selftests: sched: Add more core schedule prctl calls

PATCH In review Ivan Orlov 2 participants 2 messages Mar 27, 2023 – Mar 28, 2023 Kselftest

lore
Share & tools
lore

Ivan Orlov

author
#0 lore raw

PATCH v2 1/1 selftests: sched: Add more core schedule prctl calls

The core sched kselftest makes prctl calls only with correct parameters. This patch will extend this test with more core schedule prctl calls with wrong parameters to increase code coverage.

---
V1 -> V2: Unnecessary printing removed - 'validate' will automatically print the message in case or error

 tools/testing/selftests/sched/cs_prctl_test.c | 6 ++++++
 1 file changed, 6 insertions(+)
tools/testing/selftests/sched/cs_prctl_test.c +6 -0
index 25e0d95d3713..3e1619b6bf2d 100644
@@ -334,6 +334,12 @@ int main(int argc, char *argv[])
 	validate(get_cs_cookie(pid) != 0);
 	validate(get_cs_cookie(pid) == get_cs_cookie(procs[pidx].thr_tids[0]));
 
+	validate(_prctl(PR_SCHED_CORE, PR_SCHED_CORE_MAX, 0, PIDTYPE_PGID, 0) < 0
+		&& errno == EINVAL);
+
+	validate(_prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_TO, 0, PIDTYPE_PGID, 1) < 0
+		&& errno == EINVAL);
+
 	if (errors) {
 		printf("TESTS FAILED. errors: %d\n", errors);
 		res = 10;
Signature · 6 lines
2.34.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
maintainer
#1 lore raw
Quoted 10 lines · Ivan Orlov

The core sched kselftest makes prctl calls only with correct parameters. This patch will extend this test with more core schedule prctl calls with wrong parameters to increase code coverage.

---
V1 -> V2: Unnecessary printing removed - 'validate' will automatically print the message in case or error

Thank you. Now applied to linux-kselftest next for Linux 6.4-rc1.

thanks,
-- Shuah

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees