All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno
@ 2021-08-06 16:47 Alexey Kodanev
  2021-08-06 16:47 ` [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers Alexey Kodanev
                   ` (16 more replies)
  0 siblings, 17 replies; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

The patch-set adds new libc/sys_sched_* wrappers to test libc
and syscall variants of sched_*() functions seperately.

This is needed because musl libc returns ENOSYS for those
functions [1], and the tests just fails with it.

[1]: https://git.musl-libc.org/cgit/musl/commit/?id=1e21e78bf7a5

v2: Using test variants

Alexey Kodanev (16):
  lib/tst_sched: add ltp sys/libc_sched_*() wrappers
  syscalls/sched_getparam01: use libc/sys_sched_*()
  syscalls/sched_getparam03: use libc/sys_sched_*()
  syscalls/sched_setparam01: convert to new API
  syscalls/sched_setparam02: convert to new API
  syscalls/sched_setparam03: convert to new API
  syscalls/sched_setparam04: convert to new API
  syscalls/sched_setparam05: convert to new API
  syscalls/sched_rr_get_interval01: use sys_sched_*()
  syscalls/sched_rr_get_interval02: use sys_sched_*()
  syscalls/sched_rr_get_interval03: use sys_sched_*()
  syscalls/sched_setscheduler01: convert to new API
  syscalls/sched_setscheduler02: convert to new API
  syscalls/sched_setscheduler03: use libc/sys_sched_*()
  syscalls/sched_getscheduler01: convert to new API
  syscalls/sched_getscheduler02: convert to new API

 include/tst_sched.h                           |  70 ++++++
 .../sched_getparam/sched_getparam01.c         |  17 +-
 .../sched_getparam/sched_getparam03.c         |  13 +-
 .../sched_getscheduler/sched_getscheduler01.c | 154 ++++--------
 .../sched_getscheduler/sched_getscheduler02.c | 109 ++------
 .../sched_rr_get_interval01.c                 |   4 +-
 .../sched_rr_get_interval02.c                 |   4 +-
 .../sched_rr_get_interval03.c                 |   4 +-
 .../sched_setparam/sched_setparam01.c         | 140 ++---------
 .../sched_setparam/sched_setparam02.c         | 207 ++++-----------
 .../sched_setparam/sched_setparam03.c         | 235 +++++-------------
 .../sched_setparam/sched_setparam04.c         | 167 +++----------
 .../sched_setparam/sched_setparam05.c         | 192 +++-----------
 .../sched_setscheduler/sched_setscheduler01.c | 180 ++++----------
 .../sched_setscheduler/sched_setscheduler02.c | 165 ++++--------
 .../sched_setscheduler/sched_setscheduler03.c |  39 +--
 16 files changed, 504 insertions(+), 1196 deletions(-)
 create mode 100644 include/tst_sched.h

-- 
2.25.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09  7:55   ` Li Wang
  2021-08-09  9:53   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 02/16] syscalls/sched_getparam01: use libc/sys_sched_*() Alexey Kodanev
                   ` (15 subsequent siblings)
  16 siblings, 2 replies; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

The new wrappers allow to test libc and syscall variants. This is needed
because libc implementation can differ from calling syscall directly.
For example, musl libc implementation returns ENOSYS for some sched_*()
functions due to commit 1e21e78bf7a5 ("add support for thread scheduling
(POSIX TPS option)").

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 include/tst_sched.h | 70 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 include/tst_sched.h

diff --git a/include/tst_sched.h b/include/tst_sched.h
new file mode 100644
index 000000000..a5dc767b3
--- /dev/null
+++ b/include/tst_sched.h
@@ -0,0 +1,70 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
+ */
+
+#ifndef TST_SCHED_H_
+#define TST_SCHED_H_
+
+#include <sched.h>
+
+#include "lapi/syscalls.h"
+
+struct sched_variants {
+	char *desc;
+
+	int (*sched_setparam)(pid_t pid, const struct sched_param *param);
+	int (*sched_getparam)(pid_t pid, struct sched_param *param);
+	int (*sched_setscheduler)(pid_t pid, int policy, const struct sched_param *param);
+	int (*sched_getscheduler)(pid_t pid);
+};
+
+#define _TST_LIBC_SCHED_SCALL(SCALL, ...)({ \
+	int tst_ret = SCALL(__VA_ARGS__); \
+	if (tst_ret == -1 && errno == ENOSYS) { \
+		tst_brk(TCONF, #SCALL " not supported"); \
+	} \
+	tst_ret; \
+})
+
+static inline int sys_sched_setparam(pid_t pid, const struct sched_param *param)
+{
+	return tst_syscall(__NR_sched_setparam, pid, param);
+}
+
+static inline int sys_sched_getparam(pid_t pid, struct sched_param *param)
+{
+	return tst_syscall(__NR_sched_getparam, pid, param);
+}
+
+static inline int sys_sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)
+{
+	return tst_syscall(__NR_sched_setscheduler, pid, policy, param);
+}
+
+static inline int sys_sched_getscheduler(pid_t pid)
+{
+	return tst_syscall(__NR_sched_getscheduler, pid);
+}
+
+static inline int libc_sched_setparam(pid_t pid, const struct sched_param *param)
+{
+	return _TST_LIBC_SCHED_SCALL(sched_setparam, pid, param);
+}
+
+static inline int libc_sched_getparam(pid_t pid, struct sched_param *param)
+{
+	return _TST_LIBC_SCHED_SCALL(sched_getparam, pid, param);
+}
+
+static inline int libc_sched_setscheduler(pid_t pid, int policy, const struct sched_param *param)
+{
+	return _TST_LIBC_SCHED_SCALL(sched_setscheduler, pid, policy, param);
+}
+
+static inline int libc_sched_getscheduler(pid_t pid)
+{
+	return _TST_LIBC_SCHED_SCALL(sched_getscheduler, pid);
+}
+
+#endif /* TST_SCHED_H_ */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 02/16] syscalls/sched_getparam01: use libc/sys_sched_*()
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
  2021-08-06 16:47 ` [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 10:02   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 03/16] syscalls/sched_getparam03: " Alexey Kodanev
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../syscalls/sched_getparam/sched_getparam01.c  | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c b/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c
index efb697707..46cf946a5 100644
--- a/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c
+++ b/testcases/kernel/syscalls/sched_getparam/sched_getparam01.c
@@ -21,22 +21,28 @@
 #include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <sched.h>
 #include "tst_test.h"
+#include "tst_sched.h"
+
+static struct sched_variants variants[] = {
+	{ .sched_getparam = libc_sched_getparam, .desc = "libc" },
+	{ .sched_getparam = sys_sched_getparam, .desc = "syscall" },
+};
 
 static pid_t pids[2] = {0, 0};
 
 static void verify_sched_getparam(unsigned int n)
 {
 	pid_t child_pid;
+	struct sched_variants *tv = &variants[tst_variant];
 	struct sched_param param = {
 		.sched_priority = 100,
 	};
 
 	child_pid = SAFE_FORK();
 	if (!child_pid) {
-		TST_EXP_PASS_SILENT(sched_getparam(pids[n], &param),
-				    "sched_getparam(%d)", pids[n]);
+		TST_EXP_PASS_SILENT(tv->sched_getparam(pids[n], &param),
+				   "sched_getparam(%d)", pids[n]);
 		if (!TST_PASS)
 			exit(0);
 
@@ -59,12 +65,17 @@ static void verify_sched_getparam(unsigned int n)
 
 static void setup(void)
 {
+	struct sched_variants *tv = &variants[tst_variant];
+
+	tst_res(TINFO, "Testing %s variant", tv->desc);
+
 	pids[1] = getpid();
 }
 
 static struct tst_test test = {
 	.forks_child = 1,
 	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
 	.tcnt = ARRAY_SIZE(pids),
 	.test = verify_sched_getparam,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 03/16] syscalls/sched_getparam03: use libc/sys_sched_*()
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
  2021-08-06 16:47 ` [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers Alexey Kodanev
  2021-08-06 16:47 ` [LTP] [PATCH v2 02/16] syscalls/sched_getparam01: use libc/sys_sched_*() Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 10:03   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 04/16] syscalls/sched_setparam01: convert to new API Alexey Kodanev
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../syscalls/sched_getparam/sched_getparam03.c      | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c b/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c
index 19ecaf147..3cbfae149 100644
--- a/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c
+++ b/testcases/kernel/syscalls/sched_getparam/sched_getparam03.c
@@ -17,14 +17,19 @@
  */
 
 #include <errno.h>
-#include <sched.h>
 #include "tst_test.h"
+#include "tst_sched.h"
 
 static struct sched_param param;
 static pid_t unused_pid;
 static pid_t zero_pid;
 static pid_t inval_pid = -1;
 
+static struct sched_variants variants[] = {
+	{ .sched_getparam = libc_sched_getparam, .desc = "libc"},
+	{ .sched_getparam = sys_sched_getparam, .desc = "syscall"},
+};
+
 static struct test_case_t {
 	char *desc;
 	pid_t *pid;
@@ -42,17 +47,21 @@ static struct test_case_t {
 static void verify_sched_getparam(unsigned int n)
 {
 	struct test_case_t *tc = &test_cases[n];
+	struct sched_variants *tv = &variants[tst_variant];
 
-	TST_EXP_FAIL(sched_getparam(*(tc->pid), tc->p), tc->exp_errno, "%s", tc->desc);
+	TST_EXP_FAIL(tv->sched_getparam(*(tc->pid), tc->p), tc->exp_errno,
+		     "%s", tc->desc);
 }
 
 static void setup(void)
 {
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 	unused_pid = tst_get_unused_pid();
 }
 
 static struct tst_test test = {
 	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
 	.tcnt = ARRAY_SIZE(test_cases),
 	.test = verify_sched_getparam,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 04/16] syscalls/sched_setparam01: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (2 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 03/16] syscalls/sched_getparam03: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 10:05   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 05/16] syscalls/sched_setparam02: " Alexey Kodanev
                   ` (12 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setparam/sched_setparam01.c         | 140 ++++--------------
 1 file changed, 27 insertions(+), 113 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c
index a2272eb18..f8519c062 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam01.c
@@ -1,128 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: sched_setparam01
- *
- *    EXECUTED BY	: anyone
- *
- *    TEST TITLE	: Basic test for sched_setparam(2)
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This is a Phase I test for the sched_setparam(2) system call.
- *	It is intended to provide a limited exposure of the system call.
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  Execute system call
- *	  Check return code, if system call failed (return=-1)
- *		Log the errno and Issue a FAIL message.
- *	  Otherwise, Issue a PASS message.
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
+
+/*\
+ * [Description]
  *
- * USAGE:  <for command-line>
- *  sched_setparam01 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
+ * Basic test for sched_setparam(2)
  *
- ****************************************************************/
-
-#include <errno.h>
-#include <sched.h>
-#include "test.h"
-
-static void setup();
-static void cleanup();
+ * Call sched_setparam(2) with pid=0 so that it will
+ * set the scheduling parameters for the calling process
+ */
 
-char *TCID = "sched_setparam01";
-int TST_TOTAL = 1;
+#include "tst_test.h"
+#include "tst_sched.h"
 
-static struct sched_param param;
+static struct sched_variants variants[] = {
+	{ .sched_setparam = libc_sched_setparam, .desc = "libc" },
+	{ .sched_setparam = sys_sched_setparam, .desc = "syscall" },
+};
 
-int main(int ac, char **av)
+static void run(void)
 {
+	struct sched_variants *tv = &variants[tst_variant];
+	struct sched_param p = { .sched_priority = 0 };
 
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		/*
-		 * Call sched_setparam(2) with pid=0 sothat it will
-		 * set the scheduling parameters for the calling process
-		 */
-		TEST(sched_setparam(0, &param));
-
-		if (TEST_RETURN == 0) {
-			tst_resm(TPASS, "sched_setparam() returned %ld",
-				 TEST_RETURN);
-		} else {
-			tst_resm(TFAIL | TTERRNO,
-				 "Test Failed, sched_setparam()" "returned %ld",
-				 TEST_RETURN);
-		}
-	}
-
-	cleanup();
-	tst_exit();
+	TST_EXP_PASS(tv->sched_setparam(0, &p), "sched_setparam(0, 0)");
 }
 
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
+static void setup(void)
 {
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	param.sched_priority = 0;
-
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 }
 
-/*
- *cleanup() -  performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-}
+static struct tst_test test = {
+	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
+	.test_all = run,
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 05/16] syscalls/sched_setparam02: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (3 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 04/16] syscalls/sched_setparam01: convert to new API Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 11:19   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 06/16] syscalls/sched_setparam03: " Alexey Kodanev
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setparam/sched_setparam02.c         | 207 +++++-------------
 1 file changed, 52 insertions(+), 155 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c
index 132cc9d6c..7ee6d393a 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam02.c
@@ -1,184 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: sched_setparam02
- *
- *    EXECUTED BY	: root / superuser
- *
- *    TEST TITLE	: Checks functionality for sched_setparam(2)
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This test changes the scheduling priority for current process
- *	and verifies it by calling sched_getparam().
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *	  Change scheduling policy to SCHED_FIFO
- *
- * 	Test:
- *	 Loop if the proper options are given.
- * 	  Execute system call
- *	  If scheduling priority is set properly,
- *		TEST passed
- *	  else
- *		TEST failed
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
+
+/*\
+ * [Description]
  *
- * USAGE:  <for command-line>
- *  sched_setparam02 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
+ * Checks functionality for sched_setparam(2)
  *
- ****************************************************************/
+ * This test changes the scheduling priority for current process
+ * and verifies it by calling sched_getparam().
+ */
 
-#include <errno.h>
-#include <sched.h>
-#include "test.h"
+#include "tst_test.h"
+#include "tst_sched.h"
 
 #define FIFO_OR_RR_PRIO 5
 #define OTHER_PRIO 0
 
-static void setup();
-static void cleanup();
-static int verify_priority(int);
-
-char *TCID = "sched_setparam02";
-
-static struct sched_param param;
-static struct sched_param param1 = { 1 };
+static struct sched_variants variants[] = {
+	{ .sched_setparam = libc_sched_setparam,
+	  .sched_getparam = libc_sched_getparam,
+	  .sched_setscheduler = libc_sched_setscheduler,
+	  .desc = "libc"
+	},
+	{ .sched_setparam = sys_sched_setparam,
+	  .sched_getparam = sys_sched_getparam,
+	  .sched_setscheduler = sys_sched_setscheduler,
+	  .desc = "syscall"
+	},
+};
 
 static struct test_cases_t {
 	char *desc;
 	int policy;
 	int priority;
-} testcases[] = {
+	int param;
+} tcases[] = {
 	{
-	"Test with policy SCHED_FIFO", SCHED_FIFO, FIFO_OR_RR_PRIO}, {
-	"Test with policy SCHED_RR", SCHED_RR, FIFO_OR_RR_PRIO}, {
-	"Test with SCHED_OTHER", SCHED_OTHER, OTHER_PRIO}
+	"Test with policy SCHED_FIFO", SCHED_FIFO, FIFO_OR_RR_PRIO, 1}, {
+	"Test with policy SCHED_RR", SCHED_RR, FIFO_OR_RR_PRIO, 1}, {
+	"Test with SCHED_OTHER", SCHED_OTHER, OTHER_PRIO, 0}
 };
 
