From patchwork Tue Jul 12 08:29:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 590175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F57C433EF for ; Tue, 12 Jul 2022 08:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231991AbiGLI3z (ORCPT ); Tue, 12 Jul 2022 04:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbiGLI3y (ORCPT ); Tue, 12 Jul 2022 04:29:54 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D34731378; Tue, 12 Jul 2022 01:29:52 -0700 (PDT) Received: from tincan.cable.virginm.net (cpc108961-cmbg20-2-0-cust263.5-4.cable.virginm.net [80.5.129.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: gtucker) by madras.collabora.co.uk (Postfix) with ESMTPSA id 2AB2E6601A09; Tue, 12 Jul 2022 09:29:51 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1657614591; bh=KZsqbx4+oPmqtmBwx2RIw+6D1rdSYwZZ8k51wnyModI=; h=From:To:Cc:Subject:Date:From; b=Q8u34olAOvNl8TyV9GbOtpQ7X51xeCzimt74LAqOUcyoPjaMU6q50EnptpLSbvmu1 swk/kAxPNoBAhtAjX+2meFjCJ9MkL6ui6tzxAwf1Q/7ws2pFXy8kt7t50lzn9IX6fG Lu7Vdp4NvwDQXFCyKswpSsAXwsp4dwX8svHMObp7SKFkt8xIembhRio27oK/B0vsfo Er2ithtmoWkJ/9slHiShiqQ+80iK2GUD775Ou5oBmrQQb5amiyUkYcyIADqNpkYxOu KLataWKq/GcwE2rV1LkIbzKP5OwwqCkVonRg8hmoAbJTs4g5IJpvV7BkXYlUifoWZt CkJ2j+XmN00gA== From: Guillaume Tucker To: Masahiro Yamada , Michal Marek , Nick Desaulniers , Shuah Khan , Kees Cook Cc: Anders Roxell , Tim.Bird@sony.com, kernel@collabora.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 0/4] Fix kselftest build with sub-directory Date: Tue, 12 Jul 2022 09:29:44 +0100 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Earlier attempts to get "make O=build kselftest-all" to work were not successful as they made undesirable changes to some functions in the top-level Makefile. This series takes a different approach by removing the root cause of the problem within kselftest, which is when the sub-Makefile tries to install kernel headers "backwards" by calling make with the top-level Makefile. The actual issue comes from the fact that $(srctree) is ".." when building in a sub-directory with "O=build" which then obviously makes "-C $(top_srcdir)" point outside of the real source tree. With this series, the generic kselftest targets work as expected from the top level with or without a build directory e.g.: $ make kselftest-all $ make O=build kselftest-all Then in order to build using the sub-Makefile explicitly, the headers have to be installed first. This is arguably a valid requirement to have when building a tool from a sub-Makefile. For example, "make -C tools/testing/nvdimm/" fails in a similar way until has been generated by a kernel build. v2: replace headers_install with headers Guillaume Tucker (4): selftests: drop khdr make target selftests: stop using KSFT_KHDR_INSTALL selftests: drop KSFT_KHDR_INSTALL make target Makefile: add headers to kselftest targets Makefile | 4 +- tools/testing/selftests/Makefile | 28 +------------- tools/testing/selftests/arm64/mte/Makefile | 1 - tools/testing/selftests/arm64/signal/Makefile | 1 - .../selftests/arm64/signal/test_signals.h | 4 +- .../selftests/drivers/s390x/uvdevice/Makefile | 1 - .../selftests/futex/functional/Makefile | 1 - tools/testing/selftests/kvm/Makefile | 1 - tools/testing/selftests/landlock/Makefile | 1 - tools/testing/selftests/lib.mk | 38 ------------------- tools/testing/selftests/net/Makefile | 1 - tools/testing/selftests/net/mptcp/Makefile | 1 - tools/testing/selftests/tc-testing/Makefile | 1 - tools/testing/selftests/vm/Makefile | 1 - 14 files changed, 5 insertions(+), 79 deletions(-) --- 2.30.2