From patchwork Tue Jun 13 07:49:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 107165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp371893vqr; Tue, 13 Jun 2023 00:57:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6FiIN5Oij79NfNP8LXMBwMrC5jMIMYjDyAaAE7jZ/rUwi2V9sXYHHb7aWEp3L5EvLIlAER X-Received: by 2002:a67:f906:0:b0:43b:5892:bad4 with SMTP id t6-20020a67f906000000b0043b5892bad4mr5468335vsq.15.1686643033126; Tue, 13 Jun 2023 00:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686643033; cv=none; d=google.com; s=arc-20160816; b=hn63eCMPzf1LoMhCd8k6mXtQw+T6TlP6JJfvZAiORJ5tYNO1FUKrPGiFsAunv7Hlut 677/0ZTOIogRifPjHKLnUhmdEKQx592DrtN/9ym72EHJm36kH0kT9fZrsNg+NkULDLw1 5YhDNhoY7T2o+iJmfuIHXxbODoq9VKHuVWdHV+mdImwa7LWYYQTr9qdfyBn6uRCPabsf QGCydftbSaRRNzZdALhL/GX1DRNjOvlRLNrLMUPePGNC9NDpeoEKECi3nNJ7gt9eHUCF Avx1eemc+udtkHByoG12IFMFYK54CQWw+Flfsnz+mrNRrNK5h7P3FwQhTpAv4rYxnb3G UaGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=moJN+g8UiI2hq78ltZSSLuP9Xu72wgPasq355As9aLA=; b=Nuk8yKb2BjlpVl10zYy2HzmjCC8tVsV+PIiijYQF4vnXJE+eGYJ1i+fUpqBYHZpftj KIOR04/9G7o71P6BFW3m2QM/3Z66chk7/DMC7d2XBkkFF0u8GxFlXJkPIPow7bdW89dd +EbnUnIpQeumgeM6XLG34YI3kW5o+iRqBPe3Bv0uFXDnxNN5gTcyk1s6zB8yJJndsYI3 +E2mUmO+16LoDf1Ze8oD9rw9MdYoFfzmbpw9wfd4fFC8p6Z+CSPQrqb7yXXlcsERldHY s/aCqohCayX5RWbrl6Xel+qJLs2HmRmN78Pb8ds9Bl0RYkn2u8RaTMILfO43kkfbpPks 7dwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jOjKffaH; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020a632b06000000b0052c8234a858si4680075pgr.168.2023.06.13.00.56.59; Tue, 13 Jun 2023 00:57:13 -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=jOjKffaH; 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 S239123AbjFMHto (ORCPT + 99 others); Tue, 13 Jun 2023 03:49:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239210AbjFMHtl (ORCPT ); Tue, 13 Jun 2023 03:49:41 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A6F10E2 for ; Tue, 13 Jun 2023 00:49:36 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2b1b084620dso64040771fa.0 for ; Tue, 13 Jun 2023 00:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686642575; x=1689234575; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=moJN+g8UiI2hq78ltZSSLuP9Xu72wgPasq355As9aLA=; b=jOjKffaHPlrXbRTvLrrGNPnl+MXhW2iVgyKxsqO/GF/igHOtyq4n0fpXrJdvfXsllM QUemy3UwuRMz1DALtR4jszRFg4IWG+fIacrlX93aHyC7+8oXwZjP5l1LPYFpLA3VtHMF wcFSpX6k24IKLvljp4MUGmlv0mwqS/DEju2uDPHvsoPqanW8K1r0gMwxVesGNgPlgSFj zAaSuyiNiezWxRCugqlTI2nRVCp8VU7IU87VWLAWoPN4/6Pm0tqvLElsN7uz5CUEFGXs 8H6G0guic+grViobw+IjXjatk64VX6mJzldZ1IQL8IDVK07P1e8MOLtsqTvViSXuS54f /ylA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686642575; x=1689234575; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=moJN+g8UiI2hq78ltZSSLuP9Xu72wgPasq355As9aLA=; b=SlHOVz6m3t5D9d+WowJSawDM1H9vRZql5+WE/c6DpAGNZuTFZ1k6Uz+UhxZgcylQbD +NTp/I2M4gWd5ko2wQkCeqHnSM1bYASgFPes1q6mZfatMoKMQRd5n13GqM/OhWLVYBOL j5kalguwkPNbCZxL1vbUQz0mpOW2WKMgQqQvqggKpCygyhGsLpl6G59wh7vK89z4DEUk tmBXDaGIZ7dJAzGbz2ZaaBkoQ1RU9bTNPJiSb6if6pcF3/Ucrti/KMrR/p8eYc5nYf87 WGJ93hrt9L8Do+hfkhHuOjhHXneurVafF6ha6lFwYYgbVx3ecYtWdDoFWaHl/uURaXJl aaxA== X-Gm-Message-State: AC+VfDzRKKNX7LGtjtYU0SPGa3UI/3twb5O0OKRUHhmUSdfCK+oLPxpU k36MjuhkMxuXNIBHNMAPnsoXkw== X-Received: by 2002:a2e:918a:0:b0:2ad:8929:e8f4 with SMTP id f10-20020a2e918a000000b002ad8929e8f4mr4071464ljg.43.1686642574978; Tue, 13 Jun 2023 00:49:34 -0700 (PDT) Received: from localhost (c-9b0ee555.07-21-73746f28.bbcust.telenor.se. [85.229.14.155]) by smtp.gmail.com with ESMTPSA id p7-20020a2e9a87000000b002adb10a6620sm1990220lji.107.2023.06.13.00.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 00:49:34 -0700 (PDT) From: Anders Roxell To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, usama.anjum@collabora.com, jhubbard@nvidia.com, Anders Roxell Subject: [PATCH] selftests: lib.mk: fix out-of-tree builds Date: Tue, 13 Jun 2023 09:49:31 +0200 Message-Id: <20230613074931.666966-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768573404876480916?= X-GMAIL-MSGID: =?utf-8?q?1768573404876480916?= 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=' This is the error message that pops up. make --silent --keep-going --jobs=32 O=/home/anders/.cache/tuxmake/builds/1482/build INSTALL_PATH=/home/anders/.cache/tuxmake/builds/1482/build/kselftest_install ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- V=1 CROSS_COMPILE_COMPAT=arm-linux-gnueabihf- kselftest-install make[3]: Entering directory '/home/anders/src/kernel/next/tools/testing/selftests/alsa' -e error: 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 in kselftest's Makefile. By adding 'KBUILD_OUTPUT := $(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 Tested-by: Muhammad Usama Anjum --- tools/testing/selftests/lib.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index b8ea03b9a015..d17854285f2b 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -44,6 +44,10 @@ endif selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST)))) top_srcdir = $(selfdir)/../../.. +ifeq ("$(origin O)", "command line") + KBUILD_OUTPUT := $(O) +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.