-int TST_TOTAL = sizeof(testcases) / sizeof(testcases[0]);
-
-int main(int ac, char **av)
+static void run(unsigned int n)
 {
+	struct test_cases_t *tc = &tcases[n];
+	struct sched_variants *tv = &variants[tst_variant];
+	struct sched_param p = { .sched_priority = tc->param };
 
-	int lc, i;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
+	TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, tc->policy, &p));
 
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
+	p.sched_priority = tc->priority;
+	TST_EXP_PASS_SILENT(tv->sched_setparam(0, &p));
 
-		tst_count = 0;
+	p.sched_priority = -1;
+	TST_EXP_PASS_SILENT(tv->sched_getparam(0, &p));
 
-		for (i = 0; i < TST_TOTAL; ++i) {
-
-			if (i == 2) {
-				param1.sched_priority = 0;
-			} else {
-				param1.sched_priority = 1;
-			}
-			if ((sched_setscheduler(0, testcases[i].policy,
-						&param1)) == -1) {
-				tst_brkm(TBROK, cleanup, "sched_setscheduler()"
-					 "  failed");
-			}
-			param.sched_priority = testcases[i].priority;
-			/*
-			 * Call sched_setparam(2) with pid=0 sothat it will
-			 * set the scheduling parameters for the calling process
-			 */
-			TEST(sched_setparam(0, &param));
-
-			if ((TEST_RETURN == 0) && (verify_priority(i))) {
-				tst_resm(TPASS, "%s Passed", testcases[i].desc);
-			} else {
-				tst_resm(TFAIL | TTERRNO,
-					 "%s Failed. sched_setparam()"
-					 " returned %ld", testcases[i].desc,
-					 TEST_RETURN);
-			}
-		}
+	if (p.sched_priority == tc->priority) {
+		tst_res(TPASS, "got expected priority %d", p.sched_priority);
+	} else {
+		tst_res(TFAIL, "unexpected priority value %d, expected %d",
+			p.sched_priority, tc->priority);
 	}
-
-	/* cleanup and exit */
-	cleanup();
-
-	tst_exit();
-
 }
 
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
+static void setup(void)
 {
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 }
 
-/*
- *cleanup() -  performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-}
-
-/*
- * verify_priority() -  This function checks whether the priority is
- *			set correctly
- */
-int verify_priority(int i)
-{
-	struct sched_param p;
-
-	if ((sched_getparam(0, &p)) == 0) {
-		if (p.sched_priority == testcases[i].priority) {
-			return 1;
-		} else {
-			tst_resm(TWARN, "sched_getparam() returned priority"
-				 " value as %d", p.sched_priority);
-			return 0;
-		}
-	}
-
-	tst_resm(TWARN, "sched_getparam() failed");
-	return 0;
-}
+static struct tst_test test = {
+	.needs_root = 1,
+	.setup = setup,
+	.test = run,
+	.test_variants = ARRAY_SIZE(variants),
+	.tcnt = ARRAY_SIZE(tcases),
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 06/16] syscalls/sched_setparam03: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (4 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 05/16] syscalls/sched_setparam02: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 11:28   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 07/16] syscalls/sched_setparam04: " Alexey Kodanev
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setparam/sched_setparam03.c         | 235 +++++-------------
 1 file changed, 58 insertions(+), 177 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
index 252364e2e..8c8d1e8d5 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam03.c
@@ -1,196 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: sched_setparam03
- *
- *    EXECUTED BY	: root / superuser
- *
- *    TEST TITLE	: Checks functionality for sched_setparam(2) for pid!=0
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	This test forks a child & changes its parent's scheduling priority
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *	  Change scheduling policy to SCHED_FIFO
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 Fork a child
- *
- *	 CHILD:
- *	  Changes scheduling priority for parent
- *
- *	 PARENT:
- *	  If scheduling priority is set properly,
- *		TEST passed
- *	  else
- *		TEST failed
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
+
+/*\
+ * [Description]
  *
- * USAGE:  <for command-line>
- *  sched_setparam03 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
+ * Checks functionality for sched_setparam(2) for pid != 0
  *
- ****************************************************************/
-
-#include <err.h>
-#include <errno.h>
-#include <sched.h>
-#include <sys/wait.h>
-#include "test.h"
-
-#define NEW_PRIORITY 5
-
-static void setup();
-static void cleanup();
-static int verify_priority();
-
-char *TCID = "sched_setparam03";
-int TST_TOTAL = 1;
-
-static struct sched_param param = { NEW_PRIORITY };
+ * This test forks a child and changes its parent's scheduling priority.
+ */
 
