From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8954381AE9 for ; Sun, 31 May 2026 08:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780215790; cv=none; b=r4fwP8eefk9iwRjGyH4/K6KD9vTm+GxARfkP4Yur/4PCnHkp9p9BjslKTKaDAgwN7jczigg19YJSoQDQQY1s9evEZLEI3M9DBlVr7gGFGPy0l9zUzQiQr44fb7SI1sd/jN1N5R2IZw9YV+83JntvsPPq3OdFV2D/uQ/MPiUnFJk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780215790; c=relaxed/simple; bh=v+uQb482xCIMi9HmoWUGu58IjoDszSuB2IlHYCHiaSE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=M3iCmj/oHz2Liz6HSc0qwFq9F2H2T5043qcX6bJ3XWNFKMXPq4GV01moMZcAjJGFcOSfIPRtoLL/0BWXUPI2/zDRLMr+eOz0tX8eXvtXeMjH8/bKk5fVFW9VOwIIjaBf2P7FTxIE3+tjfXW1518UBZ+ucojuPzlulolN15D/a9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=CR4M/5So; arc=none smtp.client-ip=74.125.82.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="CR4M/5So" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-304dd917645so2771136eec.1 for ; Sun, 31 May 2026 01:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780215787; x=1780820587; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=6oWF0bxxyu3W0maVW6LzGoakYua7rlvwmHaeizM/uC8=; b=CR4M/5SoILThJdNb3MApLjEzBblVxIKslyj47ShwTRjPcm4GRVcHBZBFVQ0y6R05c1 jKCqOVNtmNk3n4O+5I4jkiNQS9QfCNCRfuDrc/RsX5MAoy+YYD0lQ1yrJhat1HnQ37E1 HWbstQC+l0524gQM88/IblGfcymJCBoXbPgG/9WpkstqLu27QNGvzbPOYel7jPdxZUDs ufFUucotCtcbBQIgim0Xmvn0DOKTdAHGaZrih1RkhhVVjIetBS3CUZC3M/fJxx5cNUiY kzA5We9q2zdd8ptL/rfowonwDIMIBiD+/zZU6El60rzIxbOzFSINeK3M62GLgnR/G31T bIhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780215787; x=1780820587; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6oWF0bxxyu3W0maVW6LzGoakYua7rlvwmHaeizM/uC8=; b=lb0RbVr2V//wjYy/9rBkCJHoJbyjVOhZdIpKTW4JY3mLW+wFZtL2ATfW8roAMhxr0O ZIXT9Ly3MRmvDt04mp1BOIRzTFzk4G7Fx+Jn9HUVYXx5dsihLaC3665uHLM8uu0vgnIa uxSEfqJ7Eix1WEPjbWvMEpEhFdonf98U9iKS1Y74YqtFfyAwBT+e/tNL2dXZT/7kI71o UPSo6VkB2XqJbpffkS+t8xqtv8APY/30G+PgVjXPOxQbcO3AXZ8BfX0+oxQMozLUSaui SWfxjjEuPGi+Xy9Zj3SKevw6KTiic8FPACQn7qMKFIadbVKDCunqBOZsEyFT0hwxzcE9 XviA== X-Forwarded-Encrypted: i=1; AFNElJ8U5+7Ib9U+44ALX7XZCGLuoE7Vttb2gYY/KhAvCZFjj5QRFBJU8DOZkRubrKIpqidwTAKRUy+fKFyOR7U=@vger.kernel.org X-Gm-Message-State: AOJu0YypY8+teO4QOI4RUn193x7jKyvkrt4swaJaF8v5GjxJn3Wc6O+E KCmy42TXJCYOhAbPrsRR/PHZb2a+mbxhEyOC1MmOu4UIOJvKIju51aGCeZoRoIfTtsnlHVJ59td f96qw73cNCg== X-Received: from dycoz10.prod.google.com ([2002:a05:7301:fc8a:b0:2df:46bf:2390]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:693c:2c0e:b0:304:7a67:6104 with SMTP id 5a478bee46e88-304fa4c8570mr2837817eec.7.1780215786668; Sun, 31 May 2026 01:23:06 -0700 (PDT) Date: Sun, 31 May 2026 01:22:30 -0700 In-Reply-To: <20260531082235.940833-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260531063736.871777-1-irogers@google.com> <20260531082235.940833-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260531082235.940833-11-irogers@google.com> Subject: [PATCH v4 10/15] perf test: Fix subtest status alignment for multi-digit indexes From: Ian Rogers To: irogers@google.com, acme@kernel.org, adrian.hunter@intel.com, namhyung@kernel.org Cc: alexander.shishkin@linux.intel.com, james.clark@linaro.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org Content-Type: text/plain; charset="UTF-8" When running perf test, the status column (: Ok) became misaligned when subtest indexes reached 2 or 3 digits (e.g. 9.100 vs 9.9 vs 10.1). This occurred because the subtest description field width (subw) was statically fixed to width - 2, assuming all subtest index prefixes were exactly 7 characters wide. Dynamically calculate subw based on the exact character length of the test suite and subtest index prefix. This ensures the status column is perfectly aligned vertically across all test outputs regardless of subtest index digit count. Assisted-by: Gemini-CLI:Google Gemini 3 Signed-off-by: Ian Rogers --- tools/perf/tests/builtin-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 336d24105c9f..4c0caa8d0b27 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -373,10 +373,12 @@ static int print_test_result(struct test_suite *t, int curr_suite, int curr_test int result, int width, int running) { if (test_suite__num_test_cases(t) > 1) { - int subw = width > 2 ? width - 2 : width; + char prefix[32]; + int len = snprintf(prefix, sizeof(prefix), "%3d.%1d:", + curr_suite + 1, curr_test_case + 1); + int subw = len >= 4 ? width + 4 - len : width; - pr_info("%3d.%1d: %-*s:", curr_suite + 1, curr_test_case + 1, subw, - test_description(t, curr_test_case)); + pr_info("%s %-*s:", prefix, subw, test_description(t, curr_test_case)); } else pr_info("%3d: %-*s:", curr_suite + 1, width, test_description(t, curr_test_case)); -- 2.54.0.823.g6e5bcc1fc9-goog