From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 06/16] syscalls/sched_setparam03: convert to new API
Date: Mon, 9 Aug 2021 13:28:34 +0200 [thread overview]
Message-ID: <YRERYjpToxyA0AZI@yuki> (raw)
In-Reply-To: <20210806164730.51040-7-aleksei.kodanev@bell-sw.com>
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
next prev parent reply other threads:[~2021-08-09 11:28 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YRERYjpToxyA0AZI@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox