From patchwork Fri Apr 13 09:03:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 133348 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp512664ljb; Fri, 13 Apr 2018 02:04:03 -0700 (PDT) X-Google-Smtp-Source: AIpwx49jLMv2OAmdczJIQuBb9W1NDpG4F4OwY21dTcGpUv/xtcRVZHkhALfTmgkbtc1HVOUeY1Ap X-Received: by 10.99.100.65 with SMTP id y62mr1447368pgb.362.1523610243445; Fri, 13 Apr 2018 02:04:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523610243; cv=none; d=google.com; s=arc-20160816; b=mzN79cpKedv+oixmJJqxPwlHuBJN8KNxU85sECNV+xx5QNOsSl3OueLgEWXPDhoQjR 4jVs26w0PwKVHnUkamMsJtxTjnR9Qs2IKbZ58CL1I2KRgMGaXgmi1XRKjw70bejDfv2K FCL3j1vC3wixdvfUwTbiKT/p1vh2YL+6+9ghsisCuAgKMymh/oSpW3l9OtDv9Ju3q/fo aJqPnWMZfzr8XLkS1LHrwRsztbqF7gbDAitkf9aF60JvkBurnacgbfTrmaBNgBa+sq20 6eyfEsmv9QJzI43U04eZGG0WVxwhXozNdNlvSKJJbKYeEWAwPxtTMSYjoDXr7lV1/mkB 6X/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=S6jVlYwMyAxOpob3BCWyxOohnEmVxP5v5uyi+LLNoDo=; b=Wqy61Ho1MZm4bgDCKwaykD1cg5mA05vhcMsKjV+eoiHp5mMyCxgWme0A14iYrA08Pe HZaVQ8t/sMZd+PfW5uvuDTXXCFh7m1+3yXyRlEdhpEJeleLpjyqWL9glBGR6hJ3omTGN nGYDOlwJyd6bQVRJ/yal2sq9NFsZBgh2ejAJTHGtAGY4yYOD8/oOr+D7EjIWGalRdHOq O+2aRHOy+baCgzZe+yk+vSf3qsvkyMC4f/Ee8NSUK2ZdjzTYOYF1g5R1GUW1+uC7I4j9 abJa+pOQjULrqcuB4yXNVE7psO6DK7OW/pler7Bg6SRRnKHGkIw60Rcr7TqZhWpyPhD4 rP9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Knrwr7w3; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (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 r9si742780pgp.775.2018.04.13.02.04.03; Fri, 13 Apr 2018 02:04:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Knrwr7w3; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753644AbeDMJEC (ORCPT + 5 others); Fri, 13 Apr 2018 05:04:02 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:37576 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754187AbeDMJD7 (ORCPT ); Fri, 13 Apr 2018 05:03:59 -0400 Received: by mail-lf0-f66.google.com with SMTP id m200-v6so11566939lfm.4 for ; Fri, 13 Apr 2018 02:03:58 -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:in-reply-to:references; bh=rzh3wrCfyhoXAwJcYEkpvHrFov/zK3sqt4wKhi62ux8=; b=Knrwr7w3FOFDvfRjBRtW/2KK44QXi8fXojPcgdd6IucEfu8ppUGCiJaK/w4n/AemiM c9HeZPT+Ugte5XB7uuVl0yM530ECVoimaLJImKNw5NkMVS69F6kx8rDuxruNxLOv216Q 5wT68Il7txXkWPLy8HAfylt/X0pdXLUJoPWTA= 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:in-reply-to :references; bh=rzh3wrCfyhoXAwJcYEkpvHrFov/zK3sqt4wKhi62ux8=; b=rXu6Dke/ggfZ6HRetEPiSmVw9Q8zwYr8j1AkQVfK+rxA1I+6O9/Wv33kPuETUBN3eZ lx8a3cbjdoW91qMeyeFVEXrmtGwpMynS6k/NPDuy8GJwy3UIAbP6899p4VkRGNgz6+wS mkT68w1wA84mYtE+VdPF61YReABM7X7COAWjG9Ff3DvkJg12WYW7Eq1AyX7gDcDNL1OG JFFyuuPWasVO62SN80dA6aNYwJWZw9JZgZk9UFiEdKrAT6jaZc+5Cq6Z4wYi7JcuraLa UXkHJEGOeZTiEV99FbpiAA/XRiKjMDIr1p9wk4pwi/yrs5StjVFVQtrw9idS6YkBPLO8 kwxA== X-Gm-Message-State: ALQs6tB+GSFjStaSxc/34/5hdiw1lI/5/BWhDtONtw8VSYi8qNoHyoQD JY9yEzlMQfxqBMAwaf0VH2wruQ== X-Received: by 2002:a19:4b41:: with SMTP id y62-v6mr181920lfa.11.1523610237130; Fri, 13 Apr 2018 02:03:57 -0700 (PDT) Received: from localhost (c-2c3d70d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.61.44]) by smtp.gmail.com with ESMTPSA id 17sm911021ljr.66.2018.04.13.02.03.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Apr 2018 02:03:56 -0700 (PDT) From: Anders Roxell To: shuah@kernel.org, yamada.masahiro@socionext.com, michal.lkml@markovi.net Cc: linux-kselftest@vger.kernel.org, linux-kbuild@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 v2] selftests: add headers_install to lib.mk Date: Fri, 13 Apr 2018 11:03:51 +0200 Message-Id: <20180413090351.25662-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180412102302.4532-1-anders.roxell@linaro.org> References: <20180412102302.4532-1-anders.roxell@linaro.org> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@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 --- Makefile | 14 +------------- scripts/subarch.include | 13 +++++++++++++ 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 | 10 ++++++++++ tools/testing/selftests/vm/Makefile | 3 --- 10 files changed, 30 insertions(+), 29 deletions(-) create mode 100644 scripts/subarch.include -- 2.16.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Makefile b/Makefile index 74567b0ec2f0..0c47935d48a2 100644 --- a/Makefile +++ b/Makefile @@ -286,19 +286,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION) export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION -# SUBARCH tells the usermode build what the underlying arch is. That is set -# first, and if a usermode build is happening, the "ARCH=um" on the command -# line overrides the setting of ARCH below. If a native build is happening, -# then ARCH is assigned, getting whatever value it gets normally, and -# SUBARCH is subsequently ignored. - -SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ - -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ -e s/sa110/arm/ \ - -e s/s390x/s390/ -e s/parisc64/parisc/ \ - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ - -e s/riscv.*/riscv/) +include scripts/subarch.include # Cross compiling and selecting different set of gcc/bin-utils # --------------------------------------------------------------------------- diff --git a/scripts/subarch.include b/scripts/subarch.include new file mode 100644 index 000000000000..650682821126 --- /dev/null +++ b/scripts/subarch.include @@ -0,0 +1,13 @@ +# SUBARCH tells the usermode build what the underlying arch is. That is set +# first, and if a usermode build is happening, the "ARCH=um" on the command +# line overrides the setting of ARCH below. If a native build is happening, +# then ARCH is assigned, getting whatever value it gets normally, and +# SUBARCH is subsequently ignored. + +SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \ + -e s/sun4u/sparc64/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ + -e s/riscv.*/riscv/) 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..1b1e8135715e 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -16,8 +16,18 @@ 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 ?= ../../../../ +include $(top_srcdir)/scripts/subarch.include +ARCH ?= $(SUBARCH) + all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) +.PHONY: khdr +khdr: + make ARCH=$(ARCH) -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