From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.201]) (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 F26BC35201A for ; Mon, 1 Jun 2026 06:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780294513; cv=none; b=YvjJzNyMQtn/5MwsTe41/zJbkkK/V3jlKFHA6CjWG12rHBUXEvKD8UpfrEuUX35AIIUFaUo7HAf7bnIMEsSyOQoLq+c51FScABo+8MSnQkhw0QkAwOTMD6Euqx9QwiAAdenAKc+eHzE9hanhOBecJwVD5nZaj6aFX3bHyVM5heo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780294513; c=relaxed/simple; bh=8waMYaO+HJEdf4Jsh7fOhLGsToyK3/iv8rrPaQu7dUY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=J6MtRnuApHTMItXScW5qnmIuN0Ab/KjBJKjXsXsL2xIK5Vvv/CFD2H25C25MzRSGk19n3ks+oTrNwug+pZ+3GU6nUJ8xJTw9C+cNkSJVES9g7yrCKfCGG+4+FnfkVjBBOAR77hpuCE35vpyi+R2ReeMJqk/35DKmruVUwCElnTs= 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=cFZtXcUq; arc=none smtp.client-ip=74.125.82.201 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="cFZtXcUq" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-304b8d0ee63so7146602eec.0 for ; Sun, 31 May 2026 23:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780294508; x=1780899308; 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=QLEPpLWQzQYXyEDs9j46jC0xi/4l49hyU3bhvVE8/NU=; b=cFZtXcUqG5GfNTzQegSEKi9T/pVNlpWY26WIe4JL4X8uixqI33hxJ0GLHOk38PDDto f3eEhjaj7y6DsbPwcMbsqCe3nyyO/iTO4NvEyabjkVtoOvADbzyrDmxp5A01y/Xsli8o xbuBLetn+kA/gH71eaCD7JrtgyroVgGJ6wA1Y6AnfPdv2cx6nh9eiC2qwiheyqKvGxz1 gq6h1yTBqGJmQ67OC5rm6UzpgB4ZagDmzARAX2Re4RFZDwMb5aPKia8FbIoQDffdOd25 KHu7GsWN6OzVxbZGndWE7SMoNGfawBx6oJ6JMnZjhME+jl75So72Q8uDss86skVIVlBQ wk3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780294508; x=1780899308; 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=QLEPpLWQzQYXyEDs9j46jC0xi/4l49hyU3bhvVE8/NU=; b=DnYIKYuzDHwP2Ff4NZmcWJk1Yvl9a0ZYaydX0v+eobAW/Nuw2qMrkYrwrYfFSn70VB TBgbb6tVA0TWhxTuW8QhmiNspgu5vikfoA5E5IMySK0REYe06oOLyv7xozBXdnCyrKeC afn1JWWIJ0Mglpn2yrHlRRtYhD0k3ffJvlagZn4w8XIeq8tGCmt3Q9tYpLWIyNgsuTh1 ooz1omzqUWaD4HLS57NZhlxOmx81IPyl+SbzgWwEq42Miam7JGASXGcOeOJ2spiNaL1d EUdL8w+Cb2vvbss1LmlNvcV8sCuUlP6t6GLKJvXs9/XdleT1xcNOCE+k9pwa1RBKoEQ7 26Yg== X-Forwarded-Encrypted: i=1; AFNElJ8VbfLoDSc/EH31pbCJa5n+BKeRnA+cXYC5//jsW71rN2YbHAUGR4CKilTO/b8qCNbW/EjHb3An+RWeJcQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyuaLaW3sNWNPR8rCjzvOOzYnsKrHTaQZLA1IaI5D4xbgM1cGC7 5Vkvky/UayekGbwOP/PGPL/jrEB9ixC99Cgi3BkOv8iPWhzA1JYHHmZ2I5EZYz6IbX14UN2t/QM kTookyfPKzg== X-Received: from dyay11.prod.google.com ([2002:a05:693c:62cb:b0:304:eefd:96c6]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:7495:b0:304:dd1c:737e with SMTP id 5a478bee46e88-304fa5a84aamr4700818eec.16.1780294507717; Sun, 31 May 2026 23:15:07 -0700 (PDT) Date: Sun, 31 May 2026 23:13:56 -0700 In-Reply-To: <20260601061401.1541457-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: <20260601000548.1195604-1-irogers@google.com> <20260601061401.1541457-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260601061401.1541457-11-irogers@google.com> Subject: [PATCH 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 5d319b9da762..e4998a4472ec 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -376,10 +376,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