[PATCH 1/4] tests: add ioperm.test
Dmitry V. Levin
ldv at altlinux.org
Wed Apr 20 01:39:07 UTC 2016
On Tue, Apr 19, 2016 at 03:38:32PM +0800, Fei Jie wrote:
> * tests/ioperm.c: New file.
> * tests/ioperm.test: New test.
> * tests/.gitignore: Add ioperm.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add ioperm.test.
> ---
> tests/.gitignore | 1 +
> tests/Makefile.am | 2 ++
> tests/ioperm.c | 41 +++++++++++++++++++++++++++++++++++++++++
> tests/ioperm.test | 6 ++++++
> 4 files changed, 50 insertions(+)
> create mode 100644 tests/ioperm.c
> create mode 100755 tests/ioperm.test
>
> diff --git a/tests/.gitignore b/tests/.gitignore
> index f3ee629..bf9cf57 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -64,6 +64,7 @@ getrusage
> getxxid
> inet-cmsg
> ioctl
> +ioperm
> ip_mreq
> ipc_msg
> ipc_msgbuf
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index e9cd625..2878dc2 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -116,6 +116,7 @@ check_PROGRAMS = \
> getxxid \
> inet-cmsg \
> ioctl \
> + ioperm \
> ip_mreq \
> ipc_msg \
> ipc_msgbuf \
> @@ -327,6 +328,7 @@ DECODER_TESTS = \
> getxxid.test \
> inet-cmsg.test \
> ioctl.test \
> + ioperm.test \
> ip_mreq.test \
> ipc_msg.test \
> ipc_msgbuf.test \
> diff --git a/tests/ioperm.c b/tests/ioperm.c
> new file mode 100644
> index 0000000..a57372d
> --- /dev/null
> +++ b/tests/ioperm.c
> @@ -0,0 +1,41 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_ioperm
> +
> +# include <errno.h>
> +# include <stdio.h>
> +# include <sys/io.h>
sys/io.h is not needed for the test
> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> + const unsigned long port = (unsigned long) 0xdeafbeefffffffff;
> + int rc = syscall(__NR_ioperm, port, 1, 0);
> + const char *error_text;
> + switch (errno) {
> + case EIO:
> + error_text = "EIO";
> + break;
> + case ENOSYS:
> + error_text = "ENOSYS";
> + break;
> + case EPERM:
> + error_text = "EPERM";
> + break;
> + default:
> + error_text = "EINVAL";
> + }
Something went wrong with the indentation.
> + printf("ioperm(%#lx, %#lx, %d) = %d %s (%m)\n",
> + port, (unsigned long) 1, 0, rc, error_text);
You can use 1UL instead of (unsigned long) 1.
Applied with this changes, thanks.
--
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/20160420/532769e3/attachment.bin>
More information about the Strace-devel
mailing list