From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4 01/31] lib: Add tst_sysfs_assert
Date: Thu, 3 Sep 2026 17:25:28 +0200 [thread overview]
Message-ID: <20260903152528.GD1107507@pevik> (raw)
In-Reply-To: <20260827112157.1748734-2-chrubis@suse.cz>
Hi Cyril,
FYI more minor formatting notes. There is often conflict that doc readable in
opened file has broken formatting and correct formatting for HTML looks slightly
less readable when opening file. I personally prefer better HTML formatting.
Anyway, whole sysfs library code looks really nice.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
...
> diff --git a/include/tst_sysfs_assert.h b/include/tst_sysfs_assert.h
> +
> +/**
> + * TST_SYSFS_ASSERT_CHOICE() - Asserts that file is a list of choices.
> + *
> + * Validates a bracketed-choice file such as:
> + *
> + * "none mq-deadline kyber [bfq]"
> + * "[always] madvise never"
nit: this is inline, but who cares.
> + *
> + * Asserts that exactly one token is [selected]. If allowed is non-NULL (a
> + * NULL-terminated array of strings) it also asserts that every token is a
> + * member of the allowed set. If sel is non-NULL the selected token (with the
> + * brackets stripped) is copied into sel, truncated to sel_size.
> + *
> + * Skips with TCONF if the file does not exist.
> + *
> + * @allowed: Optional NULL terminated array of allowed choices.
> + * @sel: A buffer to copy the selected choice into.
> + * @sel_size: A size of the sel buffer.
> + * @fmt: A printf-like format to build a path to the file.
> + * @...: A printf-like parameters for fmt.
> + */
> +#define TST_SYSFS_ASSERT_CHOICE(allowed, sel, sel_size, fmt, ...) \
> + tst_sysfs_assert_choice(__FILE__, __LINE__, allowed, sel, sel_size, \
> + fmt, ##__VA_ARGS__)
> +
> +void tst_sysfs_assert_choice(const char *file, const int lineno,
> + const char *const allowed[], char *sel, size_t sel_size,
> + const char *fmt, ...);
> +
> +/**
> + * TST_SYSFS_ASSERT_TOKENS() - Asserts that file is a list of tokens.
> + *
> + * Validates a file that lists a whitespace-separated set of tokens without any
> + * bracketed "current" selection, such as /sys/power/state:
> + *
> + * "freeze mem disk"
> + *
> + * Asserts that the file is non-empty and, if allowed is non-NULL, that every
> + * token is a member of the allowed set (a NULL-terminated array of strings).
> + *
> + * If find is non-NULL it additionally asserts that find itself was seen
> + * among the tokens, which is useful for cross-checking a "current" value
> + * read from a different file against this file's list, e.g.:
> + *
> + * TST_SYSFS_ASSERT_TOKENS(NULL, current_clocksource,
> + * "%s/available_clocksource", name);
But this has completely broken formatting in generated html, looking like:
TST_SYSFS_ASSERT_TOKENS(NULL, current_clocksource,
“%s/available_clocksource”, name);
where first line is bold due tab shift.
=> I'd just before merge put it without tab and put into single line.
* TST_SYSFS_ASSERT_TOKENS(NULL, current_clocksource, "%s/available_clocksource", name);
> + *
> + * Skips with TCONF if the file does not exist.
> + *
> + * @allowed: Optional NULL terminated array of allowed tokens.
> + * @find: Optional token that must be present in the file, or NULL to skip
> + * this check.
> + * @fmt: A printf-like format to build a path to the file.
> + * @...: A printf-like parameters for fmt.
> + */
...
> +void tst_sysfs_assert_list_contains(const char *file, const int lineno,
> + int id, const char *fmt, ...);
> +
> +/**
> + * enum tst_sysfs_cmp - Comparison operators used by tst_sysfs_assert_cmp().
nit: FYI tst_sysfs_assert_cmp() is visible in HTML doc ...
> + *
> + * @TST_SYSFS_CMP_EQ: val1 == val2
> + * @TST_SYSFS_CMP_LT: val1 < val2
> + * @TST_SYSFS_CMP_LE: val1 <= val2
> + */
> +enum tst_sysfs_cmp {
> + TST_SYSFS_CMP_EQ,
> + TST_SYSFS_CMP_LT,
> + TST_SYSFS_CMP_LE,
> +};
> +
... because this has no /** */ documentation.
But I perfectly understand why you did it this way, maybe note macros as well:
/**
* enum tst_sysfs_cmp - Comparison operators used by tst_sysfs_assert_cmp()
* which is used by TST_SYSFS_ASSERT_EQ() and other test macros.
*/
Kind regards,
Petr
> +void tst_sysfs_assert_cmp(const char *file, const int lineno,
> + const char *path1, enum tst_sysfs_cmp op, const char *path2);
...
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-09-03 15:26 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 11:21 [LTP] [PATCH v3 00/31] Add sysfs sanity tests Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 01/31] lib: Add tst_sysfs_assert Cyril Hrubis
2026-09-03 14:57 ` Petr Vorel
2026-09-03 15:08 ` Cyril Hrubis
2026-09-03 15:34 ` Petr Vorel
2026-09-03 15:03 ` Petr Vorel
2026-09-03 15:25 ` Petr Vorel [this message]
2026-08-27 11:21 ` [LTP] [PATCH v4 02/31] testcases: sysfs: Add sys_power01 Cyril Hrubis
2026-08-27 14:04 ` [LTP] lib: Add tst_sysfs_assert linuxtestproject.agent
2026-08-27 11:21 ` [LTP] [PATCH v4 03/31] testcases: sysfs: Add sys_kernel01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 04/31] testcases: sysfs: Add sys_clocksource01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 05/31] testcases: sysfs: Add sys_node01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 06/31] testcases: sysfs: Add sys_cpu_topology01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 07/31] testcases: sysfs: Add sys_cpu_topology02 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 08/31] testcases: sysfs: Add sys_cpu_vulnerabilities01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 09/31] testcases: sysfs: Add sys_cpu_smt01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 10/31] testcases: sysfs: Add sys_cpu_cache01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 11/31] testcases: sysfs: Add sys_clockevents01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 12/31] testcases: sysfs: Add sys_ata01 Cyril Hrubis
2026-09-03 15:59 ` Petr Vorel
2026-08-27 11:21 ` [LTP] [PATCH v4 13/31] testcases: sysfs: Add sys_bdi01 Cyril Hrubis
2026-09-03 16:05 ` Petr Vorel
2026-08-27 11:21 ` [LTP] [PATCH v4 14/31] testcases: sysfs: sys_hwmon01 Cyril Hrubis
2026-09-03 16:21 ` Petr Vorel
2026-08-27 11:21 ` [LTP] [PATCH v4 15/31] testcases: sysfs: sys_leds01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 16/31] testcases: sysfs: Add sys_wakeup01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 17/31] testcases: sysfs: Add sys_rtc01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 18/31] testcases: sysfs: Add sys_thermal01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 19/31] tst_netdevice: Add two more helper macros Cyril Hrubis
2026-09-03 16:43 ` Petr Vorel
2026-08-27 11:21 ` [LTP] [PATCH v4 20/31] testcases: sysfs: Add sys_net01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 21/31] testcases: sysfs: Add sys_net02 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 22/31] testcases: sysfs: Add sys_net03 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 23/31] testcases: sysfs: Add sys_net04 Cyril Hrubis
2026-09-03 17:03 ` Petr Vorel
2026-08-27 11:21 ` [LTP] [PATCH v4 24/31] testcases: sysfs: Add sys_block_loop01 Cyril Hrubis
2026-09-03 17:11 ` Petr Vorel
2026-09-07 15:14 ` Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 25/31] testcases: sysfs: Add sys_block_queue01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 26/31] testcases: sysfs: Add sys_block_size01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 27/31] testcases: sysfs: Add sys_hugepages01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 28/31] testcases: sysfs: Add sys_hugepages02 Cyril Hrubis
2026-09-03 14:44 ` Petr Vorel
2026-09-03 14:49 ` Cyril Hrubis
2026-09-03 15:38 ` Petr Vorel
2026-09-03 17:21 ` Petr Vorel
2026-08-27 11:21 ` [LTP] [PATCH v4 29/31] testcases: sysfs: Add sys_ksm01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 30/31] testcases: sysfs: Add sys_mm_swap01 Cyril Hrubis
2026-08-27 11:21 ` [LTP] [PATCH v4 31/31] testcases: sysfs: Add sys_thp01 Cyril Hrubis
2026-08-28 8:32 ` [LTP] [PATCH v3 00/31] Add sysfs sanity tests Li Wang
2026-09-03 17:24 ` Petr Vorel
2026-09-04 8:44 ` Petr Vorel
2026-09-04 8:44 ` Petr Vorel
2026-09-06 8:38 ` Alejandro Colomar
2026-09-08 8:35 ` Cyril Hrubis
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=20260903152528.GD1107507@pevik \
--to=pvorel@suse.cz \
--cc=chrubis@suse.cz \
--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.