All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 05/11] Add ptem03 test
Date: Tue, 7 Jan 2025 17:30:45 +0100	[thread overview]
Message-ID: <Z31WtRKdHRTctqPV@yuki.lan> (raw)
In-Reply-To: <20250106-fix_setsid_tests-v2-5-c43f57a2bab6@suse.com>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-01-07 16:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-06 10:31 [LTP] [PATCH v2 00/11] Fix tests failing with setsid Andrea Cervesato
2025-01-06 10:31 ` [LTP] [PATCH v2 01/11] Refactor setpgid01 test Andrea Cervesato
2025-01-07 15:26   ` Cyril Hrubis
2025-01-06 10:31 ` [LTP] [PATCH v2 02/11] Add SAFE_PTSNAME macro Andrea Cervesato
2025-01-07 15:32   ` Cyril Hrubis
2025-01-08 12:01   ` Petr Vorel
2025-01-06 10:31 ` [LTP] [PATCH v2 03/11] Refactor ptem01 test Andrea Cervesato
2025-01-07 16:01   ` Cyril Hrubis
2025-01-08 12:47     ` Petr Vorel
2025-01-06 10:31 ` [LTP] [PATCH v2 04/11] Add ptem02 test Andrea Cervesato
2025-01-07 16:14   ` Cyril Hrubis
2025-01-06 10:31 ` [LTP] [PATCH v2 05/11] Add ptem03 test Andrea Cervesato
2025-01-07 16:30   ` Cyril Hrubis [this message]
2025-01-06 10:31 ` [LTP] [PATCH v2 06/11] Add ptem04 test Andrea Cervesato
2025-01-06 10:31 ` [LTP] [PATCH v2 07/11] Add ptem05 test Andrea Cervesato
2025-01-06 10:31 ` [LTP] [PATCH v2 08/11] Add ptem06 test Andrea Cervesato
2025-01-06 10:31 ` [LTP] [PATCH v2 09/11] Refactor pty01 test Andrea Cervesato
2025-01-08 12:39   ` Petr Vorel
2025-01-09  8:28     ` Andrea Cervesato via ltp
2025-01-06 10:31 ` [LTP] [PATCH v2 10/11] Add pty08 test Andrea Cervesato
2025-01-06 10:31 ` [LTP] [PATCH v2 11/11] Add pty09 test Andrea Cervesato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z31WtRKdHRTctqPV@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.