[LTP] [PATCH v1] Avoid messing with system tty in ioctl01.c
Marius Kittler
mkittler@suse.de
Mon Sep 11 17:23:27 CEST 2023
Am Montag, 11. September 2023, 17:14:53 CEST schrieb Cyril Hrubis:
> Hi!
>
> > * Use `openpty()` to create a new tty
> > * Remove `-D` option
> > * Remove requirement to run as root
> >
> > Signed-off-by: Marius Kittler <mkittler@suse.de>
> > ---
> >
> > runtest/syscalls | 2 +-
> > testcases/kernel/syscalls/ioctl/ioctl01.c | 25 ++++++++++------------
> > testcases/kernel/syscalls/ioctl/test_ioctl | 23 --------------------
> > 3 files changed, 12 insertions(+), 38 deletions(-)
> >
> > diff --git a/runtest/syscalls b/runtest/syscalls
> > index b1125dd75..f999bd74f 100644
> > --- a/runtest/syscalls
> > +++ b/runtest/syscalls
> > @@ -557,10 +557,10 @@ init_module01 init_module01
> >
> > init_module02 init_module02
> >
> > #Needs tty device.
> >
> > -#ioctl01 ioctl01 -D /dev/tty0
> >
> > #ioctl02 ioctl02 -D /dev/tty0
> >
> > # Introducing ioctl tests for all /dev/tty* devices
> >
> > +ioctl01 ioctl01
> >
> > ioctl01_02 test_ioctl
>
> This should be renamed to ioctl02 now I suppose.
>
Right, this should now be the only remaining test in `test_ioctl`.
> >
> > - if (!device)
> > - tst_brk(TBROK, "You must specify a tty device with -D
option");
> > + if (openpty(&amaster, &aslave, NULL, &termios, NULL) < 0) {
> > + tst_brk(TBROK | TERRNO, "unable to open pty");
> > + }
>
> It's better just to pass NULL instead of the zero filled &termios here.
>
Makes sense.
> The rest looks good to me, if you agree I can merge the patch with the
> changes I've proposed.
Yes, go ahead.
More information about the ltp
mailing list