From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 64E4C43DA38 for ; Fri, 6 Feb 2026 19:11:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770405100; cv=none; b=PBTk3OrFx/y8iVl/ZrwMPEa0Zq42oR5ozimz4Ey80Uvx1cuAbUQJHWvPawqpi/I9l0NX5F34NieUnmqRGe3C7Ku7NxiDDVidkGzPXyJx5O7L9NdtxiqD1TH3w5Xbbz/HEYgHnLLhjB6JFPUjHdonSMdWd2ECoxlurXx1CNC8MXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770405100; c=relaxed/simple; bh=LzCSpnS6KHne5LXwbimeFYgm5Rn4ghZsTBlrCR+JDZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hsjqB58RAf8twv4WnBQIsS0U3n/hiqv2tqipm0dj8+7KM3iaxIKJNrm3xfDboisnSWc4dFarWifaPe9uCbKn2fTohwKHzmLD+9KF/7lo1dWV7MyHAaNpSAkr6ewfIEGK/LYHF1iaOXswSE55+Z6aQhutPhV6px51a+KlrZ/8+pw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ez2QWAuN; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ez2QWAuN" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4362c635319so734774f8f.2 for ; Fri, 06 Feb 2026 11:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770405099; x=1771009899; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yezK/V+DV7eAtANmUAP6BUQR1mruQQ3bF1ghrg7bvpY=; b=ez2QWAuNFbkRmLiIvdlEYSMihSfxi8NYWj7OnSPX1y/UkaEKTZS+YEaMeQuIloztGT N8W1VWNjl3+JWqS4sqAQV9atgL1HVpo5psHkjJ/QRBC4SAyDClq/ZmzG9Hg1ovFmQEmN MrJBbhS2/f7CA6ZRv0uJousDqrdGr/aEemDKZtQCMVOD119gjrtqD1nmLKS0iRAeuru0 eaz3CADRFhyZG7tDmpUlyKKdHWHoX5APBWc44fBB3rlChX3DV02dvFFGyf2z+dZfLQkk K+4OPmZMhl5qKSUeAxOI3nnUvmZ2Hte5fcv99fnwDSiqe5RI1Me19y0UTR9a9patzZm7 WqsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770405099; x=1771009899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=yezK/V+DV7eAtANmUAP6BUQR1mruQQ3bF1ghrg7bvpY=; b=cyT0FEicW6PC7fo/Ly2iwoZIW1vbVR1PvSt/aDUCXvyAyFeR3+g4BQ7sK4nR+201A+ l48ieV4+TcvwbeMu+lsfQcC9bdLyYRNGEDUpzM1ufAYXUXsaiYBgSUtH0P7EoMmsWQ6p uyuAoopqh9Q/Kf0eraM4Qgn1yqWHdK8RcW2mUXd70uF2hx+NaOftGWeiB7htGNkuDbb+ XkBwRAVBjXq3B0JGcvmdJHtFfPbHn5x+8uEeAc6nrDMXkF381TLJPN16Gl4zMt3ya0FS UeO21jS0sJQyT2DKJJxOcdxVVpkZp6FOSi9m8YGO26ALFr/oVB1WQgNx0zuh+NDhUH7m noEQ== X-Forwarded-Encrypted: i=1; AJvYcCUV65X7i7YElLhuQItSM/w6QuVm3sT8ksCrEbsVQh4W+4Ww+W9e+3LvsnOh6GZWJ9fN0vlRNcjvZR+E9gA=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2hEL3Y8MAgBjMAzHWRVa9+TFewRBrC9HUVUNe7+UeZa0zpik8 ZJqBcNfMzF6UrOYdP9rwYjkn08EQAeIgf0DronkfJ9yPWS2TcwUrrtov X-Gm-Gg: AZuq6aKu2bdzTzl93ntKjC90QAQT27sotpSkduthjQ4y5mKyhOTLlotCu7ZGa0JnwQA pXs2cuD548u5ulsioE7mbzT0gVP7SDVSrhcMGbdmfzBVzzN4NN+U3e5MIZ4hL73R/g9WlcVM7X0 VGfYD7SYDThDDnQxp56+2HnKWsDXPPGxl/sLwn4uljI2id7ZK9e+3Z5dKlnBVSYwxPGF32baHzL JXuYRhGfCLXjo3rjCSg/Bk+hKWng5abkuiDvOa8Mm0hInoyOWv39fP5Cs0WH6F695hYndYNl7Sg q86IeZKXIVBgvHweI4XrQdKISTw9L9SuBDs9KyoEGWEuRBAD//CnMzXFw6cSBt1x6hAaNgsIEk3 WALdQYvXR5u8uuH1p/bpOc9iK4uEX8hu3a9zO6qFYrSuJUnTGxVHF04b6TH7AdgJzoQlOiA1CwC TZ07/0rtoAnmTr2qusEj1r3JkLT3ghrc4hI+fndluZjvqsJI9K8RagP9/WiRSnBiOLcTImfQ56i kGuaHR6tks= X-Received: by 2002:a5d:5f82:0:b0:433:1d30:44c with SMTP id ffacd0b85a97d-4362937b4camr5747841f8f.43.1770405098615; Fri, 06 Feb 2026 11:11:38 -0800 (PST) Received: from snowdrop.snailnet.com (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4362972fb81sm8703681f8f.20.2026.02.06.11.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 11:11:35 -0800 (PST) From: david.laight.linux@gmail.com To: Willy Tarreau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , linux-kernel@vger.kernel.org, Cheng Li Cc: David Laight Subject: [PATCH v2 next 11/11] selftests/nolibc: Use printf("%.*s", n, "") to align output Date: Fri, 6 Feb 2026 19:11:21 +0000 Message-Id: <20260206191121.3602-12-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260206191121.3602-1-david.laight.linux@gmail.com> References: <20260206191121.3602-1-david.laight.linux@gmail.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 From: David Laight Now that printf supports '*' for field widths it can be used to align the "[OK]" strings in the output. Signed-off-by: David Laight --- Changes for v2: - Formally patch 12, unchanged. tools/testing/selftests/nolibc/nolibc-test.c | 21 ++++---------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 10ae6dcd71b8..416d0fd8d85e 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -141,21 +141,6 @@ static const char *errorname(int err) } } -static void align_result(size_t llen) -{ - const size_t align = 64; - char buf[align]; - size_t n; - - if (llen >= align) - return; - - n = align - llen; - memset(buf, ' ', n); - buf[n] = '\0'; - fputs(buf, stdout); -} - enum RESULT { OK, FAIL, @@ -173,8 +158,10 @@ static void result(int llen, enum RESULT r) else msg = " [FAIL]"; - align_result(llen); - puts(msg); + llen = 64 - llen; + if (llen < 0) + llen = 0; + printf("%*s%s\n", llen, "", msg); } /* The tests below are intended to be used by the macroes, which evaluate -- 2.39.5