From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BD05277035 for ; Wed, 15 Apr 2026 15:59:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776268758; cv=none; b=XTDgBjq0xcas75qXHe0DYyvcbD9oibbv1VUUsIW0tL7yaqST1aSoG5PeU5tBIQ0vHQaqxlu3WVDRsNtb2dpLlvv3CwU0ublL6E0GnyUmCKjRejdwZseOxxwOIEQIIJ1Zf5aDFihfzAkDbCWRGGrcNURbNlbPtmRq1xJk3OneKIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776268758; c=relaxed/simple; bh=X789CuLsHOm4HibNeKqiYa8QV17bn2RUULIhIah3is0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hYlfCRlitifzjUhuDvNM3P/jcrLjoTmwmofRralC/MLiRN+xDssuGr4DETSbCkQ5VWAt+TvA5MznNIDgTcOE/RxHTiiSxWUD7aNjcYPBrdpbzjKWOOs++Tz2k3GHHt9vgBghPavMgJRjN7bdifvV/Vt8Z2hl5R7SLd8sSPKKr9w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=iVeJ5PHk; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="iVeJ5PHk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1776268755; bh=X789CuLsHOm4HibNeKqiYa8QV17bn2RUULIhIah3is0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iVeJ5PHkQt6wVrU1f/J/KnJ00oWxma7kV4yRWYXyhC0HGxY5L/MgrlB6A3E2fJbva /EtOxTgXSQwq/tP90LbHL2eE/xCBbb01k07wAfFsVlN9OiiRrS7QSlte3XtanA/2qi YBbRg+UC/Ps0c7Hx1Xw5PP0l/WKctkqCWi8ERk6M= Date: Wed, 15 Apr 2026 17:59:14 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Daniel Palmer Cc: w@1wt.eu, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] selftests/nolibc: Add a very basic test for fallocate() Message-ID: <617cdc58-4589-42f4-a30c-49108941e5c8@t-8ch.de> References: <20260415143225.561998-1-daniel@thingy.jp> <20260415143225.561998-3-daniel@thingy.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260415143225.561998-3-daniel@thingy.jp> On 2026-04-15 23:32:25+0900, Daniel Palmer wrote: > Create a tmp file, fallocate() to make it a bit bigger, check the > size is what was expected. > > Signed-off-by: Daniel Palmer > --- > tools/testing/selftests/nolibc/nolibc-test.c | 33 ++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > index d3c4facb54c0..066f436561e7 100644 > --- a/tools/testing/selftests/nolibc/nolibc-test.c > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > @@ -896,6 +896,38 @@ int test_getpagesize(void) > return !c; > } > > +int test_fallocate(void) > +{ > + struct stat st; > + int fd, r; > + > + /* Create a new tmp file */ > + fd = open("/tmp", O_TMPFILE | O_RDWR, 0644); > + if (fd == -1) > + return -1; > + > + /* Expand it to 42 bytes */ > + r = fallocate(fd, 0, 0, 42); > + if (r) > + goto close_tmpfile; > + > + /* Get the new stat */ > + r = fstat(fd, &st); > + if (r) > + goto close_tmpfile; > + > + /* It should be 42 bytes long */ > + if (st.st_size != 42) { > + r = -1; > + goto close_tmpfile; > + } This should also check that full 64-bit values are passed through. > + > +close_tmpfile: > + close(fd); > + > + return r; > +} (...)