[LTP] [PATCH v2 05/11] Add ptem03 test
Cyril Hrubis
chrubis@suse.cz
Tue Jan 7 17:30:45 CET 2025
Hi!
> +static void run(void)
> +{
> + int masterfd, slavefd;
> + char *slavename;
> +
> + masterfd = SAFE_OPEN(MASTERCLONE, O_RDWR);
> + slavename = SAFE_PTSNAME(masterfd);
> +
> + TST_EXP_PASS(grantpt(masterfd));
> + TST_EXP_PASS(unlockpt(masterfd));
> +
> + slavefd = SAFE_OPEN(slavename, O_RDWR);
This is being repeated in each test so it should be really put into the
test setup function and the function should be put into a common header
and included in all the tests.
> + TST_EXP_PASS(tcsendbreak(masterfd, 10));
> + TST_EXP_PASS(tcsendbreak(slavefd, 10));
Here you are using the TST_EXP_PASS() correctly.
> + SAFE_CLOSE(slavefd);
> + SAFE_CLOSE(masterfd);
> +}
> +
> +static void setup(void)
> +{
> + if (access(MASTERCLONE, F_OK))
> + tst_brk(TBROK, "%s device doesn't exist", MASTERCLONE);
> +}
> +
> +static struct tst_test test = {
> + .test_all = run,
> + .setup = setup,
> +};
>
> --
> 2.43.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list