-int main(int ac, char **av)
+#include <stdlib.h>
+
+#include "tst_test.h"
+#include "tst_sched.h"
+
+static struct sched_variants variants[] = {
+	{ .sched_setparam = libc_sched_setparam,
+	  .sched_getparam = libc_sched_getparam,
+	  .sched_setscheduler = libc_sched_setscheduler,
+	  .desc = "libc"
+	},
+	{ .sched_setparam = sys_sched_setparam,
+	  .sched_getparam = sys_sched_getparam,
+	  .sched_setscheduler = sys_sched_setscheduler,
+	  .desc = "syscall"
+	},
+};
+
+static void run(void)
 {
-
-	int lc;
-	int status;
+	struct sched_variants *tv = &variants[tst_variant];
+	struct sched_param p5 = { .sched_priority = 5 };
+	struct sched_param p;
 	pid_t child_pid;
 
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
+	child_pid = SAFE_FORK();
 
-		tst_count = 0;
-
-		switch (child_pid = FORK_OR_VFORK()) {
-
-		case -1:
-			/* fork() failed */
-			tst_resm(TFAIL, "fork() failed");
-			continue;
-
-		case 0:
-			/* Child */
-
-			/*
-			 * Call sched_setparam(2) with pid = getppid() so that
-			 * it will set the scheduling parameters for parent
-			 * process
-			 */
-			TEST(sched_setparam(getppid(), &param));
-
-			if (TEST_RETURN == -1) {
-				err(0, "sched_setparam returned %ld",
-				    TEST_RETURN);
-			}
-			exit(1);
-
-		default:
-			/* Parent */
-			if ((waitpid(child_pid, &status, 0)) < 0) {
-				tst_resm(TFAIL, "wait() failed");
-				continue;
-			}
-
-			/*
-			 * Verify that parent's scheduling priority has
-			 * changed.
-			 */
-			if ((WIFEXITED(status)) && (WEXITSTATUS(status)) &&
-			    (verify_priority())) {
-				tst_resm(TPASS, "Test Passed");
-			} else {
-				tst_resm(TFAIL, "Test Failed");
-			}
-		}
+	if (!child_pid) {
+		/*
+		 * Call sched_setparam(2) with pid = getppid() so that
+		 * it will set the scheduling parameters for parent
+		 * process
+		 */
+		TST_EXP_PASS_SILENT(tv->sched_setparam(getppid(), &p5));
+		exit(0);
 	}
+	tst_reap_children();
 
-	cleanup();
-	tst_exit();
+	TST_EXP_PASS_SILENT(tv->sched_getparam(0, &p));
+
+	if (p.sched_priority == p5.sched_priority)
+		tst_res(TPASS, "got expected priority %d", p.sched_priority);
+	else
+		tst_res(TFAIL, "got priority %d, expected 5", p.sched_priority);
 }
 
-/* setup() - performs all ONE TIME setup for this test */
 void setup(void)
 {
-	struct sched_param p = { 1 };
-
-	tst_require_root();
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
-	/* Change scheduling policy to SCHED_FIFO */
-	if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1) {
-		tst_brkm(TBROK, cleanup, "sched_setscheduler() failed");
-	}
+	struct sched_variants *tv = &variants[tst_variant];
+	struct sched_param p = { .sched_priority = 1 };
 
+	tst_res(TINFO, "Testing %s variant", tv->desc);
+	TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, SCHED_FIFO, &p));
 }
 
