From: Tomas Glozar <tglozar@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>, Tomas Glozar <tglozar@redhat.com>
Cc: John Kacur <jkacur@redhat.com>,
Luis Goncalves <lgoncalv@redhat.com>,
Crystal Wood <crwood@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>,
Wander Lairson Costa <wander@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-trace-kernel <linux-trace-kernel@vger.kernel.org>
Subject: [PATCH 5/5] rtla/tests: Add unit test for get_max_cpu_from_list()
Date: Fri, 14 Aug 2026 15:55:11 +0200 [thread overview]
Message-ID: <20260814135511.2207190-6-tglozar@redhat.com> (raw)
In-Reply-To: <20260814135511.2207190-1-tglozar@redhat.com>
The get_max_cpu_from_list() function is used when parsing osnoise cpus
"all" value. Furthermore, the callback used by it is also used in
get_possible_cpus().
Add unit test to cover it.
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
tools/tracing/rtla/tests/unit/utils.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/tracing/rtla/tests/unit/utils.c b/tools/tracing/rtla/tests/unit/utils.c
index 0cb5e217c56eb..cdd84ff895f86 100644
--- a/tools/tracing/rtla/tests/unit/utils.c
+++ b/tools/tracing/rtla/tests/unit/utils.c
@@ -95,6 +95,14 @@ START_TEST(test_cpu_list_iterate)
}
END_TEST
+START_TEST(test_get_max_cpu_from_list)
+{
+ ck_assert_int_eq(get_max_cpu_from_list("1,2,3,4-60"), 60);
+ ck_assert_int_eq(get_max_cpu_from_list("2,1-7,4"), 7);
+ ck_assert_int_eq(get_max_cpu_from_list("invalid"), -1);
+}
+END_TEST
+
START_TEST(test_parse_cpu_set)
{
cpu_set_t set;
@@ -160,6 +168,7 @@ Suite *utils_suite(void)
tcase_add_test(tc, test_strtoi);
tcase_add_test(tc, test_cpu_list_iterate);
+ tcase_add_test(tc, test_get_max_cpu_from_list);
tcase_add_test(tc, test_parse_cpu_set);
tcase_add_test(tc, test_parse_prio);
--
2.55.0
next prev parent reply other threads:[~2026-08-14 13:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 13:55 [PATCH 0/5] rtla: Implement more robust nr_cpus handling Tomas Glozar
2026-08-14 13:55 ` [PATCH 1/5] rtla: Replace get_nprocs_conf() with sysfs possible cpus Tomas Glozar
2026-08-14 13:55 ` [PATCH 2/5] rtla: Discard trace entries with cpu >= nr_cpus Tomas Glozar
2026-08-14 14:02 ` sashiko-bot
2026-08-14 13:55 ` [PATCH 3/5] rtla: Abort on nr_cpus mismatch with tracer Tomas Glozar
2026-08-14 13:55 ` [PATCH 4/5] rtla/tests: Add unit test for cpu_list_iterate() Tomas Glozar
2026-08-14 13:55 ` Tomas Glozar [this message]
2026-08-14 14:30 ` [PATCH 0/5] rtla: Implement more robust nr_cpus handling Steven Rostedt
2026-08-14 17:49 ` Tomas Glozar
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=20260814135511.2207190-6-tglozar@redhat.com \
--to=tglozar@redhat.com \
--cc=costa.shul@redhat.com \
--cc=crwood@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=wander@redhat.com \
/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