[PATCH v1] Test for HDIO_GETGEO
Dmitry V. Levin
ldv at altlinux.org
Wed Mar 25 14:19:02 UTC 2020
On Wed, Mar 25, 2020 at 06:03:15PM +0530, Bran S wrote:
> >From e553a4ad62ed92a70a403d6424361bd45f39f4ea Mon Sep 17 00:00:00 2001
> From: Bran S <archsbran at gmail.com>
> Date: Wed, 25 Mar 2020 17:45:24 +0530
> Subject: [PATCH v1] Test for HDIO_GETGEO
>
> ---
> tests/.gitignore | 1 +
> tests/Makefile.am | 1 +
> tests/gen_tests.in | 1 +
> tests/hdio_getgeo.c | 19 +++++++++++++++++++
> 4 files changed, 22 insertions(+)
> create mode 100644 tests/hdio_getgeo.c
>
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 5c73355d..c81cbca0 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -165,6 +165,7 @@ getuid
> getuid32
> getxxid
> group_req
> +hdio_getgeo
> inet-cmsg
> init_module
> inject-nf
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index f2a5bc6d..f301b3da 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -114,6 +114,7 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \
> getpid \
> getppid \
> gettid \
> + hdio_getgeo \
> inject-nf \
> int_0x80 \
> ioctl_dm-v \
> diff --git a/tests/gen_tests.in b/tests/gen_tests.in
> index ae090d6d..12309d4a 100644
> --- a/tests/gen_tests.in
> +++ b/tests/gen_tests.in
> @@ -148,6 +148,7 @@ getuid32 +getuid.test
> getuid32-creds +getuid.test
> getxxid -a10 -e trace=getxpid,getxuid,getxgid
> group_req -e trace=setsockopt
> +hdio_getgeo +ioctl.test
> inet-cmsg -e trace=recvmsg
> init_module -a27
> inotify -a23 -e trace=inotify_add_watch,inotify_rm_watch
> diff --git a/tests/hdio_getgeo.c b/tests/hdio_getgeo.c
> new file mode 100644
> index 00000000..2b6280b5
> --- /dev/null
> +++ b/tests/hdio_getgeo.c
> @@ -0,0 +1,19 @@
> +#include "tests.h"
> +
> +#include <stdio.h>
> +#include <string.h>
> +#include <sys/ioctl.h>
> +#include <linux/hdreg.h>
> +
> +#define RVAL_EBADF " = -1 EBADF (%m)\n"
> +
> +int
> +main(void)
> +{
> + struct hd_geometry geom;
> + ioctl(-1, HDIO_GETGEO, &geom);
> + printf("ioctl(-1, HDIO_GETGEO, %p)" RVAL_EBADF, &geom);
> +
> + puts("+++ exited with 0 +++");
> + return 0;
> +}
What's the test coverage of this test?
--
ldv
More information about the Strace-devel
mailing list