Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4102333imw; Tue, 12 Jul 2022 01:40:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1svGup3L4N364BEWVbtTjQ7n+qpkRgoOK5wbvptmVy/YmRV59MNrWDRLZqvAzvhNrTtyo5i X-Received: by 2002:a05:6402:7da:b0:43a:6fe3:b7a9 with SMTP id u26-20020a05640207da00b0043a6fe3b7a9mr30006270edy.410.1657615212717; Tue, 12 Jul 2022 01:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657615212; cv=none; d=google.com; s=arc-20160816; b=E6Nx5T5PO6XcjS3pfd+l5xdD0yQu5OzV85kX4YQtPlGnDxQc7pRpaxCrc3Fh8Cdno9 07iDdCQ7N9wg+JnD22ULwLzuN/CYvBbyngWEoX1vMBA36EPyXlkitJ1nprE/gUm1epIK F0dKRFewmTCQeczVzLlXSvRnRvO20lsLk2znhL08qA3ZKNDX7qu+5z/xBIJotgV8fens JEasYwmVcKreBky2GHL3aSmJD9RNIFfYSZUZmAoAdojOIaBmFx0+wuR6kdc7OkPAig8+ ADOnWduhsCQ9EGPwHZ5EbK8uq0qvWJdkt5RiI2Zsul+G5R57LkCPF+l9OicoqghLAQhF J5SA== 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=SYzSF1XhPnNSiQqLwrW7KPwmFGkApebal6VnHlu33ZI=; b=L0xpigU6bJgKF/6BSgZZ8BYwIEnYXY8YSVzGA4mwzpBFZaF07ScHaRurCk11/gW2r7 jJbSTPvzZX0EXn8QnIafHHjqlx3sxXL+yxUvlplr4CSmlyWEuVLZ8OiW/1H2krJfq5f9 dFHlL7FjQLGgfnllucn42V5WlRfWkZW4Sgzumm4obs+Mr3x+MUjLSR9Xbc+C5WvH7SPu ZG+yFaRt0TflYsJT2T64bzODuUz7zjAb7RcgA58l7TZcQUOERVMaCsXcExocw69poFmW vqx2cqeu0SRSaFAKGlQVAityuQike3u18NXIeAquD6V3cNMolkraGgsQtsbxTNruJPhK 02yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Q8u34olA; 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=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d15-20020a056402400f00b004376b600290si13401721eda.350.2022.07.12.01.39.46; Tue, 12 Jul 2022 01:40:12 -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=@collabora.com header.s=mail header.b=Q8u34olA; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232412AbiGLI34 (ORCPT + 99 others); Tue, 12 Jul 2022 04:29:56 -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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 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