-/*
- *cleanup() -   performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-}
-
-/*
- * verify_priority() -  This function checks whether the priority is
- *			set correctly
- */
-int verify_priority(void)
-{
-	struct sched_param p;
-
-	if ((sched_getparam(0, &p)) == 0) {
-		if (p.sched_priority == NEW_PRIORITY) {
-			return 1;
-		} else {
-			tst_resm(TWARN, "sched_getparam() returned priority"
-				 " value as %d", p.sched_priority);
-			return 0;
-		}
-	}
-
-	tst_resm(TWARN, "sched_getparam() failed");
-	return 0;
-}
+static struct tst_test test = {
+	.forks_child = 1,
+	.needs_root = 1,
+	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
+	.test_all = run,
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 07/16] syscalls/sched_setparam04: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (5 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 06/16] syscalls/sched_setparam03: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 11:31   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 08/16] syscalls/sched_setparam05: " Alexey Kodanev
                   ` (9 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setparam/sched_setparam04.c         | 167 ++++--------------
 1 file changed, 36 insertions(+), 131 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c
index f6e017d3d..1c00f5eb6 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam04.c
@@ -1,34 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
- /*******************************************************************
- *
- *    TEST IDENTIFIER   : sched_setparam04
- *
- *    EXECUTED BY       : anyone
- *
- *    TEST TITLE        : testing error conditions for sched_setparam(2)
- *
- *    TEST CASE TOTAL   : 4
- *
- *    AUTHOR            : Saji Kumar.V.R <saji.kumar@wipro.com>
+
+/*\
+ * [Description]
  *
- *    SIGNALS
- *      Uses SIGUSR1 to pause before test if option set.
- *      (See the parse_opts(3) man page).
+ * Testing error conditions for sched_setparam(2)
  *
  * DESCRIPTION
  * 	Verify that,
@@ -41,129 +21,54 @@
  *   4) sched_setparam(2) returns -1 sets errno to EINVAL if the
  *	value for p.sched_priority is other than 0 for scheduling
  *	policy, SCHED_OTHER
- *
- * ALGORITHM
- * Setup:
- *   Setup signal handling.
- *   Pause for SIGUSR1 if option specified.
- *
- *  Test:
- *   Loop if the proper options are given.
- *   Execute system call
- *   Check return code, if (system call failed (return=-1)) &
- *			   (errno set == expected errno)
- *              Issue sys call fails with expected return value and errno.
- *   Otherwise,
- *      Issue sys call returns unexpected value.
- *
- *  Cleanup:
- *        Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  sched_setparam04 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *		where,  -c n : Run n copies concurrently.
- *			-e   : Turn on errno logging.
- *			-h   : Show help screen
- *			-f   : Turn off functional testing
- *			-i n : Execute test n times.
- *			-I x : Execute test for x seconds.
- *			-p   : Pause for SIGUSR1 before starting
- *			-P x : Pause for x seconds between iterations.
- *			-t   : Turn on syscall timing.
- *
- *********************************************************************/
-
-#include <errno.h>
-#include <sched.h>
-#include <pwd.h>
-#include "test.h"
-
-static void cleanup(void);
-static void setup(void);
+ */
 
-static struct sched_param param = { 0 };
-static struct sched_param param1 = { 1 };
+#include "tst_test.h"
+#include "tst_sched.h"
 
-char *TCID = "sched_setparam04";
+static struct sched_param p = { .sched_priority = 0 };
+static struct sched_param p1 = { .sched_priority = 1 };
 
 static pid_t unused_pid;
 static pid_t inval_pid = -1;
 static pid_t zero_pid;
 
-static struct test_case_t {
+static struct sched_variants variants[] = {
+	{ .sched_setparam = libc_sched_setparam, .desc = "libc" },
+	{ .sched_setparam = sys_sched_setparam,  .desc = "syscall" },
+};
+
+static struct test_cases_t {
 	char *desc;
 	pid_t *pid;
 	struct sched_param *p;
 	int exp_errno;
-	char err_desc[10];
-} test_cases[] = {
+} tcases[] = {
 	{
-	"test with non-existing pid", &unused_pid, &param, ESRCH, "ESRCH"}, {
-	"test invalid pid value", &inval_pid, &param, EINVAL, "EINVAL"}, {
-	"test with invalid address for p", &zero_pid, NULL, EINVAL, "EINVAL"}, {
-	"test with invalid p.sched_priority", &zero_pid, &param1, EINVAL,
-		    "EINVAL"}
+	"test with non-existing pid", &unused_pid, &p, ESRCH}, {
+	"test invalid pid value", &inval_pid, &p, EINVAL,}, {
+	"test with invalid address for p", &zero_pid, NULL, EINVAL}, {
+	"test with invalid p.sched_priority", &zero_pid, &p1, EINVAL}
 };
 
-int TST_TOTAL = sizeof(test_cases) / sizeof(test_cases[0]);
-
-int main(int ac, char **av)
+static void setup(void)
 {
-	int lc, ind;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();		/* global setup */
-
-	/* The following loop checks looping state if -i option given */
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 
-		for (ind = 0; ind < TST_TOTAL; ind++) {
-			/*
-			 * call the system call with the TEST() macro
-			 */
-			TEST(sched_setparam(*(test_cases[ind].pid),
-					    test_cases[ind].p));
-
-			if ((TEST_RETURN == -1) &&
-			    (TEST_ERRNO == test_cases[ind].exp_errno)) {
-				tst_resm(TPASS, "expected failure; Got %s",
-					 test_cases[ind].err_desc);
-			} else {
-				tst_resm(TFAIL, "Call failed to produce "
-					 "expected error;  Expected errno: %d "
-					 "Got : %d, %s",
-					 test_cases[ind].exp_errno,
-					 TEST_ERRNO, strerror(TEST_ERRNO));
-			}
-		}
-	}
-
-	cleanup();
-
-	tst_exit();
+	unused_pid = tst_get_unused_pid();
 }
 
-/*
- * setup() - performs all the ONE TIME setup for this test.
- */
-void setup(void)
+static void run(unsigned int n)
 {
-	unused_pid = tst_get_unused_pid(cleanup);
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
+	struct sched_variants *tv = &variants[tst_variant];
+	struct test_cases_t *tc = &tcases[n];
 
+	TST_EXP_FAIL(tv->sched_setparam(*tc->pid, tc->p), tc->exp_errno, "%s", tc->desc);
 }
 
-/*
- * cleanup() -  performs all the ONE TIME cleanup for this test at completion
- *		or premature exit.
- */
-void cleanup(void)
-{
-
-}
+static struct tst_test test = {
+	.setup = setup,
+	.test = run,
+	.test_variants = ARRAY_SIZE(variants),
+	.tcnt = ARRAY_SIZE(tcases),
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 08/16] syscalls/sched_setparam05: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (6 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 07/16] syscalls/sched_setparam04: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 11:34   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 09/16] syscalls/sched_rr_get_interval01: use sys_sched_*() Alexey Kodanev
                   ` (8 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setparam/sched_setparam05.c         | 192 ++++--------------
 1 file changed, 36 insertions(+), 156 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c b/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c
index 53db641d7..c6c9d9bdd 100644
--- a/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c
+++ b/testcases/kernel/syscalls/sched_setparam/sched_setparam05.c
@@ -1,176 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
+ * AUTHOR: Saji Kumar.V.R <saji.kumar@wipro.com>
  */
-/**********************************************************
- *
- *    TEST IDENTIFIER	: sched_setparam05
- *
- *    EXECUTED BY	: root/superuser
- *
- *    TEST TITLE	: verify that sched_setparam() fails if the user does
- *			  not have proper privilages
- *
- *    TEST CASE TOTAL	: 1
- *
- *    AUTHOR		: Saji Kumar.V.R <saji.kumar@wipro.com>
- *
- *    SIGNALS
- * 	Uses SIGUSR1 to pause before test if option set.
- * 	(See the parse_opts(3) man page).
- *
- *    DESCRIPTION
- *	Verify that sched_setparam() fails if the user does
- *	not have proper privilages
- *
- * 	Setup:
- * 	  Setup signal handling.
- *	  Pause for SIGUSR1 if option specified.
- *
- * 	Test:
- *	 Loop if the proper options are given.
- *	 Fork a child
- *
- *	 CHILD:
- *	  Changes euid to "nobody" user.
- *	  Try to Change scheduling priority for parent
- *	  If call failed with errno = EPERM,
- *		Test passed
- *	  else
- *		Test failed
- *
- *	 PARENT:
- *		wait for child to finish
- *
- * 	Cleanup:
- * 	  Print errno log and/or timing stats if options given
- *
- * USAGE:  <for command-line>
- *  sched_setparam05 [-c n] [-e] [-i n] [-I x] [-P x] [-t] [-h] [-f] [-p]
- *			where,  -c n : Run n copies concurrently.
- *				-e   : Turn on errno logging.
- *				-h   : Show help screen
- *				-f   : Turn off functional testing
- *				-i n : Execute test n times.
- *				-I x : Execute test for x seconds.
- *				-p   : Pause for SIGUSR1 before starting
- *				-P x : Pause for x seconds between iterations.
- *				-t   : Turn on syscall timing.
+
+/*\
+ * [Description]
  *
- ****************************************************************/
+ * Verify that sched_setparam() fails if the user does not have proper
+ * privileges.
+ */
 
-#include <errno.h>
-#include <sched.h>
+#include <stdlib.h>
 #include <pwd.h>
-#include <sys/wait.h>
-#include "test.h"
-
-static void setup();
-static void cleanup();
 
-char *TCID = "sched_setparam05";
-int TST_TOTAL = 1;
+#include "tst_test.h"
+#include "tst_sched.h"
 
-static struct sched_param param = { 0 };
+static struct sched_variants variants[] = {
+	{ .sched_setparam = libc_sched_setparam, .desc = "libc" },
+	{ .sched_setparam = sys_sched_setparam,  .desc = "syscall" },
+};
 
-static char nobody_uid[] = "nobody";
-struct passwd *ltpuser;
-
-int main(int ac, char **av)
+static void run(void)
 {
+	struct sched_variants *tv = &variants[tst_variant];
+	pid_t child_pid = SAFE_FORK();
 
-	int lc;
-	int status;
-	pid_t child_pid;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
-
-		switch (child_pid = FORK_OR_VFORK()) {
-
-		case -1:
-			/* fork() failed */
-			tst_resm(TFAIL, "fork() failed");
-			continue;
-
-		case 0:
-			/* Child */
-
-			/* Switch to nobody user */
-			if ((ltpuser = getpwnam(nobody_uid)) == NULL) {
-				tst_brkm(TBROK, NULL, "'%s' user not present", nobody_uid);
-			}
-			if (seteuid(ltpuser->pw_uid) == -1) {
-				tst_resm(TWARN, "seteuid failed to to set the effective uid to %d",
-					 ltpuser->pw_uid);
-				exit(1);
-			}
-
-			/*
-			 * Call sched_setparam(2) with pid = getppid()
-			 */
-			TEST(sched_setparam(getppid(), &param));
+	if (!child_pid) {
+		struct sched_param p = { .sched_priority = 0 };
+		struct passwd *pw = SAFE_GETPWNAM("nobody");
 
-			if ((TEST_RETURN == -1) && (TEST_ERRNO == EPERM)) {
-				exit(0);
-			}
+		SAFE_SETEUID(pw->pw_uid);
+		TST_EXP_FAIL(tv->sched_setparam(getppid(), &p), EPERM,
+			     "sched_setparam(%d, 0)", getppid());
 
-			tst_resm(TWARN | TTERRNO,
-				 "Test failed, sched_setparam()"
-				 " returned : %ld", TEST_RETURN);
-			exit(1);
-
-		default:
-			/* Parent */
-			if ((waitpid(child_pid, &status, 0)) < 0) {
-				tst_resm(TFAIL, "wait() failed");
-				continue;
-			}
-			if ((WIFEXITED(status)) && (WEXITSTATUS(status) == 0)) {
-				tst_resm(TPASS, "Test passed, Got EPERM");
-			} else {
-				tst_resm(TFAIL, "Test Failed");
-			}
-		}
+		exit(0);
 	}
 
-	cleanup();
-	tst_exit();
+	tst_reap_children();
 }
 
-/* setup() - performs all ONE TIME setup for this test */
-void setup(void)
+static void setup(void)
 {
-
-	tst_require_root();
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
-
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 }
 
-/*
- *cleanup() -  performs all ONE TIME cleanup for this test at
- *		completion or premature exit.
- */
-void cleanup(void)
-{
-}
+static struct tst_test test = {
+	.needs_root = 1,
+	.forks_child = 1,
+	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
+	.test_all = run,
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 09/16] syscalls/sched_rr_get_interval01: use sys_sched_*()
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (7 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 08/16] syscalls/sched_setparam05: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 11:35   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 10/16] syscalls/sched_rr_get_interval02: " Alexey Kodanev
                   ` (7 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../syscalls/sched_rr_get_interval/sched_rr_get_interval01.c  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
index 5da5fe51d..447242159 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval01.c
@@ -11,9 +11,9 @@
  * timeslice tuning knob in milliseconds").
  */
 
-#include <sched.h>
 #include "time64_variants.h"
 #include "tst_timer.h"
+#include "tst_sched.h"
 
 #define PROC_SCHED_RR_TIMESLICE_MS	"/proc/sys/kernel/sched_rr_timeslice_ms"
 static int proc_flag;
@@ -41,7 +41,7 @@ static void setup(void)
 
 	tp.type = tv->ts_type;
 
-	if ((sched_setscheduler(0, SCHED_RR, &p)) == -1)
+	if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1)
 		tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
 
 	proc_flag = !access(PROC_SCHED_RR_TIMESLICE_MS, F_OK);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 10/16] syscalls/sched_rr_get_interval02: use sys_sched_*()
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (8 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 09/16] syscalls/sched_rr_get_interval01: use sys_sched_*() Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 11:36   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 11/16] syscalls/sched_rr_get_interval03: " Alexey Kodanev
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../syscalls/sched_rr_get_interval/sched_rr_get_interval02.c  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
index 9a0b8673d..15e4a3053 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval02.c
@@ -8,9 +8,9 @@
  * for tv_sec & tv_nsec.
  */
 
-#include <sched.h>
 #include "time64_variants.h"
 #include "tst_timer.h"
+#include "tst_sched.h"
 
 static struct tst_ts tp;
 
@@ -35,7 +35,7 @@ static void setup(void)
 
 	tp.type = tv->ts_type;
 
-	if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1)
+	if ((sys_sched_setscheduler(0, SCHED_FIFO, &p)) == -1)
 		tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 11/16] syscalls/sched_rr_get_interval03: use sys_sched_*()
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (9 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 10/16] syscalls/sched_rr_get_interval02: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 11:36   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 12/16] syscalls/sched_setscheduler01: convert to new API Alexey Kodanev
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../syscalls/sched_rr_get_interval/sched_rr_get_interval03.c  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
index a61541b8a..f5a88f084 100644
--- a/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
+++ b/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c
@@ -12,9 +12,9 @@
  *     address specified as &tp is invalid
  */
 
-#include <sched.h>
 #include "time64_variants.h"
 #include "tst_timer.h"
+#include "tst_sched.h"
 
 static pid_t unused_pid;
 static pid_t inval_pid = -1;
@@ -55,7 +55,7 @@ static void setup(void)
 	bad_addr = tst_get_bad_addr(NULL);
 	tp.type = tv->ts_type;
 
-	if ((sched_setscheduler(0, SCHED_RR, &p)) == -1)
+	if ((sys_sched_setscheduler(0, SCHED_RR, &p)) == -1)
 		tst_res(TFAIL | TERRNO, "sched_setscheduler() failed");
 
 	unused_pid = tst_get_unused_pid();
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 12/16] syscalls/sched_setscheduler01: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (10 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 11/16] syscalls/sched_rr_get_interval03: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 12:19   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 13/16] syscalls/sched_setscheduler02: " Alexey Kodanev
                   ` (4 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setscheduler/sched_setscheduler01.c | 180 +++++-------------
 1 file changed, 52 insertions(+), 128 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c
index 1cbce15d0..5c81a8899 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c
+++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler01.c
@@ -1,160 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
+ * Copyright (c) International Business Machines  Corp., 2001
  */
 
-/*
- * NAME
- *	sched_setscheduler01.c
+/*\
+ * [Description]
  *
- * DESCRIPTION
- *	Testcase to test whether sched_setscheduler(2) sets the errnos
- *	correctly.
+ * Testcase to test whether sched_setscheduler(2) sets the errnos
+ * correctly.
  *
- * ALGORITHM
- *	1.	Call sched_setscheduler with an invalid pid, and expect
- *	ESRCH to be returned.
- *	2.	Call sched_setscheduler with an invalid scheduling policy,
- *	and expect EINVAL to be returned.
- *	3.	Call sched_setscheduler with an invalid "param" address,
- *	which lies outside the address space of the process, and expect
- *	EFAULT to be returned.
- *	4.	Call sched_setscheduler with an invalid priority value
- *	in "param" and expect EINVAL to be returned
+ * [Algorithm]
  *
- * USAGE:  <for command-line>
- *  sched_setscheduler01 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
- *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	None
+ * 1. Call sched_setscheduler with an invalid pid, and expect
+ * ESRCH to be returned.
+ * 2. Call sched_setscheduler with an invalid scheduling policy,
+ * and expect EINVAL to be returned.
+ * 3. Call sched_setscheduler with an invalid "param" address,
+ * which lies outside the address space of the process, and expect
+ * EFAULT to be returned.
+ * 4.Call sched_setscheduler with an invalid priority value
+ * in "param" and expect EINVAL to be returned
  */
+
 #include <stdio.h>
 #include <errno.h>
-#include <sched.h>
 #include <pwd.h>
-#include "test.h"
 
-#define SCHED_INVALID	99
+#include "tst_test.h"
+#include "tst_sched.h"
 
-char *TCID = "sched_setscheduler01";
-
-struct sched_param param;
-struct sched_param param1 = { 1 };
-
-void setup(void);
-void cleanup(void);
+#define SCHED_INVALID	99
 
+static struct sched_param p;
+static struct sched_param p1 = { .sched_priority = 1 };
 static pid_t unused_pid;
 static pid_t init_pid = 1;
 static pid_t zero_pid;
 
-struct test_case_t {
+static struct sched_variants variants[] = {
+	{ .sched_setscheduler = libc_sched_setscheduler, .desc = "libc" },
+	{ .sched_setscheduler = sys_sched_setscheduler, .desc = "syscall" },
+};
+
+struct test_cases_t {
 	pid_t *pid;
 	int policy;
 	struct sched_param *p;
 	int error;
-} TC[] = {
+} tcases[] = {
 	/* The pid is invalid - ESRCH */
-	{
-	&unused_pid, SCHED_OTHER, &param, ESRCH},
-	    /* The policy is invalid - EINVAL */
-	{
-	&init_pid, SCHED_INVALID, &param, EINVAL},
-#ifndef UCLINUX
-	    /* Skip since uClinux does not implement memory protection */
-	    /* The param address is invalid - EFAULT */
-	{
-	&init_pid, SCHED_OTHER, (struct sched_param *)-1, EFAULT},
-#endif
-	    /* The priority value in param invalid - EINVAL */
-	{
-	&zero_pid, SCHED_OTHER, &param1, EINVAL}
+	{&unused_pid, SCHED_OTHER, &p, ESRCH},
+	/* The policy is invalid - EINVAL */
+	{&init_pid, SCHED_INVALID, &p, EINVAL},
+	/* The param address is invalid - EFAULT */
+	{&init_pid, SCHED_OTHER, (struct sched_param *)-1, EFAULT},
+	/* The priority value in param invalid - EINVAL */
+	{&zero_pid, SCHED_OTHER, &p1, EINVAL}
 };
 
-int TST_TOTAL = ARRAY_SIZE(TC);
-
-int main(int ac, char **av)
+static void setup(void)
 {
-	int lc;
-
-	int i;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		setup();
-
-		/* loop through the test cases */
-		for (i = 0; i < TST_TOTAL; i++) {
-
-			TEST(sched_setscheduler(*(TC[i].pid), TC[i].policy,
-						TC[i].p));
-
-			if (TEST_RETURN != -1) {
-				tst_resm(TFAIL, "call succeeded unexpectedly");
-				continue;
-			}
-
-			if (TEST_ERRNO == TC[i].error) {
-				tst_resm(TPASS, "expected failure - "
-					 "errno = %d : %s", TEST_ERRNO,
-					 strerror(TEST_ERRNO));
-			} else {
-				tst_resm(TFAIL, "unexpected error - %d : %s - "
-					 "expected %d", TEST_ERRNO,
-					 strerror(TEST_ERRNO), TC[i].error);
-			}
-		}
-	}
-	cleanup();
-
-	tst_exit();
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 
+	unused_pid = tst_get_unused_pid();
 }
 
-/*
- * setup() - performs all ONE TIME setup for this test.
- */
-void setup(void)
+static void run(unsigned int n)
 {
-	unused_pid = tst_get_unused_pid(cleanup);
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
+	struct sched_variants *tv = &variants[tst_variant];
+	struct test_cases_t *tc = &tcases[n];
 
-	TEST_PAUSE;
+	TST_EXP_FAIL(tv->sched_setscheduler(*tc->pid, tc->policy, tc->p),
+		     tc->error, "sched_setscheduler(%d, %d, %p)",
+		     *tc->pid, tc->policy, tc->p);
 }
 
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- *	       completion or premature exit.
- */
-void cleanup(void)
-{
-
-}
+static struct tst_test test = {
+	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = run,
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 13/16] syscalls/sched_setscheduler02: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (11 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 12/16] syscalls/sched_setscheduler01: convert to new API Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 12:21   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 14/16] syscalls/sched_setscheduler03: use libc/sys_sched_*() Alexey Kodanev
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setscheduler/sched_setscheduler02.c | 165 +++++-------------
 1 file changed, 44 insertions(+), 121 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c
