From patchwork Thu Apr 12 10:23:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 133194 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1534519ljb; Thu, 12 Apr 2018 03:23:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx481sufJcAkwVnPzll/lQ2cUurUg5D0kWWdl2srRbJ47LEmxRksgbMszk2YwxF094NbsBSNk X-Received: by 10.98.152.217 with SMTP id d86mr7236494pfk.18.1523528606043; Thu, 12 Apr 2018 03:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523528606; cv=none; d=google.com; s=arc-20160816; b=KRUuX/GvOiNV10wuxoGdsgN270qbnaGnYASAjMolz0vo9+3K0WAEdgU7QK7bgHez0K kl7KEy+TH5TcP4QmAPKJ2dg8ulIPY71CaYPzc3k9V/K31cTBeN1Uo19kFxnFgy1sPaNT c8YP5VAXoXpeY/DZv9vTiMfJ/mHqzWLlkSxhaKHtuQGoKuH27ozo6XOZ2ok5zariF/is +6OVGaF4U95pW9cW3+OHRAXtH6f1MYw3efsmVHxHTTC39Z5C3gYCAfcjM+suPEfqX2yh ZwH+fmWPFJCihmBnNdc4o/XQXy5lkfeAdrDXGjdo1tpWSpZDQGpOIXI1VsXOvkdDBJNr 8kyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=SoN37o8Q+5MuFIa6LBTUxP8NyUi8yXhojITGM2W0Kxo=; b=cTfDTAOjExh024lXIxDjxIAlAAHRKEH1LLzYYHnT64uawlN/kc/KnrxFivQkPYHG0d s5LI0yGaFXBPo8zB8KMo0yIKsRP/GA+2rMzCZ7BPSMzGaRLIhnMaezty2YFSks10slXW tP+0x1aMdehzV9GnoKgR74r1RoikJhZbz3151r2LVdA7dbpckj72WuEg9jYPskp8ATy6 EL/X3o9lkzTRbs/PAPUv2xG/sjO+dvLI/cgXlIklbhCexNqiPAOQ75UzEiJWvSTmI7mX rNX9hOuma1JK2yUdAtM/GfhygNLuZfqqMID1VnO5gqw4laUi6vd1A0P+4wZneDvgxBfO u5nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XKQfezgx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si2979531plj.703.2018.04.12.03.23.25; Thu, 12 Apr 2018 03:23:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XKQfezgx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1752852AbeDLKXV (ORCPT + 29 others); Thu, 12 Apr 2018 06:23:21 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:38142 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751920AbeDLKXS (ORCPT ); Thu, 12 Apr 2018 06:23:18 -0400 Received: by mail-lf0-f66.google.com with SMTP id u3-v6so6928145lff.5 for ; Thu, 12 Apr 2018 03:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=SoN37o8Q+5MuFIa6LBTUxP8NyUi8yXhojITGM2W0Kxo=; b=XKQfezgx3COPBQyRYGpngEuV4AH3Oc/45Ax97bI0Hfwfkjoh9OarTD1J7oKvNUNs0P BqBJMPAYXpKGluz+Esl9qRCMcBDxDTMmml4c12hq6F39lDR4ceXkrcgUeA09ef2wZHdu iNClUGwp+C92AANFgkJuwNOUR7Fnz/cCyR90g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SoN37o8Q+5MuFIa6LBTUxP8NyUi8yXhojITGM2W0Kxo=; b=Oafn3GIIgiVV2rWtV8iQ8TMQKeMHN+dQXPAw9P4/qMFbJD5wdA2pUCIgeD/DBWXRmQ WY1ZUcUvywJLGkpQLP9npNUWtPOYuJBAA586nIVphuY7dOROd4VRokIHK5f+tcjNrtJI x9OydO3VcA4E0as1qFLh8Ew4jw4D0fmHvG94R8G72e04yzixxQp7dwbvXuZBmJapv28C k+dq6KFAuuJsOWeCMqX5jVAgNEG+xwaGdGeAARVam6+0aFoiE+s/30xn87Lg/VOBUHJ1 iJOBfXm0vHDWzyMyqQD+J/sPkn9bznrLPuEVVcRCQb3sRZYXQKq7eEfRl2xLQc4bwSFJ 1gPA== X-Gm-Message-State: ALQs6tDmutofMj4LgJFjK5umJPKpwHGULaYAVb8F5W/xenIQrujaehYN OwXyXObea98FKWLJqE1hSdvR4EfR1Kk= X-Received: by 2002:a19:a8d4:: with SMTP id r203-v6mr5447028lfe.146.1523528597019; Thu, 12 Apr 2018 03:23:17 -0700 (PDT) Received: from localhost (c-2c3d70d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.61.44]) by smtp.gmail.com with ESMTPSA id p9-v6sm648635lfh.93.2018.04.12.03.23.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Apr 2018 03:23:16 -0700 (PDT) From: Anders Roxell To: shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-gpio@vger.kernel.org, fathi.boudra@linaro.org, Anders Roxell Subject: [PATCH] selftests: add headers_install to lib.mk Date: Thu, 12 Apr 2018 12:23:02 +0200 Message-Id: <20180412102302.4532-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.16.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the kernel headers aren't installed we can't build all the tests. Add a new make target rule 'khdr' in the file lib.mk to generate the kernel headers and that gets include for every test-dir Makefile that includes lib.mk If the testdir in turn have its own sub-dirs the top_srcdir needs to be set to the linux-rootdir to be able to generate the kernel headers. Signed-off-by: Anders Roxell Reviewed-by: Fathi Boudra --- tools/testing/selftests/android/Makefile | 2 +- tools/testing/selftests/android/ion/Makefile | 1 + tools/testing/selftests/bpf/Makefile | 5 ++--- tools/testing/selftests/futex/functional/Makefile | 1 + tools/testing/selftests/gpio/Makefile | 4 ---- tools/testing/selftests/kvm/Makefile | 6 +----- tools/testing/selftests/lib.mk | 8 ++++++++ tools/testing/selftests/vm/Makefile | 3 --- 8 files changed, 14 insertions(+), 16 deletions(-) -- 2.16.3 diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile index f6304d2be90c..087390bbad68 100644 --- a/tools/testing/selftests/android/Makefile +++ b/tools/testing/selftests/android/Makefile @@ -6,7 +6,7 @@ TEST_PROGS := run.sh include ../lib.mk -all: +all: khdr @for DIR in $(SUBDIRS); do \ BUILD_TARGET=$(OUTPUT)/$$DIR; \ mkdir $$BUILD_TARGET -p; \ diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile index e03695287f76..14ecd9805748 100644 --- a/tools/testing/selftests/android/ion/Makefile +++ b/tools/testing/selftests/android/ion/Makefile @@ -11,6 +11,7 @@ $(TEST_GEN_FILES): ipcsocket.c ionutils.c TEST_PROGS := ion_test.sh include ../../lib.mk +top_srcdir = ../../../../../ $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 0a315ddabbf4..cc611a284087 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -16,9 +16,8 @@ LDLIBS += -lcap -lelf -lrt -lpthread TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read all: $(TEST_CUSTOM_PROGS) -$(TEST_CUSTOM_PROGS): urandom_read - -urandom_read: urandom_read.c +$(TEST_CUSTOM_PROGS):| khdr +$(TEST_CUSTOM_PROGS): urandom_read.c $(CC) -o $(TEST_CUSTOM_PROGS) -static $< # Order correspond to 'make run_tests' order diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile index ff8feca49746..9f602fb40241 100644 --- a/tools/testing/selftests/futex/functional/Makefile +++ b/tools/testing/selftests/futex/functional/Makefile @@ -19,5 +19,6 @@ TEST_GEN_FILES := \ TEST_PROGS := run.sh include ../../lib.mk +top_srcdir = ../../../../../ $(TEST_GEN_FILES): $(HEADERS) diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 1bbb47565c55..768b2be010db 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile @@ -25,7 +25,3 @@ $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h ../../../gpio/gpio-utils.o: make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio - -../../../../usr/include/linux/gpio.h: - make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/ - diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index dc44de904797..ba03ce334212 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -31,9 +31,5 @@ $(LIBKVM_OBJ): $(OUTPUT)/%.o: %.c $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) $(AR) crs $@ $^ -$(LINUX_HDR_PATH): - make -C $(top_srcdir) headers_install - -all: $(STATIC_LIBS) $(LINUX_HDR_PATH) +all: $(STATIC_LIBS) $(TEST_GEN_PROGS): $(STATIC_LIBS) -$(TEST_GEN_PROGS) $(LIBKVM_OBJ): | $(LINUX_HDR_PATH) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 195e9d4739a9..e0bfbc5b1f1f 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -16,8 +16,16 @@ 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)) +top_srcdir ?= ../../../../ + all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) +.PHONY: khdr +khdr: + make -C $(top_srcdir) headers_install + +$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr + .ONESHELL: define RUN_TESTS @export KSFT_TAP_LEVEL=`echo 1`; diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index fdefa2295ddc..1e34a40745ef 100644 --- a/tools/testing/selftests/vm/Makefile +++ b/tools/testing/selftests/vm/Makefile @@ -29,6 +29,3 @@ $(OUTPUT)/userfaultfd: ../../../../usr/include/linux/kernel.h $(OUTPUT)/userfaultfd: LDLIBS += -lpthread $(OUTPUT)/mlock-random-test: LDLIBS += -lcap - -../../../../usr/include/linux/kernel.h: - make -C ../../../.. headers_install