From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98D59C001B0 for ; Thu, 13 Jul 2023 14:16:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B5E0900026; Thu, 13 Jul 2023 10:16:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 365F990001C; Thu, 13 Jul 2023 10:16:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22D76900026; Thu, 13 Jul 2023 10:16:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 14B0990001C for ; Thu, 13 Jul 2023 10:16:36 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0DFF1C02DD for ; Thu, 13 Jul 2023 14:16:35 +0000 (UTC) X-FDA: 81006789150.04.002F723 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 4EC8540016 for ; Thu, 13 Jul 2023 14:16:31 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y6kQQaL5; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689257791; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=x0eR40eGFRdhvRVhnZQTXXY5c4V+UKpG8qa8PA9yQvw=; b=N3g6Cz4eGtgV34b6rPDpF0YW2ifpnYjEeyub/GkwEgOPnSvzvhXBV1FuIPx/dWlpmvwAZ/ RQXYMPTYI2lX9LZ/npFVmkOQaDsyY6R6AQXHel1v6ZpXB3Hh1tWQeW0lwL+RUm8GayWhh/ XO97DDm/cEfllbLPwPQgMh3ZWj2qJBo= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y6kQQaL5; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of broonie@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=broonie@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689257791; a=rsa-sha256; cv=none; b=X5ftdD/c12GeGGYjqnbUHPJztyE/EgIxLYW8vogRgw95U2WE8QUK8eABIpoj/coaYVzMDv 7l6sAqBvpSt0j7D9cT4xYVu1a1ghgz+AsnTspSOYDuomwoFjSeR/x7LF1ScnidvYWQwAFR uFDN5zh/sYt0kZWC2YLSQ72PFLmWV4M= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 52085611A7; Thu, 13 Jul 2023 14:16:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DCFCC433C7; Thu, 13 Jul 2023 14:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689257789; bh=yZj473BZjtFSxSSsUfNJOsl16FRhfrBduETWUEIiqRA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Y6kQQaL5l5mVf9mwXlHAIk/+VY6NLdr4m2fJ0+HN6mUufSihhFaagXQLvrhA3DXuN 7hMCp77mjxX25DiPIrLzOuIkbCeWzUxcvEtBz3zNU5RBb9e1KBe37xwre9ZVKe5sL9 OMHt5vui6ay1Yo9nojBcJbHtvUJO+xIIDnDBvBsncLNgEe85tGpN4Q2Xh7v5ESpcsj ZJL4l7CpxcjdoFDhDxeR+FWHJ0FsWF/JoZjXcyIHlMCz+qLUjCrspFwbU7f2Yo9wos DJsD2I0KhOQkY4lGz1txyViogH3hhmU9w170l6m5WcvMlTLr/KtFgZPXFKuCrd5FWf JJPMZdi+gBBJw== Date: Thu, 13 Jul 2023 15:16:24 +0100 From: Mark Brown To: Ryan Roberts Cc: Andrew Morton , Shuah Khan , =?iso-8859-1?B?Suly9G1l?= Glisse , David Hildenbrand , John Hubbard , Florent Revest , "Liam R. Howlett" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v1 1/9] selftests: Line buffer test program's stdout Message-ID: <8a8d077c-55bd-4710-9dfd-1cbb1a9170a8@sirena.org.uk> References: <20230713135440.3651409-1-ryan.roberts@arm.com> <20230713135440.3651409-2-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1+oRuEmNeKIqQtgT" Content-Disposition: inline In-Reply-To: <20230713135440.3651409-2-ryan.roberts@arm.com> X-Cookie: MOUNT TAPE U1439 ON B3, NO RING X-Rspam-User: X-Stat-Signature: efwki8rkeyp5n4t153ogbyt7uk65qo7w X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 4EC8540016 X-HE-Tag: 1689257791-192896 X-HE-Meta: U2FsdGVkX1+pT+Xf/aRNDzw3gSjxYnSNqGYdeUmHg8F4Yv+Mp7BzNf8D+ihuknXzTTxtXbeOWld3tDLtYVDGFfWTggEhu3fbTEBLQHkK4c34bCKcLQbjhWxoVLOSdqpj9U/qDPYLHjnwshTsMQrUihyvqwmK6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P0HFJsuCH8CmeXPV648mfQyZ6JQ0mc4HmaWWInH6F3TBU6SY4wZ9C8KJ7NOVIO3Dk7vj4paOVyRog04DwHtsgcqzW9nmj1gmcR6x7ytcq X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --1+oRuEmNeKIqQtgT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 13, 2023 at 02:54:32PM +0100, Ryan Roberts wrote: > The selftests runner pipes the test program's stdout to tap_prefix. The > presence of the pipe means that the test program sets its stdout to be > fully buffered (as aposed to line buffered when directly connected to > the terminal). The block buffering means that there is often content in > the buffer at fork() time, which causes the output to end up duplicated. > This was causing problems for mm:cow where test results were duplicated > 20-30x. >=20 > Solve this by using `stdbuf`, when available to force the test program > to use line buffered mode. This means previously printf'ed results are > flushed out of the program before any fork(). This is going to be useful in general since not all selftests use the kselftest helpers but it'd probably also be good to make ksft_print_header() also make the output unbuffered so that if setbuf isn't installed on the target system or the tests are run standalone we don't run into issues there. Even if the test isn't corrupting data having things unbuffered is going to be good for making sure we don't drop any output if the test dies. > + if [ -x /usr/bin/stdbuf ]; then > + stdbuf=3D"/usr/bin/stdbuf --output=3DL " > + fi Might be more robust to use type -p to find stdbuf in case it's in /bin or something? --1+oRuEmNeKIqQtgT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmSwBzcACgkQJNaLcl1U h9AB3Qf+LhTlPox4ghR+y8/9Tm4CFlMNRleBzmfEDcafaj6y1aFYXP9Lla5vs6HT DziBkUJB3jmvW7gNDYMT0xrVxHampqA52kjYLlg6Z/dRFHttU+pxZ5cHIRvZDEfn vfsHkr0nUGx94gRLvJTdAUR2Q31EraO7h7jwL1Q3TJuE19VhzQcc4SVif8D8I+Ul JNUu9UusPMcfJVUX5NTWFQsxovITYR2RFlY4PpPMn7zmtiRTzaJrybA6reF0JYSs HDXcmwF7t2DZWpJIyYoNYmAxDOdODMynYs0NBKPftSti5Bnxb1MH9qkN1BEj82rO sveDxDVGKTNkb4HhNhzYzf8bb3tunQ== =hm+s -----END PGP SIGNATURE----- --1+oRuEmNeKIqQtgT--