Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp196570rwd; Wed, 14 Jun 2023 14:32:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6zV9iTXKr7BKJoHCZdU2V5sFwKGMVMsdr/ouMovYVG2UtJ+ms6WduaYaMpn725BOeqWrUs X-Received: by 2002:a17:907:868d:b0:982:8bd5:4224 with SMTP id qa13-20020a170907868d00b009828bd54224mr1524964ejc.45.1686778356942; Wed, 14 Jun 2023 14:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686778356; cv=none; d=google.com; s=arc-20160816; b=Z4biF9SkIb3WQbb4acFsG9+OjNmm7zl8pWsWnolqn5yhRH9DKyLHGUW6YHMHiXqVMB KgpUGI+JereAtiMQVJ7lgf2kkaN/tZpOrQKyy3uxQfT0p48EUXaw8zuw9NJpDdUOIUbw yXeq+pu/ZrEzgN8bkilzCLokyFAt5rdMx5OPaZ5AfZE1OVoRS0xhiZNBCJZFH6UPEszK IYkw7W737qF2ZLKdByDzjEfL8las0O5S/PYMm2UGcnBJvhkml6OiVL430d8gAqu2JKrd fr1WXYHQikwAbZNdCC2+KDdVKCZSAzbaw+cJxNlKtTHvJIrvMq8fwMs0Spy/a07Yi9JT SYrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LrLCxGP3h4zlnPwsi/7+4fkOnHUcAp0hewA5gzf9FKk=; b=sxULOTOkRMnVbaSAhW7XW3OHWTAvUjcsXGNKHE7HeY436WyW1dG5L81VwL6qcwkmxO kEO7KdiSrjGtdPwcL+D1oEr2izP/uVcO4nvNvvwQMFXUM3zvTeOBiegS/gbhsgqlhLmx qoYVVorDRvr/9IDAe6F/z2ibQYBiTrF3LSZvF/uFSdlu6IECZ2FX5h2amAKgTSooQIvk qLATr+YyhSCkq0BM2+ogi7lCFJ8i6gE5JrRhnXLdmyGnLnAmNuBRjm7indk4E5h9furE zxQqhEqiIkCXvDlzlJB4BSG7S8phwVFRSqeP46QpKNtUtrNscBVGbEKasOTRIzunbaFD tZGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s88NVQV+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j21-20020a17090686d500b00978769bf9f7si7727947ejy.748.2023.06.14.14.32.10; Wed, 14 Jun 2023 14:32: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; dkim=pass header.i=@linaro.org header.s=google header.b=s88NVQV+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236196AbjFNVRL (ORCPT + 99 others); Wed, 14 Jun 2023 17:17:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234541AbjFNVRJ (ORCPT ); Wed, 14 Jun 2023 17:17:09 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEBA91BF0 for ; Wed, 14 Jun 2023 14:17:07 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-75ec7e8e826so247224685a.0 for ; Wed, 14 Jun 2023 14:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686777427; x=1689369427; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LrLCxGP3h4zlnPwsi/7+4fkOnHUcAp0hewA5gzf9FKk=; b=s88NVQV+0voSmP3DMArDzRi0rYMzK3wgn+fEX4GUrwdG6Roc/+Juh2V+CN2sy8ywdx Wh1wjvOgCN+gjqlk/3N+zdYEuHzR5zKttvOevT+HIuiEBfYBNfwRwTpommo39cNdBBT4 GAOQQJO9vIiIDEtV6msrkWUeEBpZW3VXjVpStO0bHqmMEtuoUwqQ7+WmGLM5hjwkzyq3 VBEnsNr8WMIg8v2spjXSjjAxbvoNUKMjAK6FJLtliS57ZjotEo6tlfgfzfHhZ8l8Uthr wott04zj+hh2z2GwYm9Pt8EpVJIksclDinqrxa9buccQTAYdgJBMMh45Qg7x8b4CTbpI meYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686777427; x=1689369427; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LrLCxGP3h4zlnPwsi/7+4fkOnHUcAp0hewA5gzf9FKk=; b=BM/++GF1o++KzMJssNWgYmHBlAe7VxYjrn2JyF7N9PTS5NHW+YXeU2rqjVxbyIpXWY 0paILAoiA8fu6QJ7TecyQNVlqlMFHRjMUTMFK6oK0n9zjVD+0ROMgSls9chGDc6fE1KL EMYw7HDw4RzrXpk7tmdPwQIDZDJ/hdbLwQmcoDVlfq7OgxxBaS7ZQnEjXpadVDK5r8kG 5/6uIEpICIdwjoQz7nbOO4fPWn8EyiLCPRXH//XyyjJd3j1o1gFfsbvDZ3evxeEKcRQ7 IzaKDCdqrWNsHEYARyLwELWGvLRLycrtCNe6XUDl3cUoaEpVHZToXEEUFQapDg9HHn5p w/kw== X-Gm-Message-State: AC+VfDz2eEaNzM6+gppDOmbbdN+ZregDk7cnbAVzwj15axd0P6VmAify XsXCdkCyCJfkBaTXdttqF2hbfnmIXvxo39sXAldWxA== X-Received: by 2002:a05:6214:300a:b0:5af:9276:b59d with SMTP id ke10-20020a056214300a00b005af9276b59dmr18797042qvb.18.1686777427098; Wed, 14 Jun 2023 14:17:07 -0700 (PDT) MIME-Version: 1.0 References: <20230613074931.666966-1-anders.roxell@linaro.org> <928ad485-2dc2-2e02-98a2-fa203441f463@nvidia.com> In-Reply-To: <928ad485-2dc2-2e02-98a2-fa203441f463@nvidia.com> From: Anders Roxell Date: Wed, 14 Jun 2023 23:16:56 +0200 Message-ID: Subject: Re: [PATCH] selftests: lib.mk: fix out-of-tree builds To: John Hubbard Cc: shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, usama.anjum@collabora.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Wed, 14 Jun 2023 at 04:23, John Hubbard wrote: > > On 6/13/23 00:49, Anders Roxell wrote: > > Since commit ("selftests: error out if kernel header files are not yet > > built") got merged, the kselftest build correctly because the > > KBUILD_OUTPUT isn't set when building out-of-tree and specifying 'O=3D' > > This is the error message that pops up. > > > > make --silent --keep-going --jobs=3D32 O=3D/home/anders/.cache/tuxmake/= builds/1482/build INSTALL_PATH=3D/home/anders/.cache/tuxmake/builds/1482/bu= ild/kselftest_install ARCH=3Darm64 CROSS_COMPILE=3Daarch64-linux-gnu- V=3D1= CROSS_COMPILE_COMPAT=3Darm-linux-gnueabihf- kselftest-install > > make[3]: Entering directory '/home/anders/src/kernel/next/tools/testing= /selftests/alsa' > > > > -e [1;31merror [0m: missing kernel header files. > > Please run this and try again: > > > > cd /home/anders/src/kernel/next/tools/testing/selftests/../../.. > > make headers > > > > make[3]: Leaving directory '/home/anders/src/kernel/next/tools/testing/= selftests/alsa' > > make[3]: *** [../lib.mk:77: kernel_header_files] Error 1 > > > > Fixing the issue by assigning KBUILD_OUTPUT the same way how its done i= n > > kselftest's Makefile. By adding 'KBUILD_OUTPUT :=3D $(O)' 'if $(origin = O)' > > is set to 'command line'. This will set the the BUILD dir to > > KBUILD_OUTPUT/kselftest when doing out-of-tree builds which makes them > > in its own separete output directory. > > > > Signed-off-by: Anders Roxell > > --- > > tools/testing/selftests/lib.mk | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/l= ib.mk > > index b8ea03b9a015..d17854285f2b 100644 > > --- a/tools/testing/selftests/lib.mk > > +++ b/tools/testing/selftests/lib.mk > > @@ -44,6 +44,10 @@ endif > > selfdir =3D $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) > > top_srcdir =3D $(selfdir)/../../.. > > > > +ifeq ("$(origin O)", "command line") > > + KBUILD_OUTPUT :=3D $(O) > > +endif > > + > > Thanks for fixing this up! This looks correct. > > (It's too bad that we have all this duplication between the Makefile > and lib.mk.) I agree, also the duplication of get_sys_includes in bpf, hid and net Makef= ile's Do you have any idea how we can remove the duplication? Cheers, Anders > > thanks, > -- > John Hubbard > NVIDIA > > > ifneq ($(KBUILD_OUTPUT),) > > # Make's built-in functions such as $(abspath ...), $(realpath ...)= cannot > > # expand a shell special character '~'. We use a somewhat tedious w= ay here. > >