index 36952d9cb..ddebdac94 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c
+++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler02.c
@@ -1,148 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
+ * Copyright (c) International Business Machines  Corp., 2001
  */
 
-/*
- * NAME
- *	sched_setscheduler01.c
+/*\
+ * [Description]
  *
- * DESCRIPTION
- *	Testcase to test whether sched_setscheduler(2) sets the errnos
- *	correctly.
+ * Testcase to test whether sched_setscheduler(2) sets the errnos
+ * correctly.
  *
- * ALGORITHM
- *	1.	Call sched_setscheduler as a non-root uid, and expect EPERM
- *	to be returned.
+ * [Algorithm]
  *
- * USAGE:  <for command-line>
- *  sched_setscheduler02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
+ * Call sched_setscheduler as a non-root uid, and expect EPERM
+ * to be returned.
  *
- * HISTORY
- *	07/2001 Ported by Wayne Boyer
- *
- * RESTRICTIONS
- *	Must run test as root.
  */
-#include <stdio.h>
+
+#include <stdlib.h>
 #include <errno.h>
-#include <sched.h>
 #include <pwd.h>
 #include <sys/types.h>
-#include <sys/wait.h>
 
-#include "test.h"
-#include "safe_macros.h"
+#include "tst_test.h"
+#include "tst_sched.h"
 
 #define SCHED_INVALID	99
 #define INVALID_PID	999999
 
-char *TCID = "sched_setscheduler02";
-int TST_TOTAL = 1;
-
-void setup(void);
-void cleanup(void);
-
 static uid_t nobody_uid;
 
