From nobody Mon Jun 8 04:20:20 2026 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (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 4F77730FC1B for ; Tue, 2 Jun 2026 07:32:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780385528; cv=none; b=HP+Hakeg59LIfqzpLDMh/B6hHwY90VReSLvr2xIyx/e7IqqqkyGZTbfx1OTWirtoUhbBAgEdvccN6EMiSPQse+LfCG3TL33pPUmXj8JrZZzZm+0G0ShPAkJhNNXSOevzlvwTRmWrNOTu9a7W0l/vZXu8uIc/iANDSkuttJEAD1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780385528; c=relaxed/simple; bh=lkZjuQfapU/7rQCDqcTy+kcBh+0vHyjvzR7VJqhjEBc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RxRLb/b8LUM6ap+6uCLKCrUwe4AA4VpIBtWABDIjMa3Y/qCrOdLkHIhwdKrRGbYhBaUpSTtIuAx1fJ4X3V4g0c8MOrA7rKsTd6JVm/xQQCZpqMN2SCdf8363qvFjzeHIHtBnJlV0WqB3zhwsSpdSpa15b70tqVwyVgIa5imLStw= 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=mTcRltQy; arc=none smtp.client-ip=74.125.82.73 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="mTcRltQy" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-137dd516985so3760942c88.1 for ; Tue, 02 Jun 2026 00:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780385522; x=1780990322; 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=0s4ZMEM0Y1byVlQvSdV4cQcn8spi48hn9wCUoI5QRmQ=; b=mTcRltQyrh+7++zmlLVvnUBmnO8PavdxbbWakd9W0Nb/IhklRKzxziargqAG2GrZ4z DailMU6Ck3o6VnfqRsCmrZYZfMZGvtcCTcXE4x2tXfFVgqCMwgmepmQ5+bokdGt0pbgq JWQDC+AzV2OxjSPle+bQ/Z3ZM2Xsl2lhes2LkwPVh/bLuP7ki/11NmvaNrQtuH6UrtN+ 3rqohAaus7JE6R/bpt0MbBJ6ENVnZCLDJGySD/O2iJWE7uy7/ZVJq54cOzfPQQ/h/Zhx M/uXWtSY0Q/TzRO0Pdt1H7CAKRjS02Xx3LVlXSCO7hPiFrfYSwGGy2CSMTDUT0oEuypH a/AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780385522; x=1780990322; 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=0s4ZMEM0Y1byVlQvSdV4cQcn8spi48hn9wCUoI5QRmQ=; b=cqy3XQ8729w/cUjLsBByA7yEMdxOomr4eMJiAsnFODbwIjdTVp+c0Ln2+jCxgLlYbf mVJAfYPZ3wLJvY9cLJCq9H9ZCJcogtCQLM2ys4eFYFRFhjgUBoRJEo81G+htzHnkmKWr S9TM9OeMMVdUu55kbb9Un5bs+5LSctAbb0ty4pwoq9Pw46GQedXoi4kyQhgjzfcWL8gl g4Slop1FSev7PozF7W25r7Bv/gDDy16T2qQtcn3E7MspGJLpYu1Z8Y4JKEVeyVpNzCcR /pj4KThXbu8Z1I80rBY/ZywuZWy31XohwBoksiQo7lLWvQ2oRSnE3dlr38u51fkMSQ94 a3fg== X-Forwarded-Encrypted: i=1; AFNElJ9jmUyWo+RgyEaY8grPT6i2SnoRorB/CZ5BzaNx9JgmX6l9OE3hOkxNGjAwLHF/gp7gZbVPo1DfvwNBosk=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1KHN44zFkVd64suo/xbbJ8B7PETYfCku0bZ0UPTWYXsIooFK6 mNFTcTow3yhPIsShyctLdjAaCnU2Mz4Zh3au1CtIxAQQsCKgnjXaEPPdoyBoxo75RBI/DOs9xfq QOgmgpHvZLA== X-Received: from dlbvg16.prod.google.com ([2002:a05:7022:7f10:b0:137:ed01:78c3]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:527:b0:135:a6a:fcb9 with SMTP id a92af1059eb24-137d424acecmr6305837c88.28.1780385522003; Tue, 02 Jun 2026 00:32:02 -0700 (PDT) Date: Tue, 2 Jun 2026 00:31:26 -0700 In-Reply-To: <20260602073132.2653307-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: <20260601061401.1541457-1-irogers@google.com> <20260602073132.2653307-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.929.g9b7fa37559-goog Message-ID: <20260602073132.2653307-12-irogers@google.com> Subject: [PATCH v7] perf test: Fix subtest status alignment for multi-digit indexes From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org Cc: adrian.hunter@intel.com, 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-Transfer-Encoding: quoted-printable 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-tes= t.c index f6bb876a271d..486f563ec04f 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, in= t curr_suite, int curr_test int result, int width, int running) { if (test_suite__num_test_cases(t) > 1) { - int subw =3D width > 2 ? width - 2 : width; + char prefix[32]; + int len =3D snprintf(prefix, sizeof(prefix), "%3d.%1d:", + curr_suite + 1, curr_test_case + 1); + int subw =3D len >=3D 4 ? width + 4 - len : width; =20 - 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_te= st_case)); =20 --=20 2.54.0.929.g9b7fa37559-goog