Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2815847lqt; Tue, 23 Apr 2024 02:27:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXWHKLYoljdoRBgnI8CCw6e1DmYC5ZGIJGGchPAfjkTCPB3lbavRUU6wSs1Zt+11pqgPLKmYGO8VgU9V7kC9F7wvFvfC8o0flXeQR82wQ== X-Google-Smtp-Source: AGHT+IHsZVd48PdkpBQel8Uil74fvMYlOC+Pzd7ZwR298B8V2qpBSkXInph6ws2h7AHF42Us/AsC X-Received: by 2002:a05:6a20:9717:b0:1a3:1972:450e with SMTP id hr23-20020a056a20971700b001a31972450emr12841099pzc.50.1713864430243; Tue, 23 Apr 2024 02:27:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713864430; cv=pass; d=google.com; s=arc-20160816; b=REKshkb8q9OtjV6a7eCZFTEhjY8mC95jTq86jPuBOBfGIL05mRKfz0qM+o14wSW/Du a+GZ/XjREupHt2RGuRxubyzK83ffoUTJP2P5DJbjoqgAnVIYEwJFQ6CaLUdL+gD5ilCb HCpLPiZ6tGcOiVJSN2Wep3m/cE32anyIDKoJYLhXe3SSN6H5ldyD31rK5UCepmZdkJk3 vv8Q5aaJkL9FUgN4TYQpFJhVLzTsoN+IH/2ivhvwtLGeuGEcaSADmVCCQ+WGvHoj4KVu o9zyiX3WiwJKF6xLnNoHah+P5F7lwMxSwHmDqO0QVQhUmHTbTbSHTZXI2P9gSXYY/jUT aadg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MRBf1dr4xmUJP3/fSTsuAj3Swa3XMHAcM7I2JiDbvSc=; fh=SfYFDOf89lh50SMZJVIg5OqmKfW0pgyqy/VqqD/2I2k=; b=E1oKwQIbM89O2IcUaNgD+Dwvo9+KtvD+wjhAevdaBdNK/nIgtSXr8kwN3GPEvVxFIU nL1xi2Gr+U42H0Aqu2JCkWwSy3YWAKAmGIEjV0nqwSrqQT6EMPL9khV3MNUrrg8XoLoK vpgQSQ8Zrj7gwaf9eZPJtbo+xQoWJv2Co845BxNkc+Ib3F1PP7nMwuECmafworJ1w/8z YhFawSHnasw/YjHmwdXSOTqWw93rL/GIX4nbXT/o/OO6quTgJDw80jVPmsxw0rClm8Sv KnkO5o5Ukv+SqPmRuRzY74tDtc1S89hTRd5elsWVAiTSzCTgFdmhLK5gPI5RYmVcRUX2 zQFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=glg2zKB4; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-154775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154775-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ff15-20020a056a002f4f00b006ed00eb4494si9154917pfb.225.2024.04.23.02.27.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 02:27:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=glg2zKB4; arc=pass (i=1 spf=pass spfdomain=weissschuh.net dkim=pass dkdomain=weissschuh.net); spf=pass (google.com: domain of linux-kernel+bounces-154775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154775-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DEFB4B2149C for ; Tue, 23 Apr 2024 09:18:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EEB65820E; Tue, 23 Apr 2024 09:18:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="glg2zKB4" 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 49FAD2AD11 for ; Tue, 23 Apr 2024 09:18:10 +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=1713863892; cv=none; b=RTGoNSDMlQ6rg7kwBJhceSuEXF4Fngfhq1/wvxMLGMN2UvTScbCsGIHWiObFcXLht2tXIV5RDLtYoGIrmFkofjIZ65XgEXGDPv5451BkjzE4BJJS/wdT7BMKilGK0iRAnR/yso4pSjEbAiHfFjB3Z0snPxT030rbeSPgVkjoAKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713863892; c=relaxed/simple; bh=0g3RC9v/aNxcYppBWNUHo78P3I4XIoFkZB6LPvM4rRg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VqaqbeJ0xuziUW4J22YufntvKT8zQ0SLSOgfjbf+3ZDe9ekijnCq2Sp02GUkUvBMqTWI6vF1v0lJyKbVWk9kHEAoN7mPGePdG0/uuO3MyEoPNPm2WdlvZK8+orD33PNUjHaqx8LrtYLqBh/NpuSJZV64hncIa1EI9lwpxJQ+70Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none 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=glg2zKB4; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1713863886; bh=0g3RC9v/aNxcYppBWNUHo78P3I4XIoFkZB6LPvM4rRg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=glg2zKB4PGPUfZvJ0aqL7uuMi0SINVsKXwKXdhd5u1KpxoTKTQ6fC/MaHuevI/JEL QIPa5tMcoPS0FGAA/b6nfzQLKhTS+RIPv49rvUUfw5zLS7QEjRB9Zg5KkQ8tgur6Pz usgMYtjQrAbArCDJWy3wVLwIKeXiHw1+oDkKNAdE= Date: Tue, 23 Apr 2024 11:18:06 +0200 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Shuah Khan , "Paul E. McKenney" Cc: Willy Tarreau , linux-kernel@vger.kernel.org, Rodrigo Campos Subject: Re: [PATCH v3 4/4] selftests/nolibc: Add tests for strlcat() and strlcpy() Message-ID: <172d25cf-cfd7-4069-8c26-df2e81ffbad1@t-8ch.de> References: <20240218195110.1386840-1-rodrigo@sdfg.com.ar> <20240218195110.1386840-5-rodrigo@sdfg.com.ar> 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: <20240218195110.1386840-5-rodrigo@sdfg.com.ar> + Shuah and Paul, please see below. So I picked this up and it got picked up by Shuah, but... On 2024-02-18 16:51:06+0000, Rodrigo Campos wrote: > I've verified that the tests matches libbsd's strlcat()/strlcpy() > implementation. > > Please note that as strlcat()/strlcpy() are not part of the libc, the > tests are only compiled when using nolibc. > > Signed-off-by: Rodrigo Campos > --- > tools/testing/selftests/nolibc/nolibc-test.c | 40 ++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c > index 6ba4f8275ac4..d373fc14706c 100644 > --- a/tools/testing/selftests/nolibc/nolibc-test.c > +++ b/tools/testing/selftests/nolibc/nolibc-test.c > @@ -600,6 +600,25 @@ int expect_strne(const char *expr, int llen, const char *cmp) > return ret; > } > > +#define EXPECT_STRBUFEQ(cond, expr, buf, val, cmp) \ > + do { if (!(cond)) result(llen, SKIPPED); else ret += expect_str_buf_eq(expr, buf, val, llen, cmp); } while (0) > + > +static __attribute__((unused)) > +int expect_str_buf_eq(size_t expr, const char *buf, size_t val, int llen, const char *cmp) > +{ > + llen += printf(" = %lu <%s> ", expr, buf); This introduces a compiler warning on 32bit: i386-linux-gcc -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra -fno-stack-protector -m32 -mstack-protector-guard=global -fstack-protector-all -o nolibc-test \ -nostdlib -nostdinc -static -Isysroot/i386/include nolibc-test.c nolibc-test-linkage.c -lgcc nolibc-test.c: In function 'expect_str_buf_eq': nolibc-test.c:610:30: error: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] 610 | llen += printf(" = %lu <%s> ", expr, buf); | ~~^ ~~~~ | | | | | size_t {aka unsigned int} | long unsigned int | %u It is easy enough to fix through a cast to "unsigned long". The original patch was already sent to Shuah and included in -next. Shuah, Paul: I'd like to rewrite the offending commit instead of having a fixup commit. As it seems to me the original patch would only go into 6.10 anyways. Any objections? Notes to self: * Add flag to run-tests.sh to use -Werror * Implement "%zu" in nolibc printf() > + if (strcmp(buf, cmp) != 0) { > + result(llen, FAIL); > + return 1; > + } > + if (expr != val) { > + result(llen, FAIL); > + return 1; > + } > + > + result(llen, OK); > + return 0; > +} > [..]