Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3889576rdb; Mon, 11 Dec 2023 03:08:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVF/AElpM4IXH0aiLObq9vK+GAJrzmCFBmAVZ/mNksBPMmbgavypQNKROOGhBnjJ4yxAGL X-Received: by 2002:a05:6e02:1608:b0:35d:73e5:5d3d with SMTP id t8-20020a056e02160800b0035d73e55d3dmr4750652ilu.27.1702292932378; Mon, 11 Dec 2023 03:08:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702292932; cv=none; d=google.com; s=arc-20160816; b=tSY4eo5hUZ6osTlp2Guj+cDPblr/avYvXskAcv3Qgry/TlKGllXoaNnm1FePytBpNW 5TYc/T5epb4lOYDGLKCw0HGpqPxk+MrkllbI8k+G7ZXPqWLGTcfchcxdc/bvgxOLLUHI pMSUil91ovXy8ETdAdVcWboBU5wSf31dmPEGtL6VkuwpkBcecmlZCP8uMzZ55PpaMaLw cCYMvPtiWDjLVUMTwcZME7XejQO0GAkS68ZGmPLSVNzCL7mklXqUTuHQSQoeKShL6eY7 BWaGRSnBZNSI6MJ0Mp0rXLbsSMWq9g2RV1ty1tyNR5HVBuBVJNF+Z7zZx8QR+OxONcjX 2pqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:cc:user-agent:mime-version :date:message-id:dkim-signature; bh=gDSMtd7xq3PnuaK98lv0N4nSR48UNYH2iiyb7hBPrMA=; fh=kKqn4QsHSQxnymRw7CEEY85xuSvi2swPnivEj+OHR1Y=; b=dNXxyFREaJD2LayOKERgJdicOY7rXXpbsJq98lkGJFFrGVmwYSRDC/wFk+OsSeZ9ZD NFuOLW7rki9KYZ0O2EWS6oupDQem1j12kLtgX8KVgFK930ZNmse1K/xV4HlfvLQqtSfi sPR7BEnoK2dCZkKcy92yRRGxN3t45C635CXcM7/V60mEDj3Bis+MCh35nQLvTs6RQr4K JbK6c+E0uKzQa+C4m2P9t+G9B+y8hHzXly9q2IaoZ6iPbIe5rvv2nd/OIZNdy2RPNvlX hEydpHSzV1zR205TvN7bWeW/z4MxRG6usAP+oa2eTzre49oOfQv47tPsfFRSGkYG382K dK2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=sRrefK8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id b13-20020a630c0d000000b005bd66bfc253si5797495pgl.148.2023.12.11.03.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 03:08:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=sRrefK8Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8FA748077819; Mon, 11 Dec 2023 03:08:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234660AbjLKLI1 (ORCPT + 99 others); Mon, 11 Dec 2023 06:08:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231734AbjLKLI0 (ORCPT ); Mon, 11 Dec 2023 06:08:26 -0500 X-Greylist: delayed 445 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 11 Dec 2023 03:08:31 PST Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [IPv6:2a00:1098:ed:100::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E8A9B0; Mon, 11 Dec 2023 03:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1702292463; bh=wib/6cysoLS1GsZLFc9O493Nd0EM/CV957JsOjYbBew=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=sRrefK8Yr5bj87ARlFcoM3qcvIMPxtbiqX9y9jFqY23cE3yDxMkxj+5ccVJgqwbKj R528HS8yn4UkqP6hCznbTvGkmmlwjdio3U+IoBFnYcrFPWv0TgYAaPVryigG/I6LVv JRh1hd2NDy5gYta04N7q+hpOohGWFbh00ufdy9QmvDqgZaV9GtyhNOfPV/3J9vOiaR FrFGIjWDsHSrVhY5s/1USXPp4sUMM1jT6HjloCzsR79g+Oh7qzWWaPhWtNF8p6wiFA I1qyA0qOcnsgQZcqSxongHbvAVzJR35M2MFdpWjUBhkQnQhPPVcbZdpBoR7ikI29/w J1AEQjJ2jgbAA== Received: from [100.96.234.34] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 5BC693781417; Mon, 11 Dec 2023 11:00:57 +0000 (UTC) Message-ID: <0b35fcbd-ce8c-4c12-9725-01f18ade9fc0@collabora.com> Date: Mon, 11 Dec 2023 16:00:53 +0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: Muhammad Usama Anjum , David Hildenbrand , Peter Xu , Shuah Khan , Nathan Chancellor , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, LKML , Anders Roxell , Jonathan Corbet Subject: Re: [PATCH] Revert "selftests: error out if kernel header files are not yet built" To: John Hubbard , Andrew Morton References: <20231209020144.244759-1-jhubbard@nvidia.com> Content-Language: en-US From: Muhammad Usama Anjum In-Reply-To: <20231209020144.244759-1-jhubbard@nvidia.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 11 Dec 2023 03:08:46 -0800 (PST) On 12/9/23 7:01 AM, John Hubbard wrote: > This reverts commit 9fc96c7c19df ("selftests: error out if kernel header > files are not yet built"). I don't think whole of this commit needs to be reverted. Lets leave the warning message as it is and just remove the condition to abort the compilation. > > It turns out that requiring the kernel headers to be built as a > prerequisite to building selftests, does not work in many cases. For > example, Peter Zijlstra writes: > > "My biggest beef with the whole thing is that I simply do not want to use > 'make headers', it doesn't work for me. > > I have a ton of output directories and I don't care to build tools into > the output dirs, in fact some of them flat out refuse to work that way > (bpf comes to mind)." [1] > > Therefore, stop erroring out on the selftests build. Additional patches > will be required in order to change over to not requiring the kernel > headers. > > [1] https://lore.kernel.org/20231208221007.GO28727@noisy.programming.kicks-ass.net > > Cc: Anders Roxell > Cc: Muhammad Usama Anjum > Cc: David Hildenbrand > Cc: Peter Xu > Cc: Jonathan Corbet > Cc: Nathan Chancellor > Cc: Shuah Khan > Signed-off-by: John Hubbard > --- > tools/testing/selftests/Makefile | 21 +---------------- > tools/testing/selftests/lib.mk | 40 +++----------------------------- > 2 files changed, 4 insertions(+), 57 deletions(-) > > diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile > index 3b2061d1c1a5..8247a7c69c36 100644 > --- a/tools/testing/selftests/Makefile > +++ b/tools/testing/selftests/Makefile > @@ -155,12 +155,10 @@ ifneq ($(KBUILD_OUTPUT),) > abs_objtree := $(realpath $(abs_objtree)) > BUILD := $(abs_objtree)/kselftest > KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include > - KHDR_DIR := ${abs_objtree}/usr/include > else > BUILD := $(CURDIR) > abs_srctree := $(shell cd $(top_srcdir) && pwd) > KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include > - KHDR_DIR := ${abs_srctree}/usr/include > DEFAULT_INSTALL_HDR_PATH := 1 > endif > > @@ -174,7 +172,7 @@ export KHDR_INCLUDES > # all isn't the first target in the file. > .DEFAULT_GOAL := all > > -all: kernel_header_files > +all: > @ret=1; \ > for TARGET in $(TARGETS); do \ > BUILD_TARGET=$$BUILD/$$TARGET; \ > @@ -185,23 +183,6 @@ all: kernel_header_files > ret=$$((ret * $$?)); \ > done; exit $$ret; > > -kernel_header_files: > - @ls $(KHDR_DIR)/linux/*.h >/dev/null 2>/dev/null; \ > - if [ $$? -ne 0 ]; then \ > - RED='\033[1;31m'; \ > - NOCOLOR='\033[0m'; \ > - echo; \ > - echo -e "$${RED}error$${NOCOLOR}: missing kernel header files."; \ > - echo "Please run this and try again:"; \ > - echo; \ > - echo " cd $(top_srcdir)"; \ > - echo " make headers"; \ > - echo; \ > - exit 1; \ > - fi > - > -.PHONY: kernel_header_files > - > run_tests: all > @for TARGET in $(TARGETS); do \ > BUILD_TARGET=$$BUILD/$$TARGET; \ > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk > index 118e0964bda9..aa646e0661f3 100644 > --- a/tools/testing/selftests/lib.mk > +++ b/tools/testing/selftests/lib.mk > @@ -44,26 +44,10 @@ endif > selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) > top_srcdir = $(selfdir)/../../.. > > -ifeq ("$(origin O)", "command line") > - KBUILD_OUTPUT := $(O) > +ifeq ($(KHDR_INCLUDES),) > +KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include > endif > > -ifneq ($(KBUILD_OUTPUT),) > - # Make's built-in functions such as $(abspath ...), $(realpath ...) cannot > - # expand a shell special character '~'. We use a somewhat tedious way here. > - abs_objtree := $(shell cd $(top_srcdir) && mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd) > - $(if $(abs_objtree),, \ > - $(error failed to create output directory "$(KBUILD_OUTPUT)")) > - # $(realpath ...) resolves symlinks > - abs_objtree := $(realpath $(abs_objtree)) > - KHDR_DIR := ${abs_objtree}/usr/include > -else > - abs_srctree := $(shell cd $(top_srcdir) && pwd) > - KHDR_DIR := ${abs_srctree}/usr/include > -endif > - > -KHDR_INCLUDES := -isystem $(KHDR_DIR) > - > # The following are built by lib.mk common compile rules. > # TEST_CUSTOM_PROGS should be used by tests that require > # custom build rule and prevent common build rule use. > @@ -74,25 +58,7 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS)) > TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) > TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) > > -all: kernel_header_files $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) \ > - $(TEST_GEN_FILES) > - > -kernel_header_files: > - @ls $(KHDR_DIR)/linux/*.h >/dev/null 2>/dev/null; \ > - if [ $$? -ne 0 ]; then \ > - RED='\033[1;31m'; \ > - NOCOLOR='\033[0m'; \ > - echo; \ > - echo -e "$${RED}error$${NOCOLOR}: missing kernel header files."; \ > - echo "Please run this and try again:"; \ > - echo; \ > - echo " cd $(top_srcdir)"; \ > - echo " make headers"; \ > - echo; \ > - exit 1; \ > - fi > - > -.PHONY: kernel_header_files > +all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) > > define RUN_TESTS > BASE_DIR="$(selfdir)"; \ -- BR, Muhammad Usama Anjum