Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2392949rwl; Thu, 6 Apr 2023 09:34:36 -0700 (PDT) X-Google-Smtp-Source: AKy350YpzJJ/dJavb/HIrjz3h2HUZQn8R1wo5bEGa7okKBjAqLWZCuI5dFqtD8yje4ywllNnFqEB X-Received: by 2002:a05:6a20:be12:b0:d5:7f0b:f2f with SMTP id ge18-20020a056a20be1200b000d57f0b0f2fmr136519pzb.26.1680798876621; Thu, 06 Apr 2023 09:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680798876; cv=none; d=google.com; s=arc-20160816; b=cW6jemMEyW7UTxklD5xvNjccp9VTzq+SzV4hoOXZs8bj82G8GDN9RIf13W+qOoiYNv ebnVOEUl9+OZbHltNb+SZG0bGJDVyonyWAEXSJQmDUO8dD5Bjqo0FU5FH7+jGcqTa4dg BnKB/H1s4koozWPDPB/jr+e+K5HuD+gGg0BxiceblAXfQS0f0xmoxb+9G27nnn4KinLD mkG6qM5ZyXUrLdm2GsbFBhmeU1FkXZggmO01Ura9R02TmvECP0jBScHxpeCCdw6lphzG 2zuxrJQDuYNvo59tvvhUqDy+ddsguqaucZKixXgEKvwqqndHscZXG9Wl88ckCzQkvwB2 s0bw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=7GU+bE6a6BB5+6iBYD769DKTkByRw+j8RsJv+/4K7u0=; b=c+B43uZxU/jNRccSQXJSS/qYRwyiZeFDs4qvTmiA4d0AH1NgXK7IBqqOrFjoLytqeg UPIL8Mqg9QmjjR7VhRs9Q9JaBPZAM1GkJovk6Ubw9Nv9R5F2E3fW/ETme9DC6z9eLleh 8UdioMKcnoH++sKuDKn8+gZ6I/IBEHPjyyBEwu5uuopatNtdF+Peq9Jm44rN1UghZwYV DXlpj7824+BJpuyOP2cgi4GTEYXAIGfvIRlbH5GmPyND8oyTHXVTuDV1N6r+r0f7cEon ouHhTuAxvOAo8jErYbWBd5BNFQayYW8ZkIES3fkLwWnGqhoV8AhN2nbCauYP1qghh0Dx a/2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v202-20020a6361d3000000b00513d8ab248esi1597274pgb.677.2023.04.06.09.34.00; Thu, 06 Apr 2023 09:34:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239166AbjDFQWa (ORCPT + 99 others); Thu, 6 Apr 2023 12:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229736AbjDFQW2 (ORCPT ); Thu, 6 Apr 2023 12:22:28 -0400 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 193191708; Thu, 6 Apr 2023 09:22:26 -0700 (PDT) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 336GMFn2004846; Thu, 6 Apr 2023 18:22:15 +0200 Date: Thu, 6 Apr 2023 18:22:15 +0200 From: Willy Tarreau To: Mark Brown Cc: Shuah Khan , Catalin Marinas , Will Deacon , "Paul E. McKenney" , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/2] kselftest: Support nolibc Message-ID: References: <20230405-kselftest-nolibc-v1-0-63fbcd70b202@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 06, 2023 at 03:32:20PM +0100, Mark Brown wrote: > On Thu, Apr 06, 2023 at 04:20:29PM +0200, Willy Tarreau wrote: > > On Thu, Apr 06, 2023 at 02:56:28PM +0100, Mark Brown wrote: > > > > At present the kselftest header can't be used with nolibc since it makes > > > use of vprintf() which is not available in nolibc and seems like it would > > > be inappropriate to implement given the minimal system requirements and > > > environment intended for nolibc. > > > In fact we already have vfprintf(), and printf() is based on it, so > > wouldn't it just be a matter of adding vprintf() that calls vfprintf() > > for your case ? Maybe just something like this : > > > static int vprintf(const char *fmt, va_list args) > > { > > return vfprintf(stdout, fmt, args); > > } > > > It's possible I'm missing something, but it's also possible you didn't > > find vfprintf() which is why I prefer to raise my hand ;-) > > Oh, yes - I just didn't find that. Can't remember what I searched for > but it didn't match. No problem. I just remembered it existed because we just received a new test for it a few days ago ;-) > > > This has resulted in some open coded > > > kselftests which use nolibc to test features that are supposed to be > > > controlled via libc and therefore better exercised in an environment with > > > no libc. > > > Yeah that's ugly. In nolibc-test we now have two build targets so that > > we can more easily verify the compatibility between the default libc and > > nolibc, so my recommendation would be to stick to a common subset of both > > libcs, but not to rely on nolibc-specific stuff that could make tests > > harder to debug. > > For these features we simply never want to run with a proper libc since > if we use a libc which has support for the features then we can't > meaningfully interact with them. We're trying to test interfaces that > libc is supposed to use. Indeed, this totally makes sense then! But I think you get the idea of what I was suggesting which is to try to avoid getting trapped by a single implementation in general, by using portable stuff as much as possible. Cheers, Willy