All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Cervesato <andrea.cervesato@suse.de>
To: Linux Test Project <ltp@lists.linux.it>
Subject: [LTP] [PATCH v2 4/9] include: Document assertion API macros
Date: Fri, 11 Sep 2026 09:04:20 +0200	[thread overview]
Message-ID: <20260911-fix_documentation-v2-4-716b2613c477@suse.com> (raw)
In-Reply-To: <20260911-fix_documentation-v2-0-716b2613c477@suse.com>

From: Andrea Cervesato <andrea.cervesato@suse.com>

Add kernel-doc comments for the public assertion macros in
include/tst_assert.h to populate the Assertion section in the generated
C API documentation.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
 include/tst_assert.h | 85 ++++++++++++++++++++++++++++++++++------------------
 1 file changed, 56 insertions(+), 29 deletions(-)

diff --git a/include/tst_assert.h b/include/tst_assert.h
index dcb62dfea..e952f612f 100644
--- a/include/tst_assert.h
+++ b/include/tst_assert.h
@@ -7,58 +7,85 @@
 #ifndef TST_ASSERT_H__
 #define TST_ASSERT_H__
 
+/**
+ * TST_ASSERT_INT() - Asserts that integer value in file equals val.
+ *
+ * @path: Path to the file to check.
+ * @val: Expected integer value.
+ *
+ * Reads an integer from the file at path and compares it to val.
+ * Reports :c:enum:`TPASS <tst_res_flags>` on match, or
+ * :c:enum:`TFAIL <tst_res_flags>` on mismatch.
+ */
 #define TST_ASSERT_INT(path, val) \
 	tst_assert_int(__FILE__, __LINE__, path, val)
 
-/*
- * Asserts that integer value stored in file pointed by path equals to the
- * value passed to this function. This is mostly useful for asserting correct
- * values in sysfs, procfs, etc.
- */
 void tst_assert_int(const char *file, const int lineno,
 		    const char *path, int val);
 
+/**
+ * TST_ASSERT_FILE_INT() - Asserts that integer value for field in file equals val.
+ *
+ * @path: Path to the file to check.
+ * @prefix: Field name or line prefix preceding the integer value.
+ * @val: Expected integer value.
+ *
+ * Scans lines in path for prefix followed by an integer.
+ * Reports :c:enum:`TPASS <tst_res_flags>` on match, or
+ * :c:enum:`TFAIL <tst_res_flags>` on mismatch.
+ */
 #define TST_ASSERT_FILE_INT(path, prefix, val) \
 	tst_assert_file_int(__FILE__, __LINE__, path, prefix, val)
 
-/*
- * Same as tst_assert_int() but for unsigned long.
- */
-void tst_assert_ulong(const char *file, const int lineno,
-                      const char *path, unsigned long val);
+void tst_assert_file_int(const char *file, const int lineno,
+			 const char *path, const char *prefix, int val);
 
+/**
+ * TST_ASSERT_ULONG() - Asserts that unsigned long value in file equals val.
+ *
+ * @path: Path to the file to check.
+ * @val: Expected unsigned long value.
+ *
+ * Reads an unsigned long from the file at path and compares it to val.
+ * Reports :c:enum:`TPASS <tst_res_flags>` on match, or
+ * :c:enum:`TFAIL <tst_res_flags>` on mismatch.
+ */
 #define TST_ASSERT_ULONG(path, val) \
 	tst_assert_ulong(__FILE__, __LINE__, path, val)
 
-/*
- * Asserts that integer value stored in the prefix field of file pointed by path
- * equals to the value passed to this function. This is mostly useful for
- * asserting correct field values in sysfs, procfs, etc.
- */
-
-void tst_assert_file_int(const char *file, const int lineno,
-			 const char *path, const char *prefix, int val);
-
+void tst_assert_ulong(const char *file, const int lineno,
+		      const char *path, unsigned long val);
 
+/**
+ * TST_ASSERT_STR() - Asserts that string value in file equals val.
+ *
+ * @path: Path to the file to check.
+ * @val: Expected string value.
+ *
+ * Reads a whitespace-delimited string from path and compares it to val.
+ * Reports :c:enum:`TPASS <tst_res_flags>` on match, or
+ * :c:enum:`TFAIL <tst_res_flags>` on mismatch.
+ */
 #define TST_ASSERT_STR(path, val) \
 	tst_assert_str(__FILE__, __LINE__, path, val)
 
-/*
- * Asserts that a string value stored in file pointed by path equals to the
- * value passed to this function. This is mostly useful for asserting correct
- * values in sysfs, procfs, etc.
- */
 void tst_assert_str(const char *file, const int lineno,
 		    const char *path, const char *val);
 
+/**
+ * TST_ASSERT_FILE_STR() - Asserts that string value for field in file equals val.
+ *
+ * @path: Path to the file to check.
+ * @prefix: Field name or prefix preceding the string value.
+ * @val: Expected string value.
+ *
+ * Scans lines in path for prefix followed by ": " and a string value.
+ * Reports :c:enum:`TPASS <tst_res_flags>` on match, or
+ * :c:enum:`TFAIL <tst_res_flags>` on mismatch.
+ */
 #define TST_ASSERT_FILE_STR(path, prefix, val) \
 	tst_assert_file_str(__FILE__, __LINE__, path, prefix, val)
 
-/*
- * Asserts that a string value stored in the prefix field of file pointed by path
- * equals to the value passed to this function. This is mostly useful for
- * asserting correct field values in sysfs, procfs, etc.
- */
 void tst_assert_file_str(const char *file, const int lineno,
 			 const char *path, const char *prefix, const char *val);
 

-- 
2.51.0


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

  parent reply	other threads:[~2026-09-11  7:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  7:04 [LTP] [PATCH v2 0/9] doc: Improve and fix documentation and API comments Andrea Cervesato
2026-09-11  7:04 ` [LTP] [PATCH v2 1/9] doc: Fix examples and generated links Andrea Cervesato
2026-09-11  7:04 ` [LTP] [PATCH v2 2/9] doc: Correct guide and API descriptions Andrea Cervesato
2026-09-11 10:59   ` Petr Vorel
2026-09-11  7:04 ` [LTP] [PATCH v2 3/9] doc: Clarify API coverage and navigation Andrea Cervesato
2026-09-11  7:04 ` Andrea Cervesato [this message]
2026-09-11 11:10   ` [LTP] [PATCH v2 4/9] include: Document assertion API macros Petr Vorel
2026-09-11  7:04 ` [LTP] [PATCH v2 5/9] include: Document filesystem test utilities Andrea Cervesato
2026-09-11 11:19   ` Petr Vorel
2026-09-11  7:04 ` [LTP] [PATCH v2 6/9] include: Document memory " Andrea Cervesato
2026-09-11 11:39   ` Petr Vorel
2026-09-11  7:04 ` [LTP] [PATCH v2 7/9] include: Document safe file operations Andrea Cervesato
2026-09-11  7:04 ` [LTP] [PATCH v2 8/9] doc: Document CPU and common test helpers Andrea Cervesato
2026-09-11 11:56   ` Petr Vorel
2026-09-11  7:04 ` [LTP] [PATCH v2 9/9] include: Fix API comment spelling and style Andrea Cervesato
2026-09-11 12:21   ` Petr Vorel
2026-09-11 12:34 ` [LTP] [PATCH v2 0/9] doc: Improve and fix documentation and API comments Andrea Cervesato via ltp
2026-09-11 13:06 ` 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=20260911-fix_documentation-v2-4-716b2613c477@suse.com \
    --to=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.