Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3322996rdb; Thu, 16 Nov 2023 06:40:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFM/LiyiHlhqI33cSVNaUTUWH5XhPrM9H/xCWs2nCPEfTN9KvOHjcBN0y+wS60/7mQN6+Ho X-Received: by 2002:a05:6a21:3391:b0:186:a0d9:41a7 with SMTP id yy17-20020a056a21339100b00186a0d941a7mr11813866pzb.21.1700145616895; Thu, 16 Nov 2023 06:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700145616; cv=none; d=google.com; s=arc-20160816; b=ljAN3oxyD3TeYOOKZ0J0jg9zEydakXHLn0szxzZKeBCNdkC3TpqW3LkjoyR/IUrHP8 kIQ0W8XP1k40vzjj32hUxM9Btkyo+V8SX/WwBQenq6M8fSyBYmC8ht5toYFvtI+jQaa/ KSxX3zeuM9HwPTAwWFeP6cIK7WQjnQQ7uMoIoM3E2kSHXg18kKhIGtozxUEW/MqfOS+t OdtLqtXBgvnGPRykPLmlHEtJucI24CyDfGSUT+5XlhuLeQwC6o6rQVrz+K6X+8Xd5R3n /d+UMLN8kPfpoDZiOODqRBJGNRftpURk5JoA8Qx9b27QuBM5YIqMDOVerRMKvD9iEpt/ 5MiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NJ5v1hoIyY/A8BPIwIRx4LfA56/9gCqVC5JsDIFNiYk=; fh=pTx9fEY7ua+lm7qrJvkJuQzqwoXTh0iZZAyDx4UpkYw=; b=aJ97klVPJ4TYfZYevzQZLxZRh8UJkLjb27jrBhgcB9EGUm2nFYncWoTbyCXbNMLle+ Ik2C6uO4yWQ8iaoNa1yMN6bEnn2zVqdFvmnJML2u75i7lg/URJJQZCAIF5VGunHbdqQf zrQq3+pPw62GEHne4u0KycA+gxFMXRLfChgFdVxescx3j45XaFsL70UWG3UKMRatv9Tj s5AAcZRJieXFjl46hlnG29ApvMY1ZntDl8f67f9JxWF7yN8W3tRTIwquFcXKMTAWeMui +KqJjmrU1LZL09UgQfv/fZc6FU4bX8N9v6+k2Bjr74zuJJIo698ImoXhSDC3l2cB4/k8 7jLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=XtY+YwJk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id m63-20020a632642000000b005bd66bfc235si13337532pgm.413.2023.11.16.06.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 06:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=XtY+YwJk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 520F080EE7A6; Thu, 16 Nov 2023 06:40:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344888AbjKPOkB (ORCPT + 99 others); Thu, 16 Nov 2023 09:40:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234888AbjKPOkA (ORCPT ); Thu, 16 Nov 2023 09:40:00 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EACB196; Thu, 16 Nov 2023 06:39:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1700145594; bh=yrmKvsI+CnrWZRR/QLp4Qs3fYtF932zZA3HDcQg5SQ4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XtY+YwJkr3U5KhDeW3j3Gi7Jn3iFCA57xrpl5EWp8VuDJ2wEqkHPYbhwKjGJRRvYN 6cONdCXXdxBOpjweBZHYmBu3KYbDz0ctgcQwkdy1dAfwg5NensWMEvzFRsJu4Tq4G2 uhX8tYolPkSWKgms2sdoqNh8I2yjjuW5RhCBczL4= Date: Thu, 16 Nov 2023 15:39:54 +0100 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Willy Tarreau Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH RFC 1/3] selftests/nolibc: add custom test harness Message-ID: <93f771cb-4db1-4b16-ab02-f777894e3620@t-8ch.de> References: <20231115-nolibc-harness-v1-0-4d61382d9bf3@weissschuh.net> <20231115-nolibc-harness-v1-1-4d61382d9bf3@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 06:40:10 -0800 (PST) On 2023-11-16 08:16:22+0100, Willy Tarreau wrote: > Hi Thomas, > > On Wed, Nov 15, 2023 at 10:08:19PM +0100, Thomas Weißschuh wrote: > > The harness provides a framework to write unit tests for nolibc itself > > and kernel selftests using nolibc. > > > > Advantages over the current harness: > > * Makes it possible to emit KTAP for integration into kselftests. > > * Provides familiarity with the kselftest harness and google test. > > * It is nicer to write testcases that are longer than one line. > > > > Design goals: > > * Compatibility with nolibc. kselftest-harness requires setjmp() and > > signals which are not supported on nolibc. > > * Provide the same output as the existing unittests. > > * Provide a way to emit KTAP. > > > > Notes: > > * This differs from kselftest-harness in its support for test suites, > > the same as google test. > > > > Signed-off-by: Thomas Weißschuh > > Nice intro to present the benefits, but you forgot to explain what > the patch itself does among these points, the decisions you took, > tradeoffs if any etc. All of these are particularly important so as > to figure what to expect from the patch itself, because, tob be > honest, for me it's a bit difficult to estimate the suitability of > the code for a given purpose, thus for now I'll mostly focus on > general code. Good points. I'll expand more in v2 after we are through this round. > A few comments below: > > > +static void putcharn(char c, size_t n) > > +{ > > + char buf[64]; > > + > > + memset(buf, c, n); > > + buf[n] = '\0'; > > + fputs(buf, stdout); > > +} > > You should really check that n < 64 here, not only because it's test > code that will trigger about any possible bug around, but also because > you want others to easily contribute and not get trapped by calling > this with a larger value without figuring it will do whatever. And > that way you can remove the tests from the callers which don't need > to hard-code this limit. Ack. > > > +#define is_signed_type(var) (!!(((__typeof__(var))(-1)) < (__typeof__(var))1)) > > +#define is_pointer_type(var) (__builtin_classify_type(var) == 5) > > The hard-coded "5" above should either be replaced with pointer_type_class > (if available here) or left as-is with a comment at the end of the line > saying e.g. "// pointer_type_class" so that the value can be looked up > more easily if needed. Ack.