Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4717192imm; Mon, 14 May 2018 11:45:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpFRVuRk2YifNTWyjs38VpfrKDVSYKkw22bca27Q613pFASq5ZI04xTi1a/2OTNey0Eccyn X-Received: by 2002:a17:902:9a4b:: with SMTP id x11-v6mr11169744plv.176.1526323555484; Mon, 14 May 2018 11:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526323555; cv=none; d=google.com; s=arc-20160816; b=W5GOoP5jC164L0Shi6VGm4RNF5mGdx7X4VESQhhaM+bT7Ni90+HaWu0wZHSi/e64AL 1AZPoCbJeb+uCvnspBezO3IKdkrmsXn1AczghdmccySDIfOTTvxgpcG1YzMXWB3UUv4f y+bgXets7fnl1Y/hArub79uvlrXGOQXpW/2fSqM16Fq/XvzXOZUF4aIQWI5kbves+o4W junUwvETnZiGhgIWE78L9OE6rob0J88QJfRnIvB3lEbEADs5AtS4nJN27jIqSBUkCLpS /IHls0u+T2hhIZIo5AQIg985QbzmC2mvSsqo+kho4GzM3awtTdKrH1WRyIjI1jisiz+H aPMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:subject:cc:to:from:date :arc-authentication-results; bh=DzwPnEii6DGbFJVJCMQ+EFiEXx5DcyNvEe1YQdl6IaY=; b=liwxO/selUF6hoV+GEQ1+PtWyV9rzL4+58QQ6Uq59hqPoTokWWQLqJizTKfc1+9iXe HcnNFZlK7NvholqSda071VOq+wJD8ohYTORkctmcSiMF6bxhbmkqb8n4EHETuSzYq0vx EOJIqZFGu1JMh4r+D53T/gvN6VbsXpBNLYEFdKCWSLmr/ukM8WeHn+EteM2ay7kCjgq4 4Pf3mldVtXQ9kXthvf9XwDRuXz2Y9P7BaKcL5OweQaFVKukdjjlE+Z694h4JpWMCdf3r zn3kNC+NpT8/ha4ZtZoOZv5TPKQKOWcnzTwbzXBL//MSAyB+ximRXdpPm/4ychxaC3NS I2Bw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26-v6si9833966pfa.45.2018.05.14.11.45.40; Mon, 14 May 2018 11:45:55 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbeENSob (ORCPT + 99 others); Mon, 14 May 2018 14:44:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36210 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751449AbeENSo2 (ORCPT ); Mon, 14 May 2018 14:44:28 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4EIhpM5050727 for ; Mon, 14 May 2018 14:44:27 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hydhaefbb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 14 May 2018 14:44:27 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 May 2018 19:44:25 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 14 May 2018 19:44:20 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4EIiKY816318904; Mon, 14 May 2018 18:44:20 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9129EA4040; Mon, 14 May 2018 19:35:52 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18A53A4053; Mon, 14 May 2018 19:35:51 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.206.47]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 14 May 2018 19:35:50 +0100 (BST) Date: Mon, 14 May 2018 21:44:16 +0300 From: Mike Rapoport To: Anders Roxell Cc: yamada.masahiro@socionext.com, michal.lkml@markovi.net, shuah@kernel.org, bamv2005@gmail.com, brgl@bgdev.pl, pbonzini@redhat.com, akpm@linux-foundation.org, aarcange@redhat.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH v3] selftests: add headers_install to lib.mk References: <20180413090351.25662-1-anders.roxell@linaro.org> <20180514115809.9803-1-anders.roxell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180514115809.9803-1-anders.roxell@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 18051418-0020-0000-0000-0000041D25B1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18051418-0021-0000-0000-000042B23654 Message-Id: <20180514184415.GA24300@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-14_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805140189 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 14, 2018 at 01:58:09PM +0200, Anders Roxell wrote: > 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 Ack for the userfaultfd part. > --- > 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 | 7 ++----- > tools/testing/selftests/kvm/Makefile | 7 ++----- > tools/testing/selftests/lib.mk | 10 ++++++++++ > tools/testing/selftests/vm/Makefile | 4 ---- > 10 files changed, 33 insertions(+), 31 deletions(-) > create mode 100644 scripts/subarch.include > > diff --git a/Makefile b/Makefile > index 6395c79ffe40..bad0a8f6e874 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 72c25a3cb658..d9a725478375 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..f3be7dcc060a 100644 > --- a/tools/testing/selftests/android/ion/Makefile > +++ b/tools/testing/selftests/android/ion/Makefile > @@ -10,6 +10,7 @@ $(TEST_GEN_FILES): ipcsocket.c ionutils.c > > TEST_PROGS := ion_test.sh > > +top_srcdir = ../../../../.. > include ../../lib.mk > > $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index 438d4f93875b..9741609a0eb1 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..ad1eeb14fda7 100644 > --- a/tools/testing/selftests/futex/functional/Makefile > +++ b/tools/testing/selftests/futex/functional/Makefile > @@ -18,6 +18,7 @@ TEST_GEN_FILES := \ > > TEST_PROGS := run.sh > > +top_srcdir = ../../../../.. > include ../../lib.mk > > $(TEST_GEN_FILES): $(HEADERS) > diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile > index 1bbb47565c55..4665cdbf1a8d 100644 > --- a/tools/testing/selftests/gpio/Makefile > +++ b/tools/testing/selftests/gpio/Makefile > @@ -21,11 +21,8 @@ endef > CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ > LDLIBS += -lmount -I/usr/include/libmount > > -$(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h > +$(BINARIES):| khdr > +$(BINARIES): ../../../gpio/gpio-utils.o > > ../../../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 d9d00319b07c..bcb69380bbab 100644 > --- a/tools/testing/selftests/kvm/Makefile > +++ b/tools/testing/selftests/kvm/Makefile > @@ -32,9 +32,6 @@ $(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) > +$(STATIC_LIBS):| khdr > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk > index 6466294366dc..9515af872e16 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_TEST_PRINT_RESULT > TEST_HDR_MSG="selftests: "`basename $$PWD`:" $$BASENAME_TEST"; \ > diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile > index fdefa2295ddc..58759454b1d0 100644 > --- a/tools/testing/selftests/vm/Makefile > +++ b/tools/testing/selftests/vm/Makefile > @@ -25,10 +25,6 @@ TEST_PROGS := run_vmtests > > include ../lib.mk > > -$(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 > -- > 2.17.0 > -- Sincerely yours, Mike.