-int main(int ac, char **av)
-{
-	int lc;
-	pid_t pid;
-	struct sched_param param;
-	int status;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		if ((pid = FORK_OR_VFORK()) == -1) {
-			tst_brkm(TBROK, cleanup, "fork failed");
-		}
-
-		if (pid == 0) {	/* child */
-			param.sched_priority = 1;
-
-			SAFE_SETEUID(cleanup, nobody_uid);
+static struct sched_variants variants[] = {
+	{ .sched_setscheduler = libc_sched_setscheduler, .desc = "libc" },
+	{ .sched_setscheduler = sys_sched_setscheduler, .desc = "syscall" },
+};
 
-			TEST(sched_setscheduler(pid, SCHED_FIFO, &param));
-
-			if (TEST_ERRNO) {
-			}
-
-			if (TEST_RETURN != -1) {
-				tst_resm(TFAIL, "sched_setscheduler(2) passed "
-					 "with non root priveledges");
-			} else if (TEST_ERRNO != EPERM) {
-				tst_resm(TFAIL, "Expected EPERM, got %d",
-					 TEST_ERRNO);
-			} else {
-				tst_resm(TPASS, "got EPERM");
-			}
-		} else {	/* parent */
-			/* let the child carry on */
-			wait(&status);
-			if (WIFEXITED(status) != 0) {	/* Exit with errors */
-				exit(WEXITSTATUS(status));
-			} else {
-				exit(0);
-			}
-		}
-
-		SAFE_SETEUID(cleanup, 0);
-	}
-	cleanup();
-	tst_exit();
-
-}
-
-/*
- * setup() - performs all ONE TIME setup for this test.
- */
-void setup(void)
+static void setup(void)
 {
-	struct passwd *pw;
+	struct passwd *pw = SAFE_GETPWNAM("nobody");
 
-	tst_require_root();
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 
-	pw = SAFE_GETPWNAM(NULL, "nobody");
 	nobody_uid = pw->pw_uid;
-
-	tst_sig(FORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
 }
 
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- *	       completion or premature exit.
- */
-void cleanup(void)
+static void run(void)
 {
-
+	struct sched_variants *tv = &variants[tst_variant];
+	pid_t pid = SAFE_FORK();
+
+	if (!pid) {
+		struct sched_param p = { .sched_priority = 1 };
+
+		SAFE_SETEUID(nobody_uid);
+		TST_EXP_FAIL(tv->sched_setscheduler(0, SCHED_FIFO, &p), EPERM,
+			     "sched_setscheduler(0, SCHED_FIFO, %d)",
+			     p.sched_priority);
+		SAFE_SETEUID(0);
+		exit(0);
+	}
+	tst_reap_children();
 }
+
+static struct tst_test test = {
+	.forks_child = 1,
+	.needs_root = 1,
+	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
+	.test_all = run,
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 14/16] syscalls/sched_setscheduler03: use libc/sys_sched_*()
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (12 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 13/16] syscalls/sched_setscheduler02: " Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 12:35   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 15/16] syscalls/sched_getscheduler01: convert to new API Alexey Kodanev
                   ` (2 subsequent siblings)
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_setscheduler/sched_setscheduler03.c | 39 ++++++++++++-------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
index 9045d0366..01385a08d 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
+++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
@@ -17,19 +17,30 @@
 #include <stdio.h>
 #include <errno.h>
 #include <pwd.h>
-#include <sched.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sys/wait.h>
 #include <stdlib.h>
 
 #include "tst_test.h"
+#include "tst_sched.h"
 
 #define RLIMIT_NICE_NORMAL 20
 
 static pid_t zero_pid;
 static struct sched_param param[1] = { {0} };
 
+static struct sched_variants variants[] = {
+	{ .sched_setscheduler = libc_sched_setscheduler,
+	  .sched_getscheduler = libc_sched_getscheduler,
+	  .desc = "libc"
+	},
+	{ .sched_setscheduler = sys_sched_setscheduler,
+	  .sched_getscheduler = sys_sched_getscheduler,
+	  .desc = "syscall"
+	},
+};
+
 struct test_case_t {
 	pid_t *pid;
 	int policy;
@@ -92,26 +103,25 @@ static void l_rlimit_setup(const int type, struct rlimit *limit)
 
 static void verify_fn(unsigned int i)
 {
-	tst_res(TINFO,
-		"Verifying case[%d]: policy = %d, priority = %d",
+	struct sched_variants *tv = &variants[tst_variant];
+
+	tst_res(TINFO, "Verifying case[%d]: policy = %d, priority = %d",
 		i + 1, cases[i].policy, cases[i].sched_param->sched_priority);
 
-	TEST(sched_setscheduler(*cases[i].pid, cases[i].policy,
-					cases[i].sched_param));
-	if (TST_RET)
-		tst_res(TFAIL | TTERRNO, "case[%d] expected: %d, got: ",
-			i + 1, cases[i].error);
-	else
-		tst_res(TPASS, "case[%d] succeeded", i + 1);
+	TST_EXP_PASS(tv->sched_setscheduler(*cases[i].pid, cases[i].policy,
+		     cases[i].sched_param));
 }
 
 static void setup(void)
 {
+	struct sched_variants *tv = &variants[tst_variant];
 	uid_t ruid, euid, suid;
 	struct rlimit limit;
 	struct passwd *pw;
 	uid_t nobody_uid;
 
+	tst_res(TINFO, "Testing %s variant", tv->desc);
+
 	pw = SAFE_GETPWNAM("nobody");
 	nobody_uid = pw->pw_uid;
 	l_rlimit_show(RLIMIT_NICE, &limit);
@@ -129,11 +139,9 @@ static void setup(void)
 	l_rlimit_setup(RLIMIT_NICE, &limit);
 
 	tst_res(TINFO, "Setting init sched policy to SCHED_OTHER");
-	if (sched_setscheduler(0, SCHED_OTHER, &param[0]) != 0)
-		tst_res(TFAIL | TERRNO,
-			 "ERROR sched_setscheduler: (0, SCHED_OTHER, param)");
-
-	if (sched_getscheduler(0) != SCHED_OTHER)
+	TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, SCHED_OTHER, &param[0]),
+			    "sched_setscheduler(0, SCHED_OTHER, 0)");
+	if (tv->sched_getscheduler(0) != SCHED_OTHER)
 		tst_res(TFAIL | TERRNO, "ERROR sched_setscheduler");
 
 	tst_res(TINFO, "Setting euid to nobody to drop privilege");
@@ -159,6 +167,7 @@ static void do_test(unsigned int i)
 }
 
 static struct tst_test test = {
+	.test_variants = ARRAY_SIZE(variants),
 	.tcnt = ARRAY_SIZE(cases),
 	.test = do_test,
 	.setup = setup,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 15/16] syscalls/sched_getscheduler01: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (13 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 14/16] syscalls/sched_setscheduler03: use libc/sys_sched_*() Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 12:39   ` Cyril Hrubis
  2021-08-06 16:47 ` [LTP] [PATCH v2 16/16] syscalls/sched_getscheduler02: " Alexey Kodanev
  2021-08-12 13:51 ` [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_getscheduler/sched_getscheduler01.c | 154 ++++++------------
 1 file changed, 50 insertions(+), 104 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c
index f6bdf1a1b..ebef6c3a5 100644
--- a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c
+++ b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler01.c
@@ -1,129 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
+ * Copyright (c) International Business Machines  Corp., 2001
  */
 
-/*
- * NAME
- *	sched_getscheduler01.C
+/*\
+ * [Description]
  *
- * DESCRIPTION
- *	Testcase to check sched_getscheduler() returns correct return value
+ * Testcase to check sched_getscheduler() returns correct return value.
  *
- * ALGORTIHM
- *	Call sched_setcheduler() to set the scheduling policy of the current
- *	process. Then call sched_getscheduler() to ensure that this is same
- *	as what set by the previous call to sched_setscheduler().
+ * [Algorithm]
  *
- *	Use SCHED_RR, SCHED_FIFO, SCHED_OTHER as the scheduling policies for
- *	sched_setscheduler().
+ * Call sched_setcheduler() to set the scheduling policy of the current
+ * process. Then call sched_getscheduler() to ensure that this is same
+ * as what set by the previous call to sched_setscheduler().
  *
- * USAGE:  <for command-line>
- *  sched_getscheduler01 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -f   : Turn off functionality Testing.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
+ * Use SCHED_RR, SCHED_FIFO, SCHED_OTHER as the scheduling policies for
+ * sched_setscheduler().
  *
- * RESTRICTION
- *	Must run test as root.
  */
 
 #include <errno.h>
-#include <sched.h>
 #include <stdio.h>
-#include "test.h"
-
-char *TCID = "sched_getscheduler01";
-int TST_TOTAL = 3;
 
-void setup(void);
-void cleanup(void);
+#include "tst_test.h"
+#include "tst_sched.h"
+
+static struct sched_variants variants[] = {
+	{ .sched_setscheduler = libc_sched_setscheduler,
+	  .sched_getscheduler = libc_sched_getscheduler,
+	  .desc = "libc"
+	},
+	{ .sched_setscheduler = sys_sched_setscheduler,
+	  .sched_getscheduler = sys_sched_getscheduler,
+	  .desc = "syscall"
+	},
+};
 
-struct test_case_t {
-	int prio;
+struct test_cases_t {
+	int priority;
 	int policy;
-} TC[] = {
-	/* set scheduling policy to SCHED_RR */
-	{
-	1, SCHED_RR},
-	    /* set scheduling policy to SCHED_OTHER */
-	{
-	0, SCHED_OTHER},
-	    /* set scheduling policy to SCHED_FIFO */
-	{
-	1, SCHED_FIFO}
+} tcases[] = {
+	{1, SCHED_RR},
+	{0, SCHED_OTHER},
+	{1, SCHED_FIFO}
 };
 
-int main(int ac, char **av)
+static void run(unsigned int n)
 {
-	int lc;
-	int i;
-	struct sched_param param;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-
-		tst_count = 0;
+	struct sched_variants *tv = &variants[tst_variant];
+	struct test_cases_t *tc = &tcases[n];
+	struct sched_param p = { .sched_priority = tc->priority };
 
-		for (i = 0; i < TST_TOTAL; i++) {
+	TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, tc->policy, &p));
 
-			param.sched_priority = TC[i].prio;
-
-			if (sched_setscheduler(0, TC[i].policy, &param) == -1)
-				tst_brkm(TBROK, cleanup,
-					 "sched_setscheduler failed");
-
-			TEST(sched_getscheduler(0));
-
-			if (TEST_RETURN == -1) {
-				tst_resm(TFAIL, "call failed unexpectedly");
-				continue;
-			}
-
-			if (TEST_RETURN != TC[i].policy)
-				tst_resm(TFAIL,
-					 "policy value returned is not "
-					 "correct");
-			else
-				tst_resm(TPASS,
-					 "policy value returned is correct");
-		}
-	}
-
-	cleanup();
-	tst_exit();
+	TEST(tv->sched_getscheduler(0));
+	if (TST_RET == tc->policy)
+		tst_res(TPASS, "got expected policy %d", tc->policy);
+	else
+		tst_res(TFAIL | TERRNO, "got policy %ld, expected %d", TST_RET, tc->policy);
 }
 
-void setup(void)
+static void setup(void)
 {
-
-	tst_require_root();
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
-
-	TEST_PAUSE;
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 }
 
