Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3101496rdb; Wed, 15 Nov 2023 23:16:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBjSBCoVn/VffrPJ0hIEP3djP1/But/pAYh4v/nIZF+ZKCmC0P7cFBW/glluaS1NCjBMoP X-Received: by 2002:a05:6a20:729e:b0:186:7ac3:41c8 with SMTP id o30-20020a056a20729e00b001867ac341c8mr11644017pzk.56.1700119017176; Wed, 15 Nov 2023 23:16:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700119017; cv=none; d=google.com; s=arc-20160816; b=DKqoLv93e3AeaFwe9CNVxpgRk7lbiWuWqlSkJ5jpUit4cFb33EanRKH8CXFhu68m07 QDdYk3FNU0VYMtFMKqDQyXN3p3zvB39CAaQ4aKrWNrFjUQrwm0d6/4O0wbLoWrm6h3Pu RIAInEmV1pyf3KDQPN76c6YF1nsxci0IvFVFO6+VZohTGx9dHrR8s97T+oVjksO6NcPG dcqmKTbaMypkcqkD5A0ZCDwXY+M0WYxNw0fJNFh4MMBk/MLQBJdGQSmeDGe8e11vrQCi 1hak7nsUVHnO3elAo6ysKS4G0EwxHdzpxSWkEw5IGCmQF0WYfW/ZGeUIC+9irSs/+x+Q 6B5g== 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; bh=dwcl27nMw/MPaG0KpXq7wcIYALVdL5V6IxW1ix0kqoo=; fh=qYSE4JWoGuek8PPANgtObAomYOrd4iJoUXDlbhr3PnI=; b=D4JSEHlKbdpyfxYeax/fqLhaz91xZL2CpuxnLCzvv+Ojv4Y63IlBl8euNrpiZOPj5k pTRDJBOvBRLlrsFWqkGTaZuVpz5EJGqGo9NthEw7y+yFqtS+DeUMuKrv7Bz5kfhkRxjv aPojxYUi5zoAdD9As7EMocuuXq+Bn2cNTZy6bsfoPys0CnkKsjHOm7ZCMZ38XfkJvcQv JjWfl3F9Ehnm8GQX2DnC5YzxaB+gSgXSw82s8CPQ+fRECprtS2mFYbjxDgmofVq8wclP Cn+LSZ+LStUFkbl9QowW737fel001HRSAoqXIZYSxXX5RXCrXSDdKA16AFsH8YDflCmV ZX8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l189-20020a633ec6000000b005be1f94caddsi11711440pga.799.2023.11.15.23.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 23:16:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id D1FF280A443B; Wed, 15 Nov 2023 23:16:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229984AbjKPHQk (ORCPT + 99 others); Thu, 16 Nov 2023 02:16:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjKPHQj (ORCPT ); Thu, 16 Nov 2023 02:16:39 -0500 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CBF94DA; Wed, 15 Nov 2023 23:16:35 -0800 (PST) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 3AG7GMdZ007436; Thu, 16 Nov 2023 08:16:22 +0100 Date: Thu, 16 Nov 2023 08:16:22 +0100 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= 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: 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231115-nolibc-harness-v1-1-4d61382d9bf3@weissschuh.net> X-Spam-Status: No, score=-0.8 required=5.0 tests=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 agentk.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 (agentk.vger.email [0.0.0.0]); Wed, 15 Nov 2023 23:16:55 -0800 (PST) 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. 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. > +#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. Willy