[PATCH 3/4] tests: add sched_xetparam.test
Dmitry V. Levin
ldv at altlinux.org
Wed Mar 9 03:52:27 UTC 2016
On Tue, Mar 08, 2016 at 02:23:21PM +0800, Fei Jie wrote:
> * tests/sched_xetparam.c: New file.
> * tests/sched_xetparam.test: New test.
> * tests/.gitignore: Add sched_xetparam.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (TESTS): Add sched_xetparam.test.
> ---
> tests/.gitignore | 1 +
> tests/Makefile.am | 2 ++
> tests/sched_xetparam.c | 37 +++++++++++++++++++++++++++++++++++++
> tests/sched_xetparam.test | 11 +++++++++++
> 4 files changed, 51 insertions(+)
> create mode 100644 tests/sched_xetparam.c
> create mode 100755 tests/sched_xetparam.test
>
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 3093adb..dd8d6f9 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -93,6 +93,7 @@ rt_tgsigqueueinfo
> sched_get_priority_mxx
> sched_xetaffinity
> sched_xetattr
> +sched_xetparam
> scm_rights
> seccomp
> select
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 9cbdfc8..3939c1d 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -141,6 +141,7 @@ check_PROGRAMS = \
> sched_get_priority_mxx \
> sched_xetaffinity \
> sched_xetattr \
> + sched_xetparam \
> scm_rights \
> seccomp \
> select \
> @@ -303,6 +304,7 @@ TESTS = \
> sched_get_priority_mxx.test \
> sched_xetaffinity.test \
> sched_xetattr.test \
> + sched_xetparam.test \
> scm_rights-fd.test \
> seccomp.test \
> select.test \
> diff --git a/tests/sched_xetparam.c b/tests/sched_xetparam.c
> new file mode 100644
> index 0000000..092c662
> --- /dev/null
> +++ b/tests/sched_xetparam.c
> @@ -0,0 +1,37 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#if defined __NR_sched_getparam && defined __NR_sched_setparam
> +
> +# include <sched.h>
> +# include <stdio.h>
> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> + struct sched_param *const param = tail_alloc(sizeof(struct sched_param));
> + param->sched_priority = 0;
This might be less than the value returned by sched_get_priority_min.
> + int rc = syscall(__NR_sched_setparam, 0, param);
> + if (rc == -1)
> + perror_msg_and_fail("sched_setparam");
Why fail the test if this syscall fails?
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160309/12125c61/attachment.bin>
More information about the Strace-devel
mailing list