-void cleanup(void)
-{
-}
+static struct tst_test test = {
+	.needs_root = 1,
+	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
+	.tcnt = ARRAY_SIZE(tcases),
+	.test = run,
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 16/16] syscalls/sched_getscheduler02: convert to new API
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (14 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 15/16] syscalls/sched_getscheduler01: convert to new API Alexey Kodanev
@ 2021-08-06 16:47 ` Alexey Kodanev
  2021-08-09 12:44   ` Cyril Hrubis
  2021-08-12 13:51 ` [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
  16 siblings, 1 reply; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-06 16:47 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 .../sched_getscheduler/sched_getscheduler02.c | 109 ++++--------------
 1 file changed, 24 insertions(+), 85 deletions(-)

diff --git a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c
index c43240108..effd18adb 100644
--- a/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c
+++ b/testcases/kernel/syscalls/sched_getscheduler/sched_getscheduler02.c
@@ -1,106 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
- *
- *   Copyright (c) International Business Machines  Corp., 2001
- *
- *   This program is free software;  you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- *   the GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program;  if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Copyright (c) 2021, BELLSOFT. All rights reserved.
+ * Copyright (c) International Business Machines  Corp., 2001
  */
 
-/*
- * NAME
- *	sched_getscheduler02.C
- *
- * DESCRIPTION
- *	To check for the errno ESRCH
+/*\
+ * [Description]
  *
- * ALGORITHM
- *	Pass an invalid pid to sched_getscheduler() and test for ESRCH.
- *
- * USAGE:  <for command-line>
- *  sched_getscheduler02 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
- *     where,  -c n : Run n copies concurrently.
- *             -e   : Turn on errno logging.
- *             -i n : Execute test n times.
- *             -I x : Execute test for x seconds.
- *             -P x : Pause for x seconds between iterations.
- *             -t   : Turn on syscall timing.
- *
- * RESTRICTION
- *	None
+ * Pass an invalid pid to sched_getscheduler() and test for ESRCH.
  */
 
 #include <stdio.h>
-#include <sched.h>
 #include <errno.h>
-#include "test.h"
 
-char *TCID = "sched_getscheduler02";
-int TST_TOTAL = 1;
+#include "tst_test.h"
+#include "tst_sched.h"
 
 static pid_t unused_pid;
 
-void setup(void);
-void cleanup(void);
+static struct sched_variants variants[] = {
+	{ .sched_getscheduler = libc_sched_getscheduler, .desc = "libc" },
+	{ .sched_getscheduler = sys_sched_getscheduler, .desc = "syscall" },
+};
 
-int main(int ac, char **av)
+static void setup(void)
 {
-	int lc;
-
-	tst_parse_opts(ac, av, NULL, NULL);
-
-	setup();
-
-	for (lc = 0; TEST_LOOPING(lc); lc++) {
-		/* reset tst_count in case we are looping */
-		tst_count = 0;
-
-		TEST(sched_getscheduler(unused_pid));
-
-		if (TEST_RETURN != -1) {
-			tst_resm(TFAIL, "sched_getscheduler(2) passed "
-				 "unexpectedly");
-			continue;
-		}
-
-		if (errno != ESRCH) {
-			tst_resm(TFAIL, "Expected ESRCH, got %d", errno);
-		} else {
-			tst_resm(TPASS, "call failed with ESRCH");
-		}
-	}
-	cleanup();
-	tst_exit();
+	tst_res(TINFO, "Testing %s variant", variants[tst_variant].desc);
 
+	unused_pid = tst_get_unused_pid();
 }
 
-/*
- * setup() - performs all ONE TIME setup for this test.
- */
-void setup(void)
+static void run(void)
 {
-	unused_pid = tst_get_unused_pid(cleanup);
-
-	tst_sig(NOFORK, DEF_HANDLER, cleanup);
+	struct sched_variants *tv = &variants[tst_variant];
 
-	TEST_PAUSE;
+	TST_EXP_FAIL(tv->sched_getscheduler(unused_pid), ESRCH,
+		     "sched_getscheduler(%d)", unused_pid);
 }
 
-/*
- * cleanup() - performs all ONE TIME cleanup for this test at
- *	       completion or premature exit.
- */
-void cleanup(void)
-{
-
-}
+static struct tst_test test = {
+	.setup = setup,
+	.test_variants = ARRAY_SIZE(variants),
+	.test_all = run,
+};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers
  2021-08-06 16:47 ` [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers Alexey Kodanev
@ 2021-08-09  7:55   ` Li Wang
  2021-08-09  9:53   ` Cyril Hrubis
  1 sibling, 0 replies; 35+ messages in thread
From: Li Wang @ 2021-08-09  7:55 UTC (permalink / raw)
  To: ltp

Hi Alexey,

On Sat, Aug 7, 2021 at 12:48 AM Alexey Kodanev <aleksei.kodanev@bell-sw.com>
wrote:

> The new wrappers allow to test libc and syscall variants. This is needed
> because libc implementation can differ from calling syscall directly.
> For example, musl libc implementation returns ENOSYS for some sched_*()
> functions due to commit 1e21e78bf7a5 ("add support for thread scheduling
> (POSIX TPS option)").
>
> Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
> ---
>  include/tst_sched.h | 70 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 70 insertions(+)
>  create mode 100644 include/tst_sched.h
>
> diff --git a/include/tst_sched.h b/include/tst_sched.h
> new file mode 100644
> index 000000000..a5dc767b3
> --- /dev/null
> +++ b/include/tst_sched.h
> @@ -0,0 +1,70 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * Copyright (c) 2021, BELLSOFT. All rights reserved.
> + */
> +
> +#ifndef TST_SCHED_H_
> +#define TST_SCHED_H_
> +
> +#include <sched.h>
> +
> +#include "lapi/syscalls.h"
> +
> +struct sched_variants {
> +       char *desc;
> +
> +       int (*sched_setparam)(pid_t pid, const struct sched_param *param);
> +       int (*sched_getparam)(pid_t pid, struct sched_param *param);
> +       int (*sched_setscheduler)(pid_t pid, int policy, const struct
> sched_param *param);
> +       int (*sched_getscheduler)(pid_t pid);
> +};
>

The whole patchset looks tidy and correctly, but I'm thinking maybe
we can define the varints[] unified here instead of stating them in each
test case again and again?

I.e.

--- a/include/tst_sched.h
+++ b/include/tst_sched.h
@@ -10,15 +10,6 @@

 #include "lapi/syscalls.h"

-struct sched_variants {
-       char *desc;
-
-       int (*sched_setparam)(pid_t pid, const struct sched_param *param);
-       int (*sched_getparam)(pid_t pid, struct sched_param *param);
-       int (*sched_setscheduler)(pid_t pid, int policy, const struct
sched_param *param);
-       int (*sched_getscheduler)(pid_t pid);
-};
-
 #define _TST_LIBC_SCHED_SCALL(SCALL, ...)({ \
        int tst_ret = SCALL(__VA_ARGS__); \
        if (tst_ret == -1 && errno == ENOSYS) { \
@@ -67,4 +58,24 @@ static inline int libc_sched_getscheduler(pid_t pid)
        return _TST_LIBC_SCHED_SCALL(sched_getscheduler, pid);
 }

+struct sched_variants {
+       char *desc;
+
+       int (*sched_setparam)(pid_t pid, const struct sched_param *param);
+       int (*sched_getparam)(pid_t pid, struct sched_param *param);
+       int (*sched_setscheduler)(pid_t pid, int policy, const struct
sched_param *param);
+       int (*sched_getscheduler)(pid_t pid);
+} variants[] = {
+       { .sched_setparam = libc_sched_setparam,
+         .sched_getparam = libc_sched_getparam,
+         .sched_setscheduler = libc_sched_setscheduler,
+         .desc = "libc"
+       },
+       { .sched_setparam = sys_sched_setparam,
+         .sched_getparam = sys_sched_getparam,
+         .sched_setscheduler = sys_sched_setscheduler,
+         .desc = "syscall"
+       },
+};
+
 #endif /* TST_SCHED_H_ */

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210809/ff8333a1/attachment.htm>

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers
  2021-08-06 16:47 ` [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers Alexey Kodanev
  2021-08-09  7:55   ` Li Wang
@ 2021-08-09  9:53   ` Cyril Hrubis
  1 sibling, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09  9:53 UTC (permalink / raw)
  To: ltp

Hi!
> +#define _TST_LIBC_SCHED_SCALL(SCALL, ...)({ \

Please do not add any identifiers that start with underscore, these are
reserved for OS implementation e.g. libc and kernel headers.

We usually add the underscore to the end instead, so this will end up as

#define TST_LIBC_SCHED_SCALL_(SCALL, ...) ...

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 02/16] syscalls/sched_getparam01: use libc/sys_sched_*()
  2021-08-06 16:47 ` [LTP] [PATCH v2 02/16] syscalls/sched_getparam01: use libc/sys_sched_*() Alexey Kodanev
@ 2021-08-09 10:02   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 10:02 UTC (permalink / raw)
  To: ltp

Hi!
> +static struct sched_variants variants[] = {
> +	{ .sched_getparam = libc_sched_getparam, .desc = "libc" },
> +	{ .sched_getparam = sys_sched_getparam, .desc = "syscall" },
> +};

It would be nicer if we defined the variants structure once in the
header as Li pointed out, otherwise:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 03/16] syscalls/sched_getparam03: use libc/sys_sched_*()
  2021-08-06 16:47 ` [LTP] [PATCH v2 03/16] syscalls/sched_getparam03: " Alexey Kodanev
@ 2021-08-09 10:03   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 10:03 UTC (permalink / raw)
  To: ltp

Hi!
> +static struct sched_variants variants[] = {
> +	{ .sched_getparam = libc_sched_getparam, .desc = "libc"},
> +	{ .sched_getparam = sys_sched_getparam, .desc = "syscall"},
> +};

Here as well.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 04/16] syscalls/sched_setparam01: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 04/16] syscalls/sched_setparam01: convert to new API Alexey Kodanev
@ 2021-08-09 10:05   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 10:05 UTC (permalink / raw)
  To: ltp

Hi!
Nice cleanup :-)

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>


-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 05/16] syscalls/sched_setparam02: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 05/16] syscalls/sched_setparam02: " Alexey Kodanev
@ 2021-08-09 11:19   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 11:19 UTC (permalink / raw)
  To: ltp

Hi!
Here as well, nice cleanup.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 06/16] syscalls/sched_setparam03: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 06/16] syscalls/sched_setparam03: " Alexey Kodanev
@ 2021-08-09 11:28   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 11:28 UTC (permalink / raw)
  To: ltp

Hi!
> +	if (!child_pid) {
> +		/*
> +		 * Call sched_setparam(2) with pid = getppid() so that
> +		 * it will set the scheduling parameters for parent
> +		 * process
> +		 */

I would have removed this comment as well, as it's stating the obvious.

> +		TST_EXP_PASS_SILENT(tv->sched_setparam(getppid(), &p5));
> +		exit(0);
>  	}
> +	tst_reap_children();
>  
> -	cleanup();
> -	tst_exit();
> +	TST_EXP_PASS_SILENT(tv->sched_getparam(0, &p));
> +
> +	if (p.sched_priority == p5.sched_priority)
> +		tst_res(TPASS, "got expected priority %d", p.sched_priority);
> +	else
> +		tst_res(TFAIL, "got priority %d, expected 5", p.sched_priority);
>  }
>  
> -/* setup() - performs all ONE TIME setup for this test */
>  void setup(void)
>  {
> -	struct sched_param p = { 1 };
> -
> -	tst_require_root();
> -
> -	tst_sig(FORK, DEF_HANDLER, cleanup);
> -
> -	TEST_PAUSE;
> -
> -	/* Change scheduling policy to SCHED_FIFO */
> -	if ((sched_setscheduler(0, SCHED_FIFO, &p)) == -1) {
> -		tst_brkm(TBROK, cleanup, "sched_setscheduler() failed");
> -	}
> +	struct sched_variants *tv = &variants[tst_variant];
> +	struct sched_param p = { .sched_priority = 1 };
>  
> +	tst_res(TINFO, "Testing %s variant", tv->desc);
> +	TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, SCHED_FIFO, &p));

We should tst_brk() here if this fails, TST_EXP_PASS_SILENT() is not
really supposed to be used in the test setup().

And given that we handle the TCONF case in the function we call by the
pointer we can just do:

	if (tv->sched_setscheduler(0, SCHED_FIFO, &p))
		tst_brk(TBROK | TERRNO, "sched_setcheduler(0, SCHED_FIFO, ...)");


Other than this the rest looks good. With the setup() part fixed:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>


-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 07/16] syscalls/sched_setparam04: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 07/16] syscalls/sched_setparam04: " Alexey Kodanev
@ 2021-08-09 11:31   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 11:31 UTC (permalink / raw)
  To: ltp

Hi!
> +/*\
> + * [Description]
>   *
> - *    SIGNALS
> - *      Uses SIGUSR1 to pause before test if option set.
> - *      (See the parse_opts(3) man page).
> + * Testing error conditions for sched_setparam(2)
>   *
>   * DESCRIPTION

We should remove this DESCRIPTION as it's redundant.

>   * 	Verify that,
> @@ -41,129 +21,54 @@
>   *   4) sched_setparam(2) returns -1 sets errno to EINVAL if the
>   *	value for p.sched_priority is other than 0 for scheduling
>   *	policy, SCHED_OTHER

And reformat this part so that it renders as a list in ascii-doc please.

For the rest:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 08/16] syscalls/sched_setparam05: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 08/16] syscalls/sched_setparam05: " Alexey Kodanev
@ 2021-08-09 11:34   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 11:34 UTC (permalink / raw)
  To: ltp

Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 09/16] syscalls/sched_rr_get_interval01: use sys_sched_*()
  2021-08-06 16:47 ` [LTP] [PATCH v2 09/16] syscalls/sched_rr_get_interval01: use sys_sched_*() Alexey Kodanev
@ 2021-08-09 11:35   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 11:35 UTC (permalink / raw)
  To: ltp

Hi!
We should explain why we switch from the libc call to a syscall here in
the commit message something as:

"Fix the test on musl where sched_setscheduler is not implmeneted."

Other than that:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 10/16] syscalls/sched_rr_get_interval02: use sys_sched_*()
  2021-08-06 16:47 ` [LTP] [PATCH v2 10/16] syscalls/sched_rr_get_interval02: " Alexey Kodanev
@ 2021-08-09 11:36   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 11:36 UTC (permalink / raw)
  To: ltp

Hi!
Same here.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 11/16] syscalls/sched_rr_get_interval03: use sys_sched_*()
  2021-08-06 16:47 ` [LTP] [PATCH v2 11/16] syscalls/sched_rr_get_interval03: " Alexey Kodanev
