public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/7] Refactor input01 test
Date: Mon, 2 Dec 2024 16:15:21 +0100	[thread overview]
Message-ID: <20241202151521.GC321427@pevik> (raw)
In-Reply-To: <20241202-input_refactoring-v2-1-369609492896@suse.com>

Hi Andrea,

I would mention adding a check of the device name in /sys/devices
create_input_device(), because that modifies also a different test
(../uevents/uevent03.c).

> ---
>  libs/uinput/tst_uinput.c              |  26 ++++-
>  testcases/kernel/input/Makefile       |   5 +-
>  testcases/kernel/input/input01.c      | 205 ++++++++--------------------------
>  testcases/kernel/input/input_common.h |  97 ++++++++++++++++
>  4 files changed, 173 insertions(+), 160 deletions(-)

...
> +static void check_ui_get_sysname_ioctl(int fd)
> +{
> +	char sys_name[256];
> +	char dev_name[256];
> +	char *path;
> +
> +	SAFE_IOCTL(fd, UI_GET_SYSNAME(sizeof(sys_name)), sys_name, NULL);
> +	SAFE_ASPRINTF(&path, "/sys/devices/virtual/input/%s/name", sys_name);
> +
> +	if (FILE_SCANF(path, "%s", dev_name)) {
> +		tst_brk(TBROK|TERRNO, "Failed to read '%s'", path);
> +		free(path);
I guess free(path) here is not needed due exit() via tst_brk() right?
And if it's needed, you meant to first free and then tst_brk().

> +		return;
> +	}
> +
> +	if (strcmp(VIRTUAL_DEVICE, dev_name))
And if I'm wrong, then free(path) should be also here.
> +		tst_brk(TBROK, "ioctl UI_GET_SYSNAME returned wrong name");

The rest LGTM, nice cleanup (free can be fixed before merge).

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

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

  reply	other threads:[~2024-12-02 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02 10:12 [LTP] [PATCH v2 0/7] Rewrite input testing suite Andrea Cervesato
2024-12-02 10:12 ` [LTP] [PATCH v2 1/7] Refactor input01 test Andrea Cervesato
2024-12-02 15:15   ` Petr Vorel [this message]
2024-12-02 10:12 ` [LTP] [PATCH v2 2/7] Refactor input02 test Andrea Cervesato
2024-12-02 10:12 ` [LTP] [PATCH v2 3/7] Refactor input03 test Andrea Cervesato
2024-12-02 10:12 ` [LTP] [PATCH v2 4/7] Refactor input04 test Andrea Cervesato
2024-12-02 10:12 ` [LTP] [PATCH v2 5/7] Refactor input05 test Andrea Cervesato
2024-12-02 10:12 ` [LTP] [PATCH v2 6/7] Refactor input06 test Andrea Cervesato
2024-12-03 11:34   ` Cyril Hrubis
2024-12-03 11:43     ` Andrea Cervesato via ltp
2024-12-02 10:12 ` [LTP] [PATCH v2 7/7] Delete depreacted input test suite helper Andrea Cervesato
2024-12-03 11:49 ` [LTP] [PATCH v2 0/7] Rewrite input testing suite Andrea Cervesato via ltp

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=20241202151521.GC321427@pevik \
    --to=pvorel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox