From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Authentication-Results: gnuweeb.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gnuweeb.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=cynU8Xf5; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=srs0=rfi9=ca=paulmck-thinkpad-p17-gen-1.home=paulmck@kernel.org; receiver= Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gnuweeb.org (Postfix) with ESMTPS id 0C409249B33 for ; Tue, 13 Jun 2023 03:45:21 +0700 (WIB) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E99E62B36; Mon, 12 Jun 2023 20:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D24D3C4339B; Mon, 12 Jun 2023 20:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686602716; bh=0qJdSevT2VoXww6IrwA93sMpGwJeGq5YXuzo0c9WoWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cynU8Xf5FJnDfOAnabitMNyvFJkhhcCXHGbcwxntjMwhbsKshbGgNoH6S6n1gP6xl 2CEU0PsJNg2qXIAHRRyrtYLFch/0YwNigLS/6IjQdmdi6kb6mWC/41AhG+zTD6iTe3 Ixc7CdRDTH/5abH3RDFKoY9KTjzhmGOU3s12ZqYkfwBmu3/MuUSz+C7rAeOF7L0oKP w2eT32B/0NNyTloYi7f+oCv2VvLfqylDGnY0SJJCpEUZR8BAjeiYoLEMhkXzq+I+kx TS4EoDAoBI8M3vdVmpC5t5XvPaWiUcfvoK5Kt369lCYpNE2VVIxAB6d+s77KPcTXj2 QEy8hQ149y68g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D42B3CE3A5C; Mon, 12 Jun 2023 13:45:15 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: gwml@vger.gnuweeb.org, kernel-team@meta.com, w@lwt.eu, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Willy Tarreau , "Paul E . McKenney" Subject: [PATCH v2 nolibc 19/53] selftests/nolibc: reduce syscalls during space padding Date: Mon, 12 Jun 2023 13:44:40 -0700 Message-Id: <20230612204514.292087-19-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> References: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: From: Thomas Weißschuh Previously each space character used for alignment during test execution was written in a single write() call. This would make the output from strace fairly unreadable. Coalesce all spaces into a single call to write(). Signed-off-by: Thomas Weißschuh Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- tools/testing/selftests/nolibc/nolibc-test.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index 0e2ee513b273..d5d4dea63cd6 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -111,19 +111,26 @@ const char *errorname(int err) } } +static void putcharn(char c, size_t n) +{ + char buf[64]; + + memset(buf, c, n); + buf[n] = '\0'; + fputs(buf, stdout); +} + static int pad_spc(int llen, int cnt, const char *fmt, ...) { va_list args; - int len; int ret; - for (len = 0; len < cnt - llen; len++) - putchar(' '); + putcharn(' ', cnt - llen); va_start(args, fmt); ret = vfprintf(stdout, fmt, args); va_end(args); - return ret < 0 ? ret : ret + len; + return ret < 0 ? ret : ret + cnt - llen; } /* The tests below are intended to be used by the macroes, which evaluate -- 2.40.1