@ 2021-08-09 11:36   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 11:36 UTC (permalink / raw)
  To: ltp

Hi!
Same here.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 12/16] syscalls/sched_setscheduler01: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 12/16] syscalls/sched_setscheduler01: convert to new API Alexey Kodanev
@ 2021-08-09 12:19   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 12:19 UTC (permalink / raw)
  To: ltp

Hi!
> + * [Algorithm]
>   *
> - * USAGE:  <for command-line>
> - *  sched_setscheduler01 [-c n] [-e] [-i n] [-I x] [-P x] [-t]
> - *     where,  -c n : Run n copies concurrently.
> - *             -e   : Turn on errno logging.
> - *             -i n : Execute test n times.
> - *             -I x : Execute test for x seconds.
> - *             -P x : Pause for x seconds between iterations.
> - *             -t   : Turn on syscall timing.
> - *
> - * HISTORY
> - *	07/2001 Ported by Wayne Boyer
> - *
> - * RESTRICTIONS
> - *	None
> + * 1. Call sched_setscheduler with an invalid pid, and expect
> + * ESRCH to be returned.
> + * 2. Call sched_setscheduler with an invalid scheduling policy,
> + * and expect EINVAL to be returned.
> + * 3. Call sched_setscheduler with an invalid "param" address,
> + * which lies outside the address space of the process, and expect
> + * EFAULT to be returned.
> + * 4.Call sched_setscheduler with an invalid priority value
> + * in "param" and expect EINVAL to be returned
>   */

Can we have this reformatted so that it renders as a nice list in
asciidoc as well?

Other than this:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 13/16] syscalls/sched_setscheduler02: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 13/16] syscalls/sched_setscheduler02: " Alexey Kodanev
@ 2021-08-09 12:21   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 12:21 UTC (permalink / raw)
  To: ltp

Hi!
>  #define SCHED_INVALID	99
>  #define INVALID_PID	999999

I guess that we should remove these two unused macros as well.

> +	if (!pid) {
> +		struct sched_param p = { .sched_priority = 1 };
> +
> +		SAFE_SETEUID(nobody_uid);
> +		TST_EXP_FAIL(tv->sched_setscheduler(0, SCHED_FIFO, &p), EPERM,
> +			     "sched_setscheduler(0, SCHED_FIFO, %d)",
> +			     p.sched_priority);
> +		SAFE_SETEUID(0);

And we do not have to reset the UID before we call exit(0)

> +		exit(0);
> +	}
> +	tst_reap_children();
>  }

Other than that:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 14/16] syscalls/sched_setscheduler03: use libc/sys_sched_*()
  2021-08-06 16:47 ` [LTP] [PATCH v2 14/16] syscalls/sched_setscheduler03: use libc/sys_sched_*() Alexey Kodanev
@ 2021-08-09 12:35   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 12:35 UTC (permalink / raw)
  To: ltp

Hi!
>  	tst_res(TINFO, "Setting init sched policy to SCHED_OTHER");
> -	if (sched_setscheduler(0, SCHED_OTHER, &param[0]) != 0)
> -		tst_res(TFAIL | TERRNO,
> -			 "ERROR sched_setscheduler: (0, SCHED_OTHER, param)");
> -
> -	if (sched_getscheduler(0) != SCHED_OTHER)
> +	TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, SCHED_OTHER, &param[0]),
> +			    "sched_setscheduler(0, SCHED_OTHER, 0)");

Here as well, we shouldn't use TST_EXP_PASS* in the test setup().

Other than that:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 15/16] syscalls/sched_getscheduler01: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 15/16] syscalls/sched_getscheduler01: convert to new API Alexey Kodanev
@ 2021-08-09 12:39   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 12:39 UTC (permalink / raw)
  To: ltp

Hi!
> -int main(int ac, char **av)
> +static void run(unsigned int n)
>  {
> -	int lc;
> -	int i;
> -	struct sched_param param;
> -
> -	tst_parse_opts(ac, av, NULL, NULL);
> -
> -	setup();
> -
> -	for (lc = 0; TEST_LOOPING(lc); lc++) {
> -
> -		tst_count = 0;
> +	struct sched_variants *tv = &variants[tst_variant];
> +	struct test_cases_t *tc = &tcases[n];
> +	struct sched_param p = { .sched_priority = tc->priority };
>  
> -		for (i = 0; i < TST_TOTAL; i++) {
> +	TST_EXP_PASS_SILENT(tv->sched_setscheduler(0, tc->policy, &p));

We should probably do:

	if (!TST_PASS)
		return;

Because it does not make much sense to continue if setscheduler() have
failed, but that's very minor.


Other than that:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 16/16] syscalls/sched_getscheduler02: convert to new API
  2021-08-06 16:47 ` [LTP] [PATCH v2 16/16] syscalls/sched_getscheduler02: " Alexey Kodanev
@ 2021-08-09 12:44   ` Cyril Hrubis
  0 siblings, 0 replies; 35+ messages in thread
From: Cyril Hrubis @ 2021-08-09 12:44 UTC (permalink / raw)
  To: ltp

Hi!
> + * Pass an invalid pid to sched_getscheduler() and test for ESRCH.
                ^
		unused is more precise I guess.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno
  2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
                   ` (15 preceding siblings ...)
  2021-08-06 16:47 ` [LTP] [PATCH v2 16/16] syscalls/sched_getscheduler02: " Alexey Kodanev
@ 2021-08-12 13:51 ` Alexey Kodanev
  16 siblings, 0 replies; 35+ messages in thread
From: Alexey Kodanev @ 2021-08-12 13:51 UTC (permalink / raw)
  To: ltp

On 06.08.2021 19:47, Alexey Kodanev wrote:
> The patch-set adds new libc/sys_sched_* wrappers to test libc
> and syscall variants of sched_*() functions seperately.
> 
> This is needed because musl libc returns ENOSYS for those
> functions [1], and the tests just fails with it.
> 
> [1]: https://git.musl-libc.org/cgit/musl/commit/?id=1e21e78bf7a5
> 
> v2: Using test variants
> 

Hi Li and Cyril,

Thanks for the great review! Applied the patches with all your suggestions.


^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2021-08-12 13:51 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 16:47 [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev
2021-08-06 16:47 ` [LTP] [PATCH v2 01/16] lib/tst_sched: add ltp sys/libc_sched_*() wrappers Alexey Kodanev
2021-08-09  7:55   ` Li Wang
2021-08-09  9:53   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 02/16] syscalls/sched_getparam01: use libc/sys_sched_*() Alexey Kodanev
2021-08-09 10:02   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 03/16] syscalls/sched_getparam03: " Alexey Kodanev
2021-08-09 10:03   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 04/16] syscalls/sched_setparam01: convert to new API Alexey Kodanev
2021-08-09 10:05   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 05/16] syscalls/sched_setparam02: " Alexey Kodanev
2021-08-09 11:19   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 06/16] syscalls/sched_setparam03: " Alexey Kodanev
2021-08-09 11:28   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 07/16] syscalls/sched_setparam04: " Alexey Kodanev
2021-08-09 11:31   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 08/16] syscalls/sched_setparam05: " Alexey Kodanev
2021-08-09 11:34   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 09/16] syscalls/sched_rr_get_interval01: use sys_sched_*() Alexey Kodanev
2021-08-09 11:35   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 10/16] syscalls/sched_rr_get_interval02: " Alexey Kodanev
2021-08-09 11:36   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 11/16] syscalls/sched_rr_get_interval03: " Alexey Kodanev
2021-08-09 11:36   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 12/16] syscalls/sched_setscheduler01: convert to new API Alexey Kodanev
2021-08-09 12:19   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 13/16] syscalls/sched_setscheduler02: " Alexey Kodanev
2021-08-09 12:21   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 14/16] syscalls/sched_setscheduler03: use libc/sys_sched_*() Alexey Kodanev
2021-08-09 12:35   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 15/16] syscalls/sched_getscheduler01: convert to new API Alexey Kodanev
2021-08-09 12:39   ` Cyril Hrubis
2021-08-06 16:47 ` [LTP] [PATCH v2 16/16] syscalls/sched_getscheduler02: " Alexey Kodanev
2021-08-09 12:44   ` Cyril Hrubis
2021-08-12 13:51 ` [LTP] [PATCH v2 00/16] syscalls/sched_*: convert to new API and handle ENOSYS errno Alexey Kodanev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.