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: 897601 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="XKQfezgx"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40MH783JZwz9s2R for ; Thu, 12 Apr 2018 20:23:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752552AbeDLKXU (ORCPT ); Thu, 12 Apr 2018 06:23:20 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34288 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752530AbeDLKXS (ORCPT ); Thu, 12 Apr 2018 06:23:18 -0400 Received: by mail-lf0-f68.google.com with SMTP id x125-v6so6934871lff.1 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=Op7CqLJNuriAeLOVHU/Rm8X46fZrByeJUUbPGvvo6PItF2gqWRyRf1UNfO3pIvUkQn mYSGbo2u5pskP8ZQrmdGU91AiMm3vPdGGpdgqw4nw3RUfTzSK2HfSl9G5iDOKBQNf3Bm p7Uyw6Y4t4Oh3bJ2IkhxP6DTQtDXk9PxuPezaGLebmi5fGkIsDYKKgp5DrioxEVUJ9Jl npwL0CAl02/T3vEff9ycptVARR1gILDZVtKDfkaQkAsQnoUsczfA44qK0FW5jTJsxnW/ FH6aitab5A6x1FpejKT3nb/UlIjfOeFCdbxehdBuhS9YfNtL2mQqDvwLm6S46PQociee ZJRQ== X-Gm-Message-State: ALQs6tBV9xzurMfj497/wgKmnT+kbhdSp3rdu/zB1BywYL86Y5Xbo0Gc dIukaQas+3f7ICYgTCriPWSVyw== X-Google-Smtp-Source: AIpwx4/L8fU1qfB41aH/2W81AIDFM7d0wkYa/65yKAl/v+WeYL3aR6ojWRWaDMgg51gx4UTBstvV0A== 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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(-) 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