Test for hdio.c

Bran S archsbran at gmail.com
Wed Mar 25 14:18:52 UTC 2020

On Wed, 25 Mar 2020 at 07:43, Eugene Syromiatnikov <esyr at redhat.com> wrote:
> On Tue, Mar 24, 2020 at 10:49:49PM +0530, Bran S wrote:
> > Hi guys,
> >
> > I am writing a test for hdio.c.
> > To do so I am calling ioctl as:
> > `ioctl(fd, HDIO_GETGEO, &geom);`.
> >
> > Here geom is the geometry struct, and fd is the file descriptor.
> > Now the problem I am facing is: what should be the file descriptor ?
> It is usually -1, to avoid side effects.  There are several exceptions,
> like btrfs test and ioctl_termios, but these are pretty specific (fist
> one requires root and an environment setup to run; second is, well,
> VT ioctl).
> > What file or device should the file descriptor refer to ?
> > If we are talking about the harddrive then should it refer to /dev/sda ?
> IIRC, HDIO_* are for ATA interface devices, /dev/hd*.
> Note that it is possible that almost any device file is absent, as
> testing environments tend (and should) to be pretty diverse.

I have submitted a patch for testing HDIO_GETGEO.
The comprehensive test suite's project detail mentions that to write
test scripts one would have to read through the syscall code.
I would like to know which syscall testing would require me to do so.
So that I can write test for that syscall and move on to write a

More information about the Strace-devel mailing list