[PATCH 2/4] tests: add iopl.test

Dmitry V. Levin ldv at altlinux.org
Wed Apr 20 01:40:30 UTC 2016


On Tue, Apr 19, 2016 at 03:38:33PM +0800, Fei Jie wrote:
> * tests/iopl.c: New file.
> * tests/iopl.test: New test.
> * tests/.gitignore: Add iopl.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add iopl.test.
> ---
>  tests/.gitignore  |  1 +
>  tests/Makefile.am |  2 ++
>  tests/iopl.c      | 36 ++++++++++++++++++++++++++++++++++++
>  tests/iopl.test   |  6 ++++++
>  4 files changed, 45 insertions(+)
>  create mode 100644 tests/iopl.c
>  create mode 100755 tests/iopl.test
> 
> diff --git a/tests/.gitignore b/tests/.gitignore
> index bf9cf57..31e39b4 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -65,6 +65,7 @@ getxxid
>  inet-cmsg
>  ioctl
>  ioperm
> +iopl
>  ip_mreq
>  ipc_msg
>  ipc_msgbuf
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 2878dc2..44bc44b 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -117,6 +117,7 @@ check_PROGRAMS = \
>  	inet-cmsg \
>  	ioctl \
>  	ioperm \
> +	iopl \
>  	ip_mreq \
>  	ipc_msg \
>  	ipc_msgbuf \
> @@ -329,6 +330,7 @@ DECODER_TESTS = \
>  	inet-cmsg.test \
>  	ioctl.test \
>  	ioperm.test \
> +	iopl.test \
>  	ip_mreq.test \
>  	ipc_msg.test \
>  	ipc_msgbuf.test \
> diff --git a/tests/iopl.c b/tests/iopl.c
> new file mode 100644
> index 0000000..5fc658a
> --- /dev/null
> +++ b/tests/iopl.c
> @@ -0,0 +1,36 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_iopl
> +
> +# 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)
> +{
> +	int rc = syscall(__NR_iopl, 4);
> +	const char *error_text;
> +	switch (errno) {
> +		case ENOSYS:
> +			error_text = "ENOSYS";
> +			break;
> +		case EPERM:
> +			error_text = "EPERM";
> +			break;
> +		default:
> +			error_text = "EINVAL";
> +	}
> +	printf("iopl(4) = %d %s (%m)\n", rc, error_text);
> +
> +	puts("+++ exited with 0 +++");
> +	return 0;
> +}

Indentation is wrong, otherwise OK.

Applied with these 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/57de4d5a/attachment.bin>


More information about the Strace-devel mailing list