From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4527734C98C for ; Fri, 14 Aug 2026 13:55:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786715762; cv=none; b=byIG56RhF9tIUDmAJSFLFky8aGk+QF5egmaGQ/XiD6mJ0xogxZhdQLf+2xfuuSlpqvssxeMdy+i6Xl1mBsXYpOsmol5JdY7mRQCDV8NwWZ6ZACFdAD+zMUMIXcA2LzyqnAdJ1WOS0oWbc2ISURoNFIW6t6dCadowFtE22Msj1Rc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786715762; c=relaxed/simple; bh=Y/5SyS3gwj9KjuvhfhI5U5SNRgbHxgZHdzwTve78Emo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PuGPKAv88yhQ+toGMjFgi4+Cq5pE4QWQPxMlZqG5lS7k0EdCLuKdeZddHcOnWLYbT1Q+rYLP1Q4u1JmI8CBofxR8ZWo/HDnCxbFKT6lSMDz28JFgKD6y6sz6Ad2dc72cdtOAxWg8XyvF66xiKHBDzITq8wY76QS04Qy9mEawimM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=OtSxoXiu; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OtSxoXiu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786715756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qwll/rx1QVHE0RLr1ij+LcJY3pppLEwm58AIGj5D33k=; b=OtSxoXiufw/8EZqjoc11wHFgFxUocuROG1mYbmc1DiVPubxOe+sDh9oXxXYbrP/mxiFDuz msfTOoYWp9F1AGI1mB79oj/ndPPQFrqKhVBLzPgEvaHR5ZrMNGTB/MxB5oxnHpwBBaf+0i oxhGsil+q4+XOC5SRhiEi8Aj6dZ5+io= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-634-T1c88Km9M9GqnCtG3iDVPQ-1; Fri, 14 Aug 2026 09:55:52 -0400 X-MC-Unique: T1c88Km9M9GqnCtG3iDVPQ-1 X-Mimecast-MFC-AGG-ID: T1c88Km9M9GqnCtG3iDVPQ_1786715751 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3D9A619560A5; Fri, 14 Aug 2026 13:55:51 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.44.33.92]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ECBCA18005AC; Fri, 14 Aug 2026 13:55:47 +0000 (UTC) From: Tomas Glozar To: Steven Rostedt , Tomas Glozar Cc: John Kacur , Luis Goncalves , Crystal Wood , Costa Shulyupin , Wander Lairson Costa , LKML , linux-trace-kernel Subject: [PATCH 5/5] rtla/tests: Add unit test for get_max_cpu_from_list() Date: Fri, 14 Aug 2026 15:55:11 +0200 Message-ID: <20260814135511.2207190-6-tglozar@redhat.com> In-Reply-To: <20260814135511.2207190-1-tglozar@redhat.com> References: <20260814135511.2207190-1-tglozar